window: Only deny focus if mostly overlapped with always-on-top window

Having an always-on-top window affects focus granting logic if the
to be showing window overlaps with any of them. Instead of triggering
the focus denying logic if a new window ever so slightly touches an
always-on-top window to only triggering if it's covered more than 60% by
always-on-top windows.

This is intended to make using always-on-top windows a bit less annoying
and not cause as many unintended focus-on-map denials.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
This commit is contained in:
Jonas Ådahl
2024-07-11 15:11:13 +02:00
committed by Sebastian Wick
parent 74f58674e7
commit c7ddc839f1
3 changed files with 91 additions and 7 deletions

View File

@ -727,6 +727,7 @@ stacking_tests = [
'workspace-test',
'always-on-top',
'always-on-top-map-new-maximized',
'always-on-top-map-new-partial',
'focus-default-window-globally-active-input',
'workspace-unmanaging-window',
'click-to-focus-and-raise',

View File

@ -0,0 +1,59 @@
resize_monitor default 400 400
set_pref center-new-windows true
new_client w wayland
create w/1 csd
resize w/1 100 100
show w/1
assert_focused w/1
assert_stacking w/1
create w/2 csd
resize w/2 100 100
show w/2
assert_focused w/2
assert_stacking w/1 w/2
create w/3 csd
resize w/3 100 100
show w/3
assert_focused w/3
assert_stacking w/1 w/2 w/3
# Mark two windows as always-above
make_above w/1 true
move w/1 201 150
assert_stacking w/2 w/3 w/1
make_above w/3 true
move w/3 0 0
assert_stacking w/2 w/1 w/3
# Map another window while the other non-aways-on-top window has focus.
# It will be mostly visible, so will take focus.
local_activate w/2
assert_focused w/2
create w/4 csd
resize w/4 100 100
show w/4
assert_focused w/4
assert_stacking w/2 w/4 w/1 w/3
# Move one of the always-on-top window so that the next mapped one will be
# mostly non-visible, thus not take focus.
move w/1 180 150
create w/5 csd
resize w/5 100 100
show w/5
assert_focused w/4
assert_stacking w/2 w/5 w/4 w/1 w/3