Bugfix: client requests to focus switch workspaces
Patch status: needinfo
Patch by Tony Crisci
Long description:
Allow client requests of type _NET_ACTIVE_WINDOW to switch workspaces. This allows task switchers like skippy-xd to work properly. http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368127856
To apply this patch, use:
curl http://cr.i3wm.org/patch/526/raw.patch | git am
b/src/handlers.c
18 |
@@ -702,8 +702,9 @@ static void handle_client_message(xcb_client_message_event_t *event) { |
19 |
} |
20 |
|
21 |
Con *ws = con_get_workspace(con); |
22 |
- if (!workspace_is_visible(ws)) { |
23 |
- DLOG("Workspace not visible, ignoring _NET_ACTIVE_WINDOW\n"); |
24 |
+ |
25 |
+ if (ws == NULL) { |
26 |
+ DLOG("Window is not being managed, ignoring _NET_ACTIVE_WINDOW\n"); |
27 |
return; |
28 |
} |
29 |
|
b/testcases/t/195-net-active-window.t
34 |
@@ -54,7 +54,7 @@ is($x->input_focus, $win1->id, 'window 1 has focus'); |
35 |
|
36 |
################################################################################ |
37 |
# Switch to a different workspace and ensure sending the _NET_ACTIVE_WINDOW |
38 |
-# ClientMessage has no effect anymore. |
39 |
+# ClientMessage switches to that workspaces. |
40 |
################################################################################ |
41 |
|
42 |
my $ws2 = fresh_workspace; |
43 |
@@ -64,7 +64,26 @@ is($x->input_focus, $win3->id, 'window 3 has focus'); |
44 |
|
45 |
send_net_active_window($win1->id); |
46 |
|
47 |
-is($x->input_focus, $win3->id, 'window 3 still has focus'); |
48 |
+is($x->input_focus, $win1->id, 'window 1 has focus'); |
49 |
+ |
50 |
+cmd '[id="' . $win3->id . '"] focus'; |
51 |
+ |
52 |
+################################################################################ |
53 |
+# Make sure the ClientMessage only works with managed windows, and specifying a |
54 |
+# window that is not managed does not crash i3 (#774) |
55 |
+################################################################################ |
56 |
+ |
57 |
+my $dock = open_window(window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK')); |
58 |
+ |
59 |
+send_net_active_window($dock->id); |
60 |
+ |
61 |
+does_i3_live; |
62 |
+is($x->input_focus, $win3->id, 'dock did not get input focus'); |
63 |
+ |
64 |
+send_net_active_window($x->get_root_window()); |
65 |
+ |
66 |
+does_i3_live; |
67 |
+is($x->input_focus, $win3->id, 'root window did not get input focus'); |
68 |
|
69 |
################################################################################ |
70 |
# Move a window to the scratchpad, send a _NET_ACTIVE_WINDOW for it and verify |