i3 - improved tiling WM


bugfix: default floating border regression

Patch status: merged

Patch by Tony Crisci

Long description:

Fixes a bug where a normal floating default border is not applied when
the default tiling border is set to a pixel value.

This bug was introduced in this commit:

43b447855df095c56e860117d53acd0dd09ac42b

Consider motif border for floating geometry

Fixes a comment that claimed default floating border could override
motif hints, which was never the case.

fixes #1305

To apply this patch, use:
curl http://cr.i3wm.org/patch/623/raw.patch | git am

b/src/manage.c

28
@@ -447,10 +447,9 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
29
 
30
     if (want_floating) {
31
         DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height);
32
-        /* motif hints will be applied only when `new_float` is `normal` or not
33
-         * specified */
34
-        bool automatic_border = (config.default_floating_border != BS_NORMAL &&
35
-                                 motif_border_style == BS_NORMAL);
36
+        /* automatically set the border to the default value if a motif border
37
+         * was not specified */
38
+        bool automatic_border = (motif_border_style == BS_NORMAL);
39
 
40
         floating_enable(nc, automatic_border);
41
     }

b/testcases/t/234-regress-default-floating-border.t

47
@@ -0,0 +1,43 @@
48
+#!perl
49
+# vim:ts=4:sw=4:expandtab
50
+#
51
+# Please read the following documents before working on tests:
52
+# • http://build.i3wm.org/docs/testsuite.html
53
+#   (or docs/testsuite)
54
+#
55
+# • http://build.i3wm.org/docs/lib-i3test.html
56
+#   (alternatively: perldoc ./testcases/lib/i3test.pm)
57
+#
58
+# • http://build.i3wm.org/docs/ipc.html
59
+#   (or docs/ipc)
60
+#
61
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
62
+#   (unless you are already familiar with Perl)
63
+#
64
+# This is a regression test for a bug where a normal floating default border is
65
+# not applied when the default tiling border is set to a pixel value.
66
+# Ticket: #1305
67
+# Bug still in: 4.8-62-g7381b50
68
+use i3test i3_autostart => 0;
69
+
70
+my $config = <<EOT;
71
+# i3 config file (v4)
72
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
73
+
74
+new_window pixel 5
75
+new_float normal
76
+EOT
77
+
78
+my $pid = launch_with_config($config);
79
+
80
+my $ws = fresh_workspace;
81
+
82
+my $float_window = open_floating_window;
83
+
84
+my @floating = @{get_ws($ws)->{floating_nodes}};
85
+
86
+is($floating[0]->{nodes}[0]->{border}, 'normal', 'default floating border is `normal`');
87
+
88
+exit_gracefully($pid);
89
+
90
+done_testing;