window: Add is_focusable class method

Implement is_focusable for both x11 and wayland and just use this check
so that we can abstract things more and be less dependent on window backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
This commit is contained in:
Marco Trevisan (Treviño)
2018-11-13 08:56:53 +01:00
committed by Marco Trevisan
parent fdd531f307
commit 43633d6b2f
5 changed files with 30 additions and 8 deletions

View File

@@ -2223,7 +2223,7 @@ window_state_on_map (MetaWindow *window,
/* don't initially focus windows that are intended to not accept
* focus
*/
if (!(window->input || window->take_focus))
if (!meta_window_is_focusable (window))
{
*takes_focus = FALSE;
return;
@@ -8529,6 +8529,15 @@ meta_window_shortcuts_inhibited (MetaWindow *window,
return META_WINDOW_GET_CLASS (window)->shortcuts_inhibited (window, source);
}
gboolean
meta_window_is_focusable (MetaWindow *window)
{
if (window->unmanaging)
return FALSE;
return META_WINDOW_GET_CLASS (window)->is_focusable (window);
}
gboolean
meta_window_is_stackable (MetaWindow *window)
{