From 38447c4b47e1a2cf75596171f003b3fb17502ed6 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 25 Oct 2011 23:04:10 +0100 Subject: [PATCH] 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. --- src/handlers.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; -- 2.39.5