Bugfix: don't try to resize docks by command
Patch status: merged
Patch by Tony Crisci
Long description:
cmd_resize does not implement a method to resize dock clients. A command like `[instance=".*"] resize grow width 160 px or 16 ppt` when a dock client matched would crash i3. fixes #1201
To apply this patch, use:
curl http://cr.i3wm.org/patch/468/raw.patch | git am
b/src/commands.c
21 |
@@ -779,6 +779,12 @@ void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resiz |
22 |
|
23 |
owindow *current; |
24 |
TAILQ_FOREACH(current, &owindows, owindows) { |
25 |
+ /* Don't handle dock windows (issue #1201) */ |
26 |
+ if (current->con->window->dock) { |
27 |
+ DLOG("This is a dock window. Not resizing (con = %p)\n)", current->con); |
28 |
+ continue; |
29 |
+ } |
30 |
+ |
31 |
Con *floating_con; |
32 |
if ((floating_con = con_inside_floating(current->con))) { |
33 |
cmd_resize_floating(current_match, cmd_output, way, direction, floating_con, px); |
b/testcases/t/222-regress-dock-resize.t
39 |
@@ -0,0 +1,42 @@ |
40 |
+#!perl |
41 |
+# vim:ts=4:sw=4:expandtab |
42 |
+# |
43 |
+# Please read the following documents before working on tests: |
44 |
+# • http://build.i3wm.org/docs/testsuite.html |
45 |
+# (or docs/testsuite) |
46 |
+# |
47 |
+# • http://build.i3wm.org/docs/lib-i3test.html |
48 |
+# (alternatively: perldoc ./testcases/lib/i3test.pm) |
49 |
+# |
50 |
+# • http://build.i3wm.org/docs/ipc.html |
51 |
+# (or docs/ipc) |
52 |
+# |
53 |
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf |
54 |
+# (unless you are already familiar with Perl) |
55 |
+# |
56 |
+# Test that i3 does not crash when a command is issued that would resize a dock |
57 |
+# client. |
58 |
+# Ticket: #1201 |
59 |
+# Bug still in: 4.7.2-107-g9b03be6 |
60 |
+use i3test i3_autostart => 0; |
61 |
+ |
62 |
+my $config = <<'EOT'; |
63 |
+# i3 config file (v4) |
64 |
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 |
65 |
+EOT |
66 |
+ |
67 |
+my $pid = launch_with_config($config); |
68 |
+ |
69 |
+my $i3 = i3(get_socket_path()); |
70 |
+$i3->connect()->recv; |
71 |
+ |
72 |
+my $window = open_window( |
73 |
+ wm_class => 'special', |
74 |
+ window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), |
75 |
+); |
76 |
+ |
77 |
+cmd('[class="special"] resize grow height 160 px or 16 ppt'); |
78 |
+ |
79 |
+does_i3_live; |
80 |
+ |
81 |
+done_testing; |