Cross-output focus focus floating exception
Patch status: merged
Patch by Tony Crisci
Long description:
Focusing across outputs with `focus [direction]` should focus an existing floating con when no tiling con exists on the output in [direction].
To apply this patch, use:
curl http://cr.i3wm.org/patch/597/raw.patch | git am
b/src/tree.c
18 |
@@ -582,6 +582,13 @@ static bool _tree_next(Con *con, char way, orientation_t orientation, bool wrap) |
19 |
return true; |
20 |
|
21 |
Con *focus = con_descend_direction(workspace, direction); |
22 |
+ |
23 |
+ /* special case: if there was no tiling con to focus and the workspace |
24 |
+ * has a floating con in the focus stack, focus the top of the focus |
25 |
+ * stack (which may be floating) */ |
26 |
+ if (focus == workspace) |
27 |
+ focus = con_descend_focused(workspace); |
28 |
+ |
29 |
if (focus) { |
30 |
con_focus(focus); |
31 |
x_set_warp_to(&(focus->rect)); |
b/testcases/t/520-regress-focus-direction-floating.t
37 |
@@ -0,0 +1,48 @@ |
38 |
+#!perl |
39 |
+# vim:ts=4:sw=4:expandtab |
40 |
+# |
41 |
+# Please read the following documents before working on tests: |
42 |
+# • http://build.i3wm.org/docs/testsuite.html |
43 |
+# (or docs/testsuite) |
44 |
+# |
45 |
+# • http://build.i3wm.org/docs/lib-i3test.html |
46 |
+# (alternatively: perldoc ./testcases/lib/i3test.pm) |
47 |
+# |
48 |
+# • http://build.i3wm.org/docs/ipc.html |
49 |
+# (or docs/ipc) |
50 |
+# |
51 |
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf |
52 |
+# (unless you are already familiar with Perl) |
53 |
+# |
54 |
+# Ensure that `focus [direction]` will focus an existing floating con when no |
55 |
+# tiling con exists on the output in [direction] when focusing across outputs |
56 |
+# Bug still in: 4.7.2-204-g893dbae |
57 |
+use i3test i3_autostart => 0; |
58 |
+ |
59 |
+my $config = <<EOT; |
60 |
+# i3 config file (v4) |
61 |
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 |
62 |
+ |
63 |
+workspace ws_left output fake-0 |
64 |
+workspace ws_right output fake-1 |
65 |
+ |
66 |
+mouse_warping none |
67 |
+ |
68 |
+fake-outputs 1024x768+0+0,1024x768+1024+0 |
69 |
+EOT |
70 |
+ |
71 |
+my $pid = launch_with_config($config); |
72 |
+ |
73 |
+cmd 'workspace ws_left'; |
74 |
+my $win = open_window(); |
75 |
+ |
76 |
+cmd 'floating enable'; |
77 |
+cmd 'focus output right'; |
78 |
+cmd 'focus left'; |
79 |
+ |
80 |
+is($x->input_focus, $win->id, |
81 |
+ 'Focusing across outputs with `focus [direction]` should focus an existing floating con when no tiling con exists on the output in [direction].'); |
82 |
+ |
83 |
+exit_gracefully($pid); |
84 |
+ |
85 |
+done_testing; |