Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'vanilla/next' into gaps-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Airblader committed Apr 10, 2020
2 parents d17da4d + b247896 commit a087d6b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scratchpad.c
Expand Up @@ -138,7 +138,7 @@ bool scratchpad_show(Con *con) {
floating->scratchpad_state != SCRATCHPAD_NONE) {
DLOG("Found a visible scratchpad window on another workspace,\n");
DLOG("moving it to this workspace: con = %p\n", walk_con);
con_move_to_workspace(walk_con, focused_ws, true, false, false);
con_move_to_workspace(floating, focused_ws, true, false, false);
con_activate(con_descend_focused(walk_con));
return true;
}
Expand Down
26 changes: 26 additions & 0 deletions testcases/t/185-scratchpad.t
Expand Up @@ -548,5 +548,31 @@ is ($x->input_focus, $second->id, 'moving scratchpad window does not show it');
cmd '[id=' . $first->id . '] move position center';
is ($x->input_focus, $second->id, 'centering scratchpad window does not show it');

###################################################################################
# Verify that a scratchpad container with child containers that was open in
# another workspace is moved to the current workspace (with all its children)
# after a scratchpad show.
################################################################################

kill_all_windows;
open_window;
open_window;
# This is to dodge the edge case were the whole workspace is moved
# window-by-window into the scratchpad.
cmd 'layout tabbed';
cmd 'focus parent';
cmd 'move to scratchpad';
$ws = fresh_workspace;
cmd 'scratchpad show';
# Case 1: a parent node in the scratchpad does not lose children
# Note on the layout: there should be a floating tabbed container, which is
# represented as follows:
# [workspace object] -> [floating_nodes] -> [tabbed node container] -> [the 2 children we expect]
is(scalar @{get_ws($ws)->{floating_nodes}->[0]->{nodes}->[0]->{nodes}}, 2, 'both windows moved from scratchpad to this workspace');

# Case 2: a parent node in the scratchpad from another workspace does not lose children
$ws = fresh_workspace;
cmd 'scratchpad show';
is(scalar @{get_ws($ws)->{floating_nodes}->[0]->{nodes}->[0]->{nodes}}, 2, 'both windows moved from scratchpad focused on other workspace to this workspace');

done_testing;

0 comments on commit a087d6b

Please sign in to comment.