From: Michael Stapelberg Date: Tue, 25 Oct 2011 22:04:10 +0000 (+0100) Subject: Bugfix: Correctly use workspace_show() when focus changes to a different output via... X-Git-Tag: 4.1~44 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=38447c4b47e1a2cf75596171f003b3fb17502ed6;p=i3%2Fi3 Bugfix: Correctly use workspace_show() when focus changes to a different output via EnterNotify or FocusIn (Thanks pnutzh4x0r) This makes i3bar show the correct workspace when you move your mouse from one output to another. --- diff --git a/src/handlers.c b/src/handlers.c index 29dcdc70..aa3b418e 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -222,6 +222,13 @@ static int handle_enter_notify(xcb_enter_notify_event_t *event) { if (config.disable_focus_follows_mouse) return 1; + /* Get the currently focused workspace to check if the focus change also + * involves changing workspaces. If so, we need to call workspace_show() to + * correctly update state and send the IPC event. */ + Con *ws = con_get_workspace(con); + if (ws != con_get_workspace(focused)) + workspace_show(ws); + con_focus(con_descend_focused(con)); tree_render(); @@ -958,6 +965,14 @@ static int handle_focus_in(xcb_focus_in_event_t *event) { } DLOG("focus is different, updating decorations\n"); + + /* Get the currently focused workspace to check if the focus change also + * involves changing workspaces. If so, we need to call workspace_show() to + * correctly update state and send the IPC event. */ + Con *ws = con_get_workspace(con); + if (ws != con_get_workspace(focused)) + workspace_show(ws); + con_focus(con); /* We update focused_id because we don’t need to set focus again */ focused_id = event->event;