Bugfix: Attach new cons at the correct place when a floating con is focused (+test) (Thanks fernandotcl)
New containers were previously attached directly to the workspace instead of to the previously focused place in the workspace (for example a stacked con). Fixes: #376
This commit is contained in:
parent
3d2cd6abaa
commit
aea445b690
|
@ -66,9 +66,13 @@ Con *tree_open_con(Con *con) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the currently focused container is a floating container, we
|
/* If the currently focused container is a floating container, we
|
||||||
* attach the new container to the workspace */
|
* attach the new container to the currently focused spot in its
|
||||||
if (con->type == CT_FLOATING_CON)
|
* workspace. */
|
||||||
|
if (con->type == CT_FLOATING_CON) {
|
||||||
|
con = con_descend_tiling_focused(con->parent);
|
||||||
|
if (con->type != CT_WORKSPACE)
|
||||||
con = con->parent;
|
con = con->parent;
|
||||||
|
}
|
||||||
DLOG("con = %p\n", con);
|
DLOG("con = %p\n", con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,4 +61,48 @@ sleep 0.25;
|
||||||
|
|
||||||
is(@{$nodes}, 1, 'one tiling node');
|
is(@{$nodes}, 1, 'one tiling node');
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# 2: similar case: floating windows should be attached at the currently focused
|
||||||
|
# position in the workspace (for example a stack), not just at workspace level.
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
my $first = open_standard_window($x);
|
||||||
|
my $second = open_standard_window($x);
|
||||||
|
|
||||||
|
cmd 'layout stacked';
|
||||||
|
|
||||||
|
$ws = get_ws($tmp);
|
||||||
|
is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
|
||||||
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
||||||
|
|
||||||
|
# Create a floating window
|
||||||
|
my $window = $x->root->create_child(
|
||||||
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
rect => [ 0, 0, 30, 30],
|
||||||
|
background_color => '#C0C0C0',
|
||||||
|
# replace the type with 'utility' as soon as the coercion works again in X11::XCB
|
||||||
|
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
||||||
|
);
|
||||||
|
|
||||||
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
||||||
|
$window->map;
|
||||||
|
|
||||||
|
sleep 0.25;
|
||||||
|
|
||||||
|
ok($window->mapped, 'Window is mapped');
|
||||||
|
|
||||||
|
$ws = get_ws($tmp);
|
||||||
|
is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
|
||||||
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
||||||
|
|
||||||
|
my $third = open_standard_window($x);
|
||||||
|
|
||||||
|
|
||||||
|
$ws = get_ws($tmp);
|
||||||
|
is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
|
||||||
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue