Bugfix: also invalidate focused_id when the to_focus window is not mapped

This fixes a bug where focus might not be set correctly when changing workspaces
This commit is contained in:
Michael Stapelberg 2011-03-19 22:54:53 +01:00
parent b342d387a8
commit 03ea7cea28
1 changed files with 2 additions and 0 deletions

View File

@ -637,6 +637,8 @@ void x_push_changes(Con *con) {
if (focused_id != to_focus) { if (focused_id != to_focus) {
if (!focused->mapped) { if (!focused->mapped) {
DLOG("Not updating focus (to %p / %s), focused window is not mapped.\n", focused, focused->name); DLOG("Not updating focus (to %p / %s), focused window is not mapped.\n", focused, focused->name);
/* Invalidate focused_id to correctly focus new windows with the same ID */
focused_id = XCB_NONE;
} else { } else {
DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name); DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME); xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);