window: Postpone focusing until grab ended if uninteractable

When GNOME Shell is in the overview, we don't want windows to steal
focus left and right, but once we leave the overview, we do want
whatever was mapped with "take_focus" to get focus. Do that, but after
the last grab was dismissed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2690
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3185>
This commit is contained in:
Jonas Ådahl
2023-08-16 00:09:09 +02:00
committed by Marge Bot
parent 03ee48094e
commit 05eeb684d1
3 changed files with 65 additions and 10 deletions

View File

@ -1939,15 +1939,6 @@ window_state_on_map (MetaWindow *window,
return;
}
/* Do not focus window on map if input is already taken by the
* compositor.
*/
if (!meta_display_windows_are_interactable (window->display))
{
*takes_focus = FALSE;
return;
}
/* When strict focus mode is enabled, prevent new windows from taking
* focus unless they are ancestors to the transient.
*/
@ -2262,7 +2253,10 @@ meta_window_show (MetaWindow *window)
timestamp = meta_display_get_current_time_roundtrip (window->display);
meta_window_focus (window, timestamp);
if (meta_display_windows_are_interactable (window->display))
meta_window_focus (window, timestamp);
else
meta_display_queue_focus (window->display, window);
}
else if (display->x11_display)
{