Bugfix: Don’t focus the wrong workspace when moving to scratchpad (+test) (Thanks loblik)
The problem was that scratchpad_move() didn’t check whether the source workspace was focused. Therefore, 'move scratchpad' only worked reliably interactively , but not when used with criteria.
This commit is contained in:
parent
9436e6f26e
commit
15499bf8e7
|
@ -657,7 +657,9 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
||||||
* con focused. Otherwise, we leave the focus on the current workspace as we
|
* con focused. Otherwise, we leave the focus on the current workspace as we
|
||||||
* don’t want to focus invisible workspaces */
|
* don’t want to focus invisible workspaces */
|
||||||
if (source_output != dest_output &&
|
if (source_output != dest_output &&
|
||||||
workspace_is_visible(workspace)) {
|
workspace_is_visible(workspace) &&
|
||||||
|
workspace->name[0] != '_' &&
|
||||||
|
workspace->name[1] != '_') {
|
||||||
DLOG("Moved to a different output, focusing target\n");
|
DLOG("Moved to a different output, focusing target\n");
|
||||||
} else {
|
} else {
|
||||||
/* Descend focus stack in case focus_next is a workspace which can
|
/* Descend focus stack in case focus_next is a workspace which can
|
||||||
|
|
|
@ -58,7 +58,8 @@ void scratchpad_move(Con *con) {
|
||||||
|
|
||||||
/* 4: Fix focus. Normally, when moving a window to a different output, the
|
/* 4: Fix focus. Normally, when moving a window to a different output, the
|
||||||
* destination output gets focused. In this case, we don’t want that. */
|
* destination output gets focused. In this case, we don’t want that. */
|
||||||
con_focus(focus_next);
|
if (con_get_workspace(focus_next) == con_get_workspace(focused))
|
||||||
|
con_focus(focus_next);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!perl
|
||||||
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
# When using a command which moves a window to scratchpad from an invisible
|
||||||
|
# (e.g. unfocused) workspace and immediately shows that window again, i3
|
||||||
|
# crashed.
|
||||||
|
# Bug still in: 4.2-305-g22922a9
|
||||||
|
use i3test;
|
||||||
|
|
||||||
|
my $ws1 = fresh_workspace;
|
||||||
|
my $invisible_window = open_window;
|
||||||
|
my $other_focusable_window = open_window;
|
||||||
|
|
||||||
|
my $ws2 = fresh_workspace;
|
||||||
|
my $id = $invisible_window->id;
|
||||||
|
cmd qq|[id="$id"] move scratchpad, scratchpad show|;
|
||||||
|
|
||||||
|
does_i3_live;
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
Reference in New Issue