call tree_render() only after commands which require it

Saves one call of tree_render for exec, for example
This commit is contained in:
Michael Stapelberg 2011-05-29 12:29:49 +02:00
parent 446c9b7313
commit 8acea3d34c
3 changed files with 32 additions and 2 deletions

View File

@ -397,6 +397,8 @@ focus:
LOG("focusing %p / %s\n", current->con, current->con->name); LOG("focusing %p / %s\n", current->con, current->con->name);
con_focus(current->con); 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); printf("should switch to workspace %s\n", $2);
workspace_show($2); workspace_show($2);
free($2); free($2);
tree_render();
} }
; ;
@ -441,6 +446,8 @@ open:
Con *con = tree_open_con(NULL); Con *con = tree_open_con(NULL);
con_focus(con); con_focus(con);
asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)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); printf("matching: %p / %s\n", current->con, current->con->name);
con_toggle_fullscreen(current->con); con_toggle_fullscreen(current->con);
} }
tree_render();
} }
; ;
@ -466,6 +475,8 @@ next:
/* TODO: use matches */ /* TODO: use matches */
printf("should select next window in direction %c\n", $2); printf("should select next window in direction %c\n", $2);
tree_next('n', ($2 == 'v' ? VERT : HORIZ)); tree_next('n', ($2 == 'v' ? VERT : HORIZ));
tree_render();
} }
; ;
@ -475,6 +486,8 @@ prev:
/* TODO: use matches */ /* TODO: use matches */
printf("should select prev window in direction %c\n", $2); printf("should select prev window in direction %c\n", $2);
tree_next('p', ($2 == 'v' ? VERT : HORIZ)); tree_next('p', ($2 == 'v' ? VERT : HORIZ));
tree_render();
} }
; ;
@ -484,6 +497,8 @@ split:
/* TODO: use matches */ /* TODO: use matches */
printf("splitting in direction %c\n", $2); printf("splitting in direction %c\n", $2);
tree_split(focused, ($2 == 'v' ? VERT : HORIZ)); 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); printf("matching: %p / %s\n", current->con, current->con->name);
current->con->border_style = $2; current->con->border_style = $2;
} }
tree_render();
} }
; ;
@ -552,6 +571,8 @@ level:
if ($2 == 'u') if ($2 == 'u')
level_up(); level_up();
else level_down(); else level_down();
tree_render();
} }
; ;
@ -565,6 +586,8 @@ move:
{ {
printf("moving in direction %d\n", $2); printf("moving in direction %d\n", $2);
tree_move($2); tree_move($2);
tree_render();
} }
| TOK_MOVE TOK_WORKSPACE STR | TOK_MOVE TOK_WORKSPACE STR
{ {
@ -581,6 +604,8 @@ move:
printf("matching: %p / %s\n", current->con, current->con->name); printf("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, ws); con_move_to_workspace(current->con, ws);
} }
tree_render();
} }
; ;
@ -590,6 +615,7 @@ restore:
printf("restoring \"%s\"\n", $2); printf("restoring \"%s\"\n", $2);
tree_append_json($2); tree_append_json($2);
free($2); free($2);
tree_render();
} }
; ;
@ -608,6 +634,8 @@ layout:
con_set_layout(current->con, $2); con_set_layout(current->con, $2);
} }
} }
tree_render();
} }
; ;
@ -631,6 +659,8 @@ mark:
} }
free($<string>2); free($<string>2);
tree_render();
} }
; ;
@ -699,6 +729,8 @@ resize:
LOG("focused->percent after = %f\n", focused->percent); LOG("focused->percent after = %f\n", focused->percent);
LOG("other->percent after = %f\n", other->percent); LOG("other->percent after = %f\n", other->percent);
} }
tree_render();
} }
; ;

View File

@ -106,7 +106,6 @@ static int handle_key_press(xcb_key_press_event_t *event) {
} }
parse_cmd(bind->command); parse_cmd(bind->command);
tree_render();
return 1; return 1;
} }

View File

@ -148,7 +148,6 @@ IPC_HANDLER(command) {
strncpy(command, (const char*)message, message_size); strncpy(command, (const char*)message, message_size);
LOG("IPC: received: *%s*\n", command); LOG("IPC: received: *%s*\n", command);
const char *reply = parse_cmd((const char*)command); const char *reply = parse_cmd((const char*)command);
tree_render();
free(command); free(command);
/* If no reply was provided, we just use the default success message */ /* If no reply was provided, we just use the default success message */