window-x11: Focus the default window with delay while waiting for take-focus

When requesting to a take-focus window to acquire the input, the client may or
may not respond with a SetInputFocus (this doesn't happen for no-input gtk
windows in fact [to be fixed there too]), in such case we were unsetting the
focus while waiting the reply.

In case the client won't respond, we wait for a small delay (set to 250 ms) for
the take-focus window to grab the input focus before setting it to the default
window.

Added a test for this behavior and for the case in which a window takes the
focus meanwhile we're waiting to focus the default window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
(cherry picked from commit f71151a5dd)
This commit is contained in:
Marco Trevisan (Treviño)
2018-11-14 00:08:34 +01:00
parent 866d6780c9
commit 2db94e2e40
4 changed files with 144 additions and 7 deletions

View File

@@ -1,3 +1,7 @@
new_client 2 x11
create 2/1
show 2/1
new_client 1 x11
create 1/1
show 1/1
@@ -12,9 +16,15 @@ set_parent 1/3 2
show 1/3
wait
assert_stacking 1/1 1/2 1/3
assert_focused 1/3
assert_stacking 2/1 1/1 1/2 1/3
destroy 1/3
dispatch
wait
assert_stacking 1/1 1/2
assert_focused none
assert_stacking 2/1 1/1 1/2
sleep 250
assert_focused 1/1
assert_stacking 2/1 1/1 1/2