core: Never automatically switch focus in strict focus mode

With window_is_terminal gone, "strict" and "smart" focus mode have no
behavioural difference. Let's broaden the scope of strict focus mode,
such that windows never automatically focus unless they are an ancestor
to the transient.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3063>
This commit is contained in:
Brendan William 2023-06-16 19:43:23 -07:00
parent 3bd36d506b
commit 23b98db004

View File

@ -2006,6 +2006,20 @@ window_state_on_map (MetaWindow *window,
return;
}
/* When strict focus mode is enabled, prevent new windows from taking
* focus unless they are ancestors to the transient.
*/
if (*takes_focus &&
meta_prefs_get_focus_new_windows () == G_DESKTOP_FOCUS_NEW_WINDOWS_STRICT &&
!meta_window_is_ancestor_of_transient (window->display->focus_window,
window))
{
meta_topic (META_DEBUG_FOCUS,
"new window is not an ancestor to transient; not taking focus.");
*takes_focus = FALSE;
*places_on_top = FALSE;
}
switch (window->type)
{
case META_WINDOW_UTILITY: