]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Restore border_style when restarting inplace (Thanks aniou)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 11 May 2011 18:45:56 +0000 (20:45 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 11 May 2011 18:45:56 +0000 (20:45 +0200)
Fixes #385.

src/load_layout.c
testcases/t/61-regress-borders-restart.t [new file with mode: 0644]

index f946c6660412740a56fc0a7e9b60fed1c2669fa6..c5b6bcf11903e4df77751c0b05792845f5bf562a 100644 (file)
@@ -120,6 +120,17 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
                 json_node->orientation = VERT;
             else LOG("Unhandled orientation: %s\n", buf);
             free(buf);
+        } else if (strcasecmp(last_key, "border") == 0) {
+            char *buf = NULL;
+            asprintf(&buf, "%.*s", (int)len, val);
+            if (strcasecmp(buf, "none") == 0)
+                json_node->border_style = BS_NONE;
+            else if (strcasecmp(buf, "1pixel") == 0)
+                json_node->border_style = BS_1PIXEL;
+            else if (strcasecmp(buf, "normal") == 0)
+                json_node->border_style = BS_NORMAL;
+            else LOG("Unhandled \"border\": %s\n", buf);
+            free(buf);
         }
     }
     return 1;
diff --git a/testcases/t/61-regress-borders-restart.t b/testcases/t/61-regress-borders-restart.t
new file mode 100644 (file)
index 0000000..25a73b5
--- /dev/null
@@ -0,0 +1,39 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Regression test to check if borders are correctly restored after an inplace
+# restart.
+# found in eb8ad348b28e243cba1972e802ca8ee636472fc9
+#
+use X11::XCB qw(:all);
+use List::Util qw(first);
+use i3test;
+
+my $x = X11::XCB::Connection->new;
+my $i3 = i3("/tmp/nestedcons");
+my $tmp = fresh_workspace;
+my $window = open_standard_window($x);
+
+sub get_border_style {
+    my @content = @{get_ws_content($tmp)};
+    my $wininfo = first { $_->{window} == $window->id } @content;
+
+    return $wininfo->{border};
+}
+
+is(get_border_style(), 'normal', 'border style normal');
+
+cmd 'border 1pixel';
+
+is(get_border_style(), '1pixel', 'border style 1pixel after changing');
+
+# perform an inplace-restart
+cmd 'restart';
+
+sleep 0.25;
+
+does_i3_live;
+
+is(get_border_style(), '1pixel', 'border style still 1pixel after restart');
+
+done_testing;