X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fworkspace.c;h=670322a9428dbbe0c5cea78ccc3af5468b503856;hb=22be7bc986f51e8dc798fcd5f6bb72e3ed87ba0c;hp=17f5ac33d27b3d4fe2ce2d7bf8404e1f920273c9;hpb=0f6b5fe8dafe0a7f903d84b1f1f9e6689bddfc1e;p=i3%2Fi3 diff --git a/src/workspace.c b/src/workspace.c index 17f5ac33..670322a9 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -11,9 +11,6 @@ * */ #include "all.h" -#include "yajl_utils.h" - -#include /* Stores a copy of the name of the last used workspace for the workspace * back-and-forth switching. */ @@ -128,6 +125,8 @@ Con *create_workspace_on_output(Output *output, Con *content) { continue; DLOG("relevant command = %s\n", bind->command); char *target = bind->command + strlen("workspace "); + while((*target == ' ' || *target == '\t') && target != '\0') + target++; /* We check if this is the workspace * next/prev/next_on_output/prev_on_output/back_and_forth/number command. * Beware: The workspace names "next", "prev", "next_on_output", @@ -195,17 +194,16 @@ Con *create_workspace_on_output(Output *output, Con *content) { while (exists) { c++; - FREE(ws->name); - sasprintf(&(ws->name), "%d", c); + ws->num = c; current = NULL; TAILQ_FOREACH(out, &(croot->nodes_head), nodes) - GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name)); + GREP_FIRST(current, output_get_content(out), child->num == ws->num); exists = (current != NULL); - DLOG("result for ws %s / %d: exists = %d\n", ws->name, c, exists); + DLOG("result for ws %d: exists = %d\n", c, exists); } - ws->num = c; + sasprintf(&(ws->name), "%d", c); } con_attach(ws, content, false); @@ -334,39 +332,6 @@ static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents FREE(con->urgency_timer); } -/* - * For the "focus" event we send, along the usual "change" field, also the - * current and previous workspace, in "current" and "old" respectively. - */ -static void ipc_send_workspace_focus_event(Con *current, Con *old) { - setlocale(LC_NUMERIC, "C"); - yajl_gen gen = ygenalloc(); - - y(map_open); - - ystr("change"); - ystr("focus"); - - ystr("current"); - dump_node(gen, current, false); - - ystr("old"); - if (old == NULL) - y(null); - else - dump_node(gen, old, false); - - y(map_close); - - const unsigned char *payload; - ylength length; - y(get_buf, &payload, &length); - - ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, (const char *)payload); - y(free); - setlocale(LC_NUMERIC, ""); -} - static void _workspace_show(Con *workspace) { Con *current, *old = NULL;