diff --git a/include/x.h b/include/x.h index b8ead5ee..df4ee276 100644 --- a/include/x.h +++ b/include/x.h @@ -60,6 +60,14 @@ void x_window_kill(xcb_window_t window, kill_window_t kill_window); */ void x_draw_decoration(Con *con); +/** + * Recursively calls x_draw_decoration. This cannot be done in x_push_node + * because x_push_node uses focus order to recurse (see the comment above) + * while drawing the decoration needs to happen in the actual order. + * + */ +void x_deco_recurse(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, …). diff --git a/src/handlers.c b/src/handlers.c index 583b0c5a..8e9bbb04 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -586,7 +586,7 @@ static int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t * */ static int handle_expose_event(xcb_expose_event_t *event) { - Con *parent, *con; + Con *parent; /* event->count is the number of minimum remaining expose events for this * window, so we skip all events but the last one */ @@ -600,22 +600,8 @@ static int handle_expose_event(xcb_expose_event_t *event) { return 1; } - if (parent->window) - x_draw_decoration(parent); - - TAILQ_FOREACH(con, &(parent->nodes_head), nodes) { - DLOG("expose for con %p / %s\n", con, con->name); - if (con->window) - x_draw_decoration(con); - } - - /* We also need to render the decorations of other Cons nearby the Con - * itself to not get overlapping decorations */ - TAILQ_FOREACH(con, &(parent->parent->nodes_head), nodes) { - DLOG("expose for con %p / %s\n", con, con->name); - if (con->window) - x_draw_decoration(con); - } + /* re-render the parent (recursively, if it’s a split con) */ + x_deco_recurse(parent); xcb_flush(conn); return 1; diff --git a/src/x.c b/src/x.c index 85e9f41a..96c9d806 100644 --- a/src/x.c +++ b/src/x.c @@ -460,7 +460,7 @@ copy_pixmaps: * while drawing the decoration needs to happen in the actual order. * */ -static void x_deco_recurse(Con *con) { +void x_deco_recurse(Con *con) { Con *current; bool leaf = TAILQ_EMPTY(&(con->nodes_head)) && TAILQ_EMPTY(&(con->floating_head));