From: Michael Stapelberg Date: Sat, 7 Jan 2012 18:21:12 +0000 (+0000) Subject: Merge branch 'master' into next X-Git-Tag: 4.2~153 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=634512404940fb4b1effc930feb8b108883cef60;p=i3%2Fi3 Merge branch 'master' into next Conflicts: src/con.c --- 634512404940fb4b1effc930feb8b108883cef60 diff --cc src/con.c index 799148ef,bf22be84..f90d569f --- a/src/con.c +++ b/src/con.c @@@ -656,8 -656,9 +656,11 @@@ void con_move_to_workspace(Con *con, Co 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). */ - if (workspace->name[0] != '_' || workspace->name[1] != '_') + * calling tree_render(), so for the "real" focus this is a no-op). - * We don’t focus when there is a fullscreen con on that workspace. */ - if (con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL) ++ * 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] != '_') && ++ con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL) con_focus(con_descend_focused(con)); /* 8: when moving to a visible workspace on a different output, we keep the diff --cc testcases/t/156-fullscreen-focus.t index c7646e41,3f08effd..08de5ed1 --- a/testcases/t/156-fullscreen-focus.t +++ b/testcases/t/156-fullscreen-focus.t @@@ -57,6 -63,35 +57,32 @@@ my $tmp2 = get_unused_workspace cmd "move workspace $tmp2"; # verify that the third window has the focus - -sync_with_i3($x); - is($x->input_focus, $third->id, 'third window focused'); + ################################################################################ + # Ensure that moving a window to a workspace which has a fullscreen window does + # not focus it (otherwise the user cannot get out of fullscreen mode anymore). + ################################################################################ + + $tmp = fresh_workspace; + + my $fullscreen_window = open_window; + cmd 'fullscreen'; + + my $nodes = get_ws_content($tmp); + is(scalar @$nodes, 1, 'precisely one window'); + is($nodes->[0]->{focused}, 1, 'fullscreen window focused'); + my $old_id = $nodes->[0]->{id}; + + $tmp2 = fresh_workspace; + my $move_window = open_window; + cmd "move workspace $tmp"; + + cmd "workspace $tmp"; + + $nodes = get_ws_content($tmp); + is(scalar @$nodes, 2, 'precisely two windows'); + is($nodes->[0]->{id}, $old_id, 'id unchanged'); + is($nodes->[0]->{focused}, 1, 'fullscreen window focused'); + done_testing;