mirror of
https://github.com/brl/mutter.git
synced 2025-08-02 22:54:44 +00:00
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:

committed by
Marco Trevisan

parent
fdd531f307
commit
43633d6b2f
@@ -1224,10 +1224,7 @@ get_default_focus_window (MetaStack *stack,
|
||||
if (window->unmaps_pending > 0)
|
||||
continue;
|
||||
|
||||
if (window->unmanaging)
|
||||
continue;
|
||||
|
||||
if (!(window->input || window->take_focus))
|
||||
if (!meta_window_is_focusable (window))
|
||||
continue;
|
||||
|
||||
if (!meta_window_should_be_showing (window))
|
||||
|
@@ -570,6 +570,7 @@ struct _MetaWindowClass
|
||||
ClutterInputDevice *source);
|
||||
gboolean (*shortcuts_inhibited) (MetaWindow *window,
|
||||
ClutterInputDevice *source);
|
||||
gboolean (*is_focusable) (MetaWindow *window);
|
||||
gboolean (*is_stackable) (MetaWindow *window);
|
||||
gboolean (*are_updates_frozen) (MetaWindow *window);
|
||||
};
|
||||
@@ -664,6 +665,8 @@ void meta_window_update_unfocused_button_grabs (MetaWindow *window);
|
||||
void meta_window_set_focused_internal (MetaWindow *window,
|
||||
gboolean focused);
|
||||
|
||||
gboolean meta_window_is_focusable (MetaWindow *window);
|
||||
|
||||
void meta_window_current_workspace_changed (MetaWindow *window);
|
||||
|
||||
void meta_window_show_menu (MetaWindow *window,
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user