Invalidate last_focused when focusing the EWMH support window
Fixes #3562
This commit is contained in:
parent
dd708199ea
commit
fb1ae61d1c
1
src/x.c
1
src/x.c
|
@ -1325,6 +1325,7 @@ void x_push_changes(Con *con) {
|
||||||
change_ewmh_focus(XCB_WINDOW_NONE, last_focused);
|
change_ewmh_focus(XCB_WINDOW_NONE, last_focused);
|
||||||
|
|
||||||
focused_id = ewmh_window;
|
focused_id = ewmh_window;
|
||||||
|
last_focused = XCB_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_flush(conn);
|
xcb_flush(conn);
|
||||||
|
|
|
@ -14,14 +14,20 @@
|
||||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||||
# (unless you are already familiar with Perl)
|
# (unless you are already familiar with Perl)
|
||||||
|
|
||||||
use i3test;
|
use i3test i3_config => <<EOT;
|
||||||
|
# i3 config file (v4)
|
||||||
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
|
|
||||||
|
# fake-1 under fake-0 to not interfere with left/right wraping
|
||||||
|
fake-outputs 1024x768+0+0,1024x768+0+1024
|
||||||
|
workspace X output fake-1
|
||||||
|
EOT
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Window focus event
|
# Window focus event
|
||||||
################################
|
################################
|
||||||
|
|
||||||
cmd 'split h';
|
my $ws = fresh_workspace(output => 0);
|
||||||
|
|
||||||
my $win0 = open_window;
|
my $win0 = open_window;
|
||||||
my $win1 = open_window;
|
my $win1 = open_window;
|
||||||
my $win2 = open_window;
|
my $win2 = open_window;
|
||||||
|
@ -66,4 +72,30 @@ subtest 'focus right (3)', \&focus_subtest, 'focus right', $win0->name;
|
||||||
subtest 'focus left', \&focus_subtest, 'focus left', $win2->name;
|
subtest 'focus left', \&focus_subtest, 'focus left', $win2->name;
|
||||||
subtest 'kill doesn\'t produce focus event', \&kill_subtest, '[id=' . $win1->id . '] kill', $win1->name;
|
subtest 'kill doesn\'t produce focus event', \&kill_subtest, '[id=' . $win1->id . '] kill', $win1->name;
|
||||||
|
|
||||||
|
# See issue #3562. We need to switch to an existing workspace on the second
|
||||||
|
# output to trigger the bug.
|
||||||
|
cmd 'workspace X';
|
||||||
|
subtest 'workspace focus', \&focus_subtest, "workspace $ws", $win2->name;
|
||||||
|
|
||||||
|
sub scratchpad_subtest {
|
||||||
|
my ($cmd, $name) = @_;
|
||||||
|
|
||||||
|
my $focus = AnyEvent->condvar;
|
||||||
|
|
||||||
|
my @events = events_for(
|
||||||
|
sub { cmd $cmd },
|
||||||
|
'window');
|
||||||
|
|
||||||
|
is(scalar @events, 2, 'Received 2 events');
|
||||||
|
is($events[0]->{change}, 'move', 'Move event received');
|
||||||
|
is($events[0]->{container}->{nodes}->[0]->{name}, $name, "$name moved");
|
||||||
|
is($events[1]->{change}, 'focus', 'Focus event received');
|
||||||
|
is($events[1]->{container}->{name}, $name, "$name focused");
|
||||||
|
}
|
||||||
|
|
||||||
|
fresh_workspace;
|
||||||
|
my $win = open_window;
|
||||||
|
cmd 'move scratchpad';
|
||||||
|
subtest 'scratchpad', \&scratchpad_subtest, '[id=' . $win->id . '] scratchpad show', $win->name;
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue