Bugfix: `tree_split` does not split floating cons
Patch status: merged
Patch by Tony Crisci
Long description:
Use the more robust test of `con_is_floating` for testing a container for being floating. fixes #1177
To apply this patch, use:
curl http://cr.i3wm.org/patch/411/raw.patch | git am
b/src/tree.c
| 19 |
@@ -387,7 +387,7 @@ void tree_close_con(kill_window_t kill_window) {
|
| 20 |
* |
| 21 |
*/ |
| 22 |
void tree_split(Con *con, orientation_t orientation) {
|
| 23 |
- if (con->type == CT_FLOATING_CON) {
|
| 24 |
+ if (con_is_floating(con)) {
|
| 25 |
DLOG("Floating containers can't be split.\n");
|
| 26 |
return; |
| 27 |
} |
b/testcases/t/218-regress-floating-split.t
| 33 |
@@ -0,0 +1,35 @@ |
| 34 |
+#!perl |
| 35 |
+# vim:ts=4:sw=4:expandtab |
| 36 |
+# |
| 37 |
+# Please read the following documents before working on tests: |
| 38 |
+# • http://build.i3wm.org/docs/testsuite.html |
| 39 |
+# (or docs/testsuite) |
| 40 |
+# |
| 41 |
+# • http://build.i3wm.org/docs/lib-i3test.html |
| 42 |
+# (alternatively: perldoc ./testcases/lib/i3test.pm) |
| 43 |
+# |
| 44 |
+# • http://build.i3wm.org/docs/ipc.html |
| 45 |
+# (or docs/ipc) |
| 46 |
+# |
| 47 |
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf |
| 48 |
+# (unless you are already familiar with Perl) |
| 49 |
+# |
| 50 |
+# Make sure floating containers really can't be split. |
| 51 |
+# Ticket: #1177 |
| 52 |
+# Bug still in: 4.7.2-81-g905440d |
| 53 |
+use i3test; |
| 54 |
+ |
| 55 |
+my $ws = fresh_workspace; |
| 56 |
+my $window = open_floating_window; |
| 57 |
+cmd "layout stacked"; |
| 58 |
+cmd "splitv"; |
| 59 |
+ |
| 60 |
+my $floating_con = get_ws($ws)->{floating_nodes}[0]->{nodes}[0];
|
| 61 |
+ |
| 62 |
+is(@{$floating_con->{nodes}}, 0, 'floating con is still a leaf');
|
| 63 |
+ |
| 64 |
+cmd 'floating disable'; |
| 65 |
+ |
| 66 |
+does_i3_live; |
| 67 |
+ |
| 68 |
+done_testing; |