tests/stacking: Alt+Tab focus+stacking test for globally active input

Gnome-shell uses meta_display_focus_default_window() when shell elements
loose focus which is the case with Alt+Tab window switching. Globally
active input clients don't immediately gain focus though so if
meta_display_focus_default_window focuses a wrong window stacking and
focus don't behave as expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2489>
This commit is contained in:
Sebastian Wick 2022-07-13 18:21:56 +02:00 committed by Marge Bot
parent 7ac982d0d2
commit c89bae8594
3 changed files with 31 additions and 0 deletions

View File

@ -443,6 +443,7 @@ stacking_tests = [
'workspace-basic', 'workspace-basic',
'workspace-test', 'workspace-test',
'always-on-top', 'always-on-top',
'focus-default-window-globally-active-input',
] ]
foreach stacking_test: stacking_tests foreach stacking_test: stacking_tests

View File

@ -0,0 +1,20 @@
new_client 0 x11
create 0/1
accept_focus 0/1 false
can_take_focus 0/1 true
accept_take_focus 0/1 true
show 0/1
new_client 1 wayland
create 1/1
show 1/1
assert_stacking 0/1 1/1
assert_focused 1/1
local_activate 0/1
focus_default_window
wait
assert_stacking 1/1 0/1
assert_focused 0/1

View File

@ -1171,6 +1171,16 @@ test_case_do (TestCase *test,
else else
meta_window_unmake_above (window); meta_window_unmake_above (window);
} }
else if (strcmp (argv[0], "focus_default_window") == 0)
{
if (argc != 1)
BAD_COMMAND("usage: %s", argv[0]);
MetaDisplay *display = meta_get_display ();
uint32_t timestamp = meta_display_get_current_time_roundtrip (display);
meta_display_focus_default_window (display, timestamp);
}
else else
{ {
BAD_COMMAND("Unknown command %s", argv[0]); BAD_COMMAND("Unknown command %s", argv[0]);