From: Michael Stapelberg Date: Wed, 1 Apr 2015 07:08:22 +0000 (+0200) Subject: Merge pull request #1618 from Deiz/fix-1603 X-Git-Tag: 4.11~154 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3b81e40096bfafd6dcff1008953054eefc93eeae;hp=ebac737314861898afa51edd13a19ece7697b3c3;p=i3%2Fi3 Merge pull request #1618 from Deiz/fix-1603 Allow single-child non-default layout cons to be moved between outputs --- diff --git a/src/move.c b/src/move.c index 1999a1fe..e4da191a 100644 --- a/src/move.c +++ b/src/move.c @@ -249,6 +249,14 @@ void tree_move(Con *con, int direction) { ? AFTER : BEFORE); insert_con_into(con, target, position); + } else if (con->parent->parent->type == CT_WORKSPACE && + con->parent->layout != L_DEFAULT && + con_num_children(con->parent) == 1) { + /* Con is the lone child of a non-default layout container at the edge + * of the workspace. Treat it as though the workspace is its parent + * and move it to the next output. */ + DLOG("Grandparent is workspace\n"); + move_to_output_directed(con, direction); } else { DLOG("Moving into container above\n"); position = (direction == D_UP || direction == D_LEFT ? BEFORE : AFTER); diff --git a/testcases/t/524-move.t b/testcases/t/524-move.t new file mode 100644 index 00000000..473bf235 --- /dev/null +++ b/testcases/t/524-move.t @@ -0,0 +1,99 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# +# Tests the behaviour of 'move ' when moving containers across +# outputs on workspaces that have non-default layouts. +# Ticket: #1603 +# Bug still in: 4.10.1-40-g0ad097e +use List::Util qw(first); +use i3test i3_autostart => 0; + +my $config = < 'first'); +my $second = open_window(wm_class => 'second'); + +is_num_children('left-top', 1, 'one child on left-top'); +is_num_children('right-top', 0, 'no children on right-top'); + +# Move the second window into its own stacked container. +cmd 'move right'; +is_num_children('left-top', 2, 'two children on left-top'); + +# Move the second window onto the upper right workspace. +cmd 'move right'; +is_num_children('left-top', 1, 'one child on left-top'); +is_num_children('right-top', 1, 'one child on right-top'); + +# Move the first window onto the upper right workspace. +cmd '[class="first"] move right'; +is_num_children('left-top', 0, 'no children on left-top'); +is_num_children('right-top', 2, 'two children on right-top'); + +# Move the second window onto the lower right workspace. +cmd '[class="second"] move down, move down'; +is_num_children('right-top', 1, 'one child on right-top'); +is_num_children('right-bottom', 1, 'two children on right-bottom'); + +# Move the first window onto the lower right workspace. +cmd '[class="first"] move down'; +is_num_children('right-top', 0, 'no children on right-top'); +is_num_children('right-bottom', 2, 'two children on right-bottom'); + +# Move the second windo onto the lower left workspace. +cmd '[class="second"] move left, move left'; +is_num_children('right-bottom', 1, 'one child on right-bottom'); +is_num_children('left-bottom', 1, 'one on left-bottom'); + +# Move the first window onto the lower left workspace. +cmd '[class="first"] move left'; +is_num_children('right-bottom', 0, 'no children on right-bottom'); +is_num_children('left-bottom', 2, 'two children on left-bottom'); + +# Move the second window onto the upper left workspace. +cmd '[class="second"] move up, move up'; +is_num_children('left-bottom', 1, 'one child on left-bottom'); +is_num_children('left-top', 1, 'one child on left-top'); + +# Move the first window onto the upper left workspace. +cmd '[class="first"] move up'; +is_num_children('left-bottom', 0, 'no children on left-bottom'); +is_num_children('left-top', 2, 'two children on left-top'); + +exit_gracefully($pid); + +done_testing;