diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2019-07-03 11:15:36 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2019-07-08 11:21:17 +0200 |
commit | c327b2df95ff9979dd22bca2e0d285e1b3ba0add (patch) | |
tree | 60ea1842fc593984fb4480fff690d9a63c09c2d8 /src | |
parent | 9aee47daa984e5cc4a1ccefb3aacfbb2729cfbc1 (diff) | |
download | mutter-c327b2df95ff9979dd22bca2e0d285e1b3ba0add.tar.gz |
window-x11: Accept any focusable window as fallback focus
As per commit f71151a5 we were ignoring WM_TAKE_FOCUS-only windows as focus
targets, however this might end-up in an infinite loop if there are multiple
non-input windows stacked.
So, accept any focusable window as fallback focus target even if it's a
take-focus one (that might not reply to the request).
Added a stacking test to verify this.
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/meson.build | 1 | ||||
-rw-r--r-- | src/tests/stacking/closed-transient-no-input-parents.metatest | 46 | ||||
-rw-r--r-- | src/x11/window-x11.c | 2 |
3 files changed, 48 insertions, 1 deletions
diff --git a/src/tests/meson.build b/src/tests/meson.build index 26bf3a8c1..1a196f0fa 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -114,6 +114,7 @@ stacking_tests = [ 'closed-transient-no-input-no-take-focus-parent', 'closed-transient-no-input-no-take-focus-parents', 'closed-transient-no-input-parent', + 'closed-transient-no-input-parents', 'closed-transient-no-input-parent-delayed-focus-default-cancelled', 'minimized', 'mixed-windows', diff --git a/src/tests/stacking/closed-transient-no-input-parents.metatest b/src/tests/stacking/closed-transient-no-input-parents.metatest new file mode 100644 index 000000000..e3ec2e84a --- /dev/null +++ b/src/tests/stacking/closed-transient-no-input-parents.metatest @@ -0,0 +1,46 @@ +new_client 0 x11 +create 0/1 +show 0/1 + +new_client 1 x11 +create 1/1 +show 1/1 + +create 1/2 csd +set_parent 1/2 1 +accept_focus 1/2 false +show 1/2 + +create 1/3 csd +set_parent 1/3 2 +accept_focus 1/3 false +show 1/3 + +create 1/4 csd +set_parent 1/4 3 +accept_focus 1/4 false +show 1/4 + +create 1/5 csd +set_parent 1/5 3 +show 1/5 + +wait +assert_focused 1/5 +assert_stacking 0/1 1/1 1/2 1/3 1/4 1/5 + +destroy 1/5 +dispatch + +assert_focused none +assert_stacking 0/1 1/1 1/2 1/3 1/4 + +sleep 250 +assert_focused none +assert_stacking 0/1 1/1 1/2 1/3 1/4 + +destroy 1/3 +wait + +assert_focused none +assert_stacking 0/1 1/1 1/2 1/4 diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 3c93a8d5d..8450fdd77 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -906,7 +906,7 @@ meta_window_x11_focus (MetaWindow *window, if (!focus_window) break; - if (focus_window->input) + if (meta_window_is_focusable (focus_window)) break; if (focus_window->shaded && focus_window->frame) |