window: Don't check always-on-top overlap before placing

When we show a window, we'll check if it overlaps with an existing
always-on-top window with the intention to deny focus. However, we did
this potentially before having placed the window, meaning we effectively
checked as if it was placed at (0, 0), which created unexpected results.

Instead check the overlap state after placing. A window placement test
case is added to verify this works as expected.

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

View File

@ -2284,8 +2284,8 @@ meta_window_show (MetaWindow *window)
if (focus_window &&
window->showing_for_first_time &&
!meta_window_is_ancestor_of_transient (focus_window, window) &&
((!place_on_top_on_map && !takes_focus_on_map) ||
window_would_be_covered_by_always_above_window (window)))
!place_on_top_on_map &&
!takes_focus_on_map)
{
needs_stacking_adjustment = TRUE;
if (!window->placed)
@ -2316,6 +2316,12 @@ meta_window_show (MetaWindow *window)
meta_window_force_placement (window, place_flags);
}
if (focus_window &&
window->showing_for_first_time &&
!meta_window_is_ancestor_of_transient (focus_window, window) &&
window_would_be_covered_by_always_above_window (window))
needs_stacking_adjustment = TRUE;
if (needs_stacking_adjustment)
{
gboolean overlap;