From: Michael Stapelberg Date: Fri, 28 Sep 2012 22:03:42 +0000 (+0200) Subject: Merge branch 'master' into next X-Git-Tag: 4.4~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=72c66a2091659c0a986a627bdb3b766628437553;p=i3%2Fi3 Merge branch 'master' into next --- 72c66a2091659c0a986a627bdb3b766628437553 diff --cc src/con.c index 0539c7ab,0f7a5cbb..1140fe80 --- a/src/con.c +++ b/src/con.c @@@ -697,13 -666,20 +697,20 @@@ void con_move_to_workspace(Con *con, Co con->percent = 0.0; con_fix_percent(next); - /* 7: focus the con on the target workspace (the X focus is only updated by - * calling tree_render(), so for the "real" focus this is a no-op). + /* 7: focus the con on the target workspace, but only within that + * workspace, that is, don’t move focus away if the target workspace is + * invisible. * We don’t focus the con for i3 pseudo workspaces like __i3_scratch and * we don’t focus when there is a fullscreen con on that workspace. */ - if ((workspace->name[0] != '_' || workspace->name[1] != '_') && + if (!con_is_internal(workspace) && - con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL) + con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL) { + /* We need to save focus on workspace level and restore it afterwards. + * Otherwise, we might focus a different workspace without actually + * switching workspaces. */ + Con *old_focus = TAILQ_FIRST(&(output_get_content(dest_output)->focus_head)); con_focus(con_descend_focused(con)); + con_focus(old_focus); + } /* 8: when moving to a visible workspace on a different output, we keep the * con focused. Otherwise, we leave the focus on the current workspace as we