From: Michael Stapelberg Date: Fri, 21 Jan 2011 20:49:56 +0000 (+0100) Subject: Bugfix: Fix focus problems when switching workspaces by pushing the window stack... X-Git-Tag: tree-pr2~111 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cbf4fcb9b5b05146dae464d6414c9a8b8144ddba;p=i3%2Fi3 Bugfix: Fix focus problems when switching workspaces by pushing the window stack before mapping --- diff --git a/src/x.c b/src/x.c index b929fdcd..f99dbcfc 100644 --- a/src/x.c +++ b/src/x.c @@ -559,13 +559,16 @@ static void x_push_node_unmaps(Con *con) { * Pushes all changes (state of each node, see x_push_node() and the window * stack) to X11. * + * NOTE: We need to push the stack first so that the windows have the correct + * stacking order. This is relevant for workspace switching where we map the + * windows because mapping may generate EnterNotify events. When they are + * generated in the wrong order, this will cause focus problems when switching + * workspaces. + * */ void x_push_changes(Con *con) { con_state *state; - DLOG("\n\n PUSHING CHANGES\n\n"); - x_push_node(con); - DLOG("-- PUSHING WINDOW STACK --\n"); bool order_changed = false; /* X11 correctly represents the stack if we push it from bottom to top */ @@ -587,6 +590,9 @@ void x_push_changes(Con *con) { state->initial = false; } + DLOG("\n\n PUSHING CHANGES\n\n"); + x_push_node(con); + xcb_window_t to_focus = focused->frame; if (focused->window != NULL) to_focus = focused->window->id;