Merge branch 'move-floating' into next
This commit is contained in:
commit
4330c723ae
@ -1134,9 +1134,19 @@ mode_toggle::
|
||||
|
||||
For moving, use +move left+, +move right+, +move down+ and +move up+.
|
||||
|
||||
*Syntax*:
|
||||
-----------------------------------
|
||||
focus <left|right|down|up>
|
||||
focus <parent|child|floating|tiling|mode_toggle>
|
||||
move <left|right|down|up> [<px> px]
|
||||
-----------------------------------
|
||||
|
||||
Note that the amount of pixels you can specify for the +move+ command is only
|
||||
relevant for floating containers. The default amount is 10 pixels.
|
||||
|
||||
*Examples*:
|
||||
----------------------
|
||||
# Focus clients on the left, bottom, top, right:
|
||||
# Focus container on the left, bottom, top, right:
|
||||
bindsym mod+j focus left
|
||||
bindsym mod+k focus down
|
||||
bindsym mod+l focus up
|
||||
@ -1148,11 +1158,15 @@ bindsym mod+u focus parent
|
||||
# Focus last floating/tiling container
|
||||
bindsym mod+g focus mode_toggle
|
||||
|
||||
# Move client to the left, bottom, top, right:
|
||||
# Move container to the left, bottom, top, right:
|
||||
bindsym mod+j move left
|
||||
bindsym mod+k move down
|
||||
bindsym mod+l move up
|
||||
bindsym mod+semicolon move right
|
||||
|
||||
# Move container, but make floating containers
|
||||
# move more than the default
|
||||
bindsym mod+j move left 20 px
|
||||
----------------------
|
||||
|
||||
=== Changing (named) workspaces/moving to workspaces
|
||||
|
@ -734,10 +734,27 @@ border_style:
|
||||
;
|
||||
|
||||
move:
|
||||
TOK_MOVE direction
|
||||
TOK_MOVE direction resize_px
|
||||
{
|
||||
printf("moving in direction %d\n", $2);
|
||||
tree_move($2);
|
||||
int direction = $2;
|
||||
int px = $3;
|
||||
|
||||
/* TODO: make 'move' work with criteria. */
|
||||
printf("moving in direction %d\n", direction);
|
||||
if (con_is_floating(focused)) {
|
||||
printf("floating move with %d pixels\n", px);
|
||||
if (direction == TOK_LEFT) {
|
||||
focused->parent->rect.x -= px;
|
||||
} else if (direction == TOK_RIGHT) {
|
||||
focused->parent->rect.x += px;
|
||||
} else if (direction == TOK_UP) {
|
||||
focused->parent->rect.y -= px;
|
||||
} else if (direction == TOK_DOWN) {
|
||||
focused->parent->rect.y += px;
|
||||
}
|
||||
} else {
|
||||
tree_move(direction);
|
||||
}
|
||||
|
||||
tree_render();
|
||||
}
|
||||
|
@ -8,7 +8,9 @@
|
||||
# 4) move a container in a different direction so that we need to go up in tree
|
||||
#
|
||||
use i3test;
|
||||
use X11::XCB::Connection;
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
my $i3 = i3(get_socket_path());
|
||||
|
||||
my $tmp = fresh_workspace;
|
||||
@ -24,13 +26,13 @@ is(@{$old_content}, 1, 'one container on this workspace');
|
||||
|
||||
my $first = $old_content->[0]->{id};
|
||||
|
||||
#cmd 'move before h';
|
||||
#cmd 'move before v';
|
||||
#cmd 'move after v';
|
||||
#cmd 'move after h';
|
||||
cmd 'move left';
|
||||
cmd 'move right';
|
||||
cmd 'move up';
|
||||
cmd 'move down';
|
||||
|
||||
my $content = get_ws_content($tmp);
|
||||
#is_deeply($old_content, $content, 'workspace unmodified after useless moves');
|
||||
is_deeply($old_content, $content, 'workspace unmodified after useless moves');
|
||||
|
||||
######################################################################
|
||||
# 2) move a container before another single container
|
||||
@ -131,4 +133,75 @@ cmd "move right";
|
||||
$content = get_ws_content($otmp);
|
||||
is(@{$content}, 1, 'only one nodes on this workspace');
|
||||
|
||||
######################################################################
|
||||
# 5) test moving floating containers.
|
||||
######################################################################
|
||||
|
||||
$tmp = fresh_workspace;
|
||||
my $floatwin = open_floating_window($x);
|
||||
my ($absolute_before, $top_before) = $floatwin->rect;
|
||||
|
||||
cmd 'move left';
|
||||
|
||||
my ($absolute, $top) = $floatwin->rect;
|
||||
|
||||
is($absolute->x, ($absolute_before->x - 10), 'moved 10 px to the left');
|
||||
is($absolute->y, $absolute_before->y, 'y not changed');
|
||||
is($absolute->width, $absolute_before->width, 'width not changed');
|
||||
is($absolute->height, $absolute_before->height, 'height not changed');
|
||||
|
||||
$absolute_before = $absolute;
|
||||
$top_before = $top;
|
||||
|
||||
cmd 'move right';
|
||||
|
||||
($absolute, $top) = $floatwin->rect;
|
||||
|
||||
is($absolute->x, ($absolute_before->x + 10), 'moved 10 px to the right');
|
||||
is($absolute->y, $absolute_before->y, 'y not changed');
|
||||
is($absolute->width, $absolute_before->width, 'width not changed');
|
||||
is($absolute->height, $absolute_before->height, 'height not changed');
|
||||
|
||||
$absolute_before = $absolute;
|
||||
$top_before = $top;
|
||||
|
||||
cmd 'move up';
|
||||
|
||||
($absolute, $top) = $floatwin->rect;
|
||||
|
||||
is($absolute->x, $absolute_before->x, 'x not changed');
|
||||
is($absolute->y, ($absolute_before->y - 10), 'moved 10 px up');
|
||||
is($absolute->width, $absolute_before->width, 'width not changed');
|
||||
is($absolute->height, $absolute_before->height, 'height not changed');
|
||||
|
||||
$absolute_before = $absolute;
|
||||
$top_before = $top;
|
||||
|
||||
cmd 'move down';
|
||||
|
||||
($absolute, $top) = $floatwin->rect;
|
||||
|
||||
is($absolute->x, $absolute_before->x, 'x not changed');
|
||||
is($absolute->y, ($absolute_before->y + 10), 'moved 10 px up');
|
||||
is($absolute->width, $absolute_before->width, 'width not changed');
|
||||
is($absolute->height, $absolute_before->height, 'height not changed');
|
||||
|
||||
$absolute_before = $absolute;
|
||||
$top_before = $top;
|
||||
|
||||
######################################################################
|
||||
# 6) test moving floating containers with a specific amount of px
|
||||
######################################################################
|
||||
|
||||
cmd 'move left 20 px';
|
||||
|
||||
($absolute, $top) = $floatwin->rect;
|
||||
|
||||
is($absolute->x, ($absolute_before->x - 20), 'moved 10 px to the left');
|
||||
is($absolute->y, $absolute_before->y, 'y not changed');
|
||||
is($absolute->width, $absolute_before->width, 'width not changed');
|
||||
is($absolute->height, $absolute_before->height, 'height not changed');
|
||||
|
||||
|
||||
|
||||
done_testing;
|
||||
|
Loading…
Reference in New Issue
Block a user