From: Michael Stapelberg Date: Sun, 29 May 2011 10:29:49 +0000 (+0200) Subject: call tree_render() only after commands which require it X-Git-Tag: tree-pr4~103 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8acea3d34c2a663f9a617b6e119b73519fae3195;p=i3%2Fi3 call tree_render() only after commands which require it Saves one call of tree_render for exec, for example --- diff --git a/src/cmdparse.y b/src/cmdparse.y index b247d59b..3770028b 100644 --- a/src/cmdparse.y +++ b/src/cmdparse.y @@ -397,6 +397,8 @@ focus: LOG("focusing %p / %s\n", current->con, current->con->name); con_focus(current->con); } + + tree_render(); } ; @@ -416,6 +418,7 @@ kill: } } + tree_render(); } ; @@ -431,6 +434,8 @@ workspace: printf("should switch to workspace %s\n", $2); workspace_show($2); free($2); + + tree_render(); } ; @@ -441,6 +446,8 @@ open: Con *con = tree_open_con(NULL); con_focus(con); asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con); + + tree_render(); } ; @@ -457,6 +464,8 @@ fullscreen: printf("matching: %p / %s\n", current->con, current->con->name); con_toggle_fullscreen(current->con); } + + tree_render(); } ; @@ -466,6 +475,8 @@ next: /* TODO: use matches */ printf("should select next window in direction %c\n", $2); tree_next('n', ($2 == 'v' ? VERT : HORIZ)); + + tree_render(); } ; @@ -475,6 +486,8 @@ prev: /* TODO: use matches */ printf("should select prev window in direction %c\n", $2); tree_next('p', ($2 == 'v' ? VERT : HORIZ)); + + tree_render(); } ; @@ -484,6 +497,8 @@ split: /* TODO: use matches */ printf("splitting in direction %c\n", $2); tree_split(focused, ($2 == 'v' ? VERT : HORIZ)); + + tree_render(); } ; @@ -514,6 +529,8 @@ mode: } } } + + tree_render(); } ; @@ -535,6 +552,8 @@ border: printf("matching: %p / %s\n", current->con, current->con->name); current->con->border_style = $2; } + + tree_render(); } ; @@ -552,6 +571,8 @@ level: if ($2 == 'u') level_up(); else level_down(); + + tree_render(); } ; @@ -565,6 +586,8 @@ move: { printf("moving in direction %d\n", $2); tree_move($2); + + tree_render(); } | TOK_MOVE TOK_WORKSPACE STR { @@ -581,6 +604,8 @@ move: printf("matching: %p / %s\n", current->con, current->con->name); con_move_to_workspace(current->con, ws); } + + tree_render(); } ; @@ -590,6 +615,7 @@ restore: printf("restoring \"%s\"\n", $2); tree_append_json($2); free($2); + tree_render(); } ; @@ -608,6 +634,8 @@ layout: con_set_layout(current->con, $2); } } + + tree_render(); } ; @@ -631,6 +659,8 @@ mark: } free($2); + + tree_render(); } ; @@ -699,6 +729,8 @@ resize: LOG("focused->percent after = %f\n", focused->percent); LOG("other->percent after = %f\n", other->percent); } + + tree_render(); } ; diff --git a/src/handlers.c b/src/handlers.c index aceb5b70..eaf71ddb 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -106,7 +106,6 @@ static int handle_key_press(xcb_key_press_event_t *event) { } parse_cmd(bind->command); - tree_render(); return 1; } diff --git a/src/ipc.c b/src/ipc.c index 0535d122..bdf1dfea 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -148,7 +148,6 @@ IPC_HANDLER(command) { strncpy(command, (const char*)message, message_size); LOG("IPC: received: *%s*\n", command); const char *reply = parse_cmd((const char*)command); - tree_render(); free(command); /* If no reply was provided, we just use the default success message */