optimization: when moving floating windows, render/push only the floatingcon

This commit is contained in:
Michael Stapelberg 2011-04-01 22:40:12 +02:00
parent d8bf633e56
commit 21c7a69812
3 changed files with 18 additions and 8 deletions

View File

@ -60,6 +60,14 @@ void x_window_kill(xcb_window_t window);
*/
void x_draw_decoration(Con *con);
/**
* This function pushes the properties of each node of the layout tree to
* X11 if they have changed (like the map state, position of the window, ).
* It recursively traverses all children of the given node.
*
*/
void x_push_node(Con *con, bool skip_decoration);
/**
* Pushes all changes (state of each node, see x_push_node() and the window
* stack) to X11.

View File

@ -231,10 +231,10 @@ DRAGGING_CB(drag_window_callback) {
/* Reposition the client correctly while moving */
con->rect.x = old_rect->x + (new_x - event->root_x);
con->rect.y = old_rect->y + (new_y - event->root_y);
/* TODO: dont re-render the whole tree just because we change
* coordinates of a floating window */
tree_render();
x_push_changes(croot);
render_con(con, false);
x_push_node(con, true);
xcb_flush(conn);
}
/*

10
src/x.c
View File

@ -442,7 +442,7 @@ copy_pixmaps:
* It recursively traverses all children of the given node.
*
*/
static void x_push_node(Con *con) {
void x_push_node(Con *con, bool skip_decoration) {
Con *current;
con_state *state;
Rect rect = con->rect;
@ -582,9 +582,11 @@ static void x_push_node(Con *con) {
* in focus order to display the focused client in a stack first when
* switching workspaces (reduces flickering). */
TAILQ_FOREACH(current, &(con->focus_head), focused)
x_push_node(current);
x_push_node(current, skip_decoration);
if (con->type != CT_ROOT && con->type != CT_OUTPUT && con->mapped)
if (!skip_decoration &&
(con->type != CT_ROOT && con->type != CT_OUTPUT) &&
con->mapped)
x_draw_decoration(con);
}
@ -687,7 +689,7 @@ void x_push_changes(Con *con) {
DLOG("Done, EnterNotify re-enabled\n");
DLOG("\n\n PUSHING CHANGES\n\n");
x_push_node(con);
x_push_node(con, false);
xcb_window_t to_focus = focused->frame;
if (focused->window != NULL)