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.
This commit is contained in:
Michael Stapelberg 2011-10-25 23:04:10 +01:00
parent e710477a07
commit 38447c4b47
1 changed files with 15 additions and 0 deletions

View File

@ -222,6 +222,13 @@ static int handle_enter_notify(xcb_enter_notify_event_t *event) {
if (config.disable_focus_follows_mouse) if (config.disable_focus_follows_mouse)
return 1; 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)); con_focus(con_descend_focused(con));
tree_render(); tree_render();
@ -958,6 +965,14 @@ static int handle_focus_in(xcb_focus_in_event_t *event) {
} }
DLOG("focus is different, updating decorations\n"); 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); con_focus(con);
/* We update focused_id because we dont need to set focus again */ /* We update focused_id because we dont need to set focus again */
focused_id = event->event; focused_id = event->event;