[metacity/wip/muktupavels/issue-31: 1/2] window: add meta_window_is_focusable




commit abcbdcce1e67a7c652a21c7578aba69e1bda08c4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Oct 3 19:52:39 2022 +0300

    window: add meta_window_is_focusable
    
    Based on mutter commits:
    https://gitlab.gnome.org/GNOME/mutter/-/commit/43633d6b2f6f602ba87956d5c20ee336b8b56236
    https://gitlab.gnome.org/GNOME/mutter/-/commit/58d2a674c466b607e18e6c8e129a6cf1646fde7f

 src/core/stack.c          |  2 +-
 src/core/window-private.h |  2 ++
 src/core/window.c         | 10 ++++++++--
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/core/stack.c b/src/core/stack.c
index e16014d1..bc0fa9d3 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1243,7 +1243,7 @@ get_default_focus_window (MetaStack     *stack,
       if (window->unmanaging)
         continue;
 
-      if (!(window->input || window->take_focus))
+      if (!meta_window_is_focusable (window))
         continue;
 
       if (!meta_window_should_be_showing_on_workspace (window, workspace))
diff --git a/src/core/window-private.h b/src/core/window-private.h
index ff1a606c..61cef633 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -593,6 +593,8 @@ gboolean meta_window_client_message    (MetaWindow *window,
 void     meta_window_set_focused_internal (MetaWindow *window,
                                            gboolean    focused);
 
+gboolean meta_window_is_focusable (MetaWindow *self);
+
 void     meta_window_set_current_workspace_hint (MetaWindow *window);
 
 unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
diff --git a/src/core/window.c b/src/core/window.c
index 194f42b7..07886fb5 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2044,7 +2044,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;
@@ -4418,7 +4418,7 @@ meta_window_focus (MetaWindow  *window,
    */
   if (window->frame &&
       (window->shaded ||
-       !(window->input || window->take_focus)))
+       !meta_window_is_focusable (window)))
     {
       if (window->frame)
         {
@@ -5903,6 +5903,12 @@ meta_window_set_focused_internal (MetaWindow *window,
     }
 }
 
+gboolean
+meta_window_is_focusable (MetaWindow *self)
+{
+  return self->input || self->take_focus;
+}
+
 static gboolean
 process_property_notify (MetaWindow     *window,
                          XPropertyEvent *event)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]