[mutter] stack: Move HAS_TRANSIENT_TYPE macro to window-private



commit 599d8e328727598c7003c7ba5479e9273a9e09c3
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Nov 26 23:06:09 2019 +0100

    stack: Move HAS_TRANSIENT_TYPE macro to window-private
    
    We'll soon need it elsewhere, so move it to a shared location.
    While at it, convert it to a function.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/949

 src/core/stack.c          | 17 +++++------------
 src/core/window-private.h |  2 ++
 src/core/window.c         | 10 ++++++++++
 3 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/core/stack.c b/src/core/stack.c
index d7a0c9c67..7a9669020 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -40,15 +40,8 @@
 #include "meta/workspace.h"
 #include "x11/meta-x11-display-private.h"
 
-#define WINDOW_HAS_TRANSIENT_TYPE(w)                    \
-          (w->type == META_WINDOW_DIALOG ||             \
-          w->type == META_WINDOW_MODAL_DIALOG ||       \
-           w->type == META_WINDOW_TOOLBAR ||            \
-           w->type == META_WINDOW_MENU ||               \
-           w->type == META_WINDOW_UTILITY)
-
-#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w)                     \
-  (WINDOW_HAS_TRANSIENT_TYPE (w) && w->transient_for == NULL)
+#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w)        \
+  (meta_window_has_transient_type (w) && w->transient_for == NULL)
 
 static void meta_window_set_stack_position_no_sync (MetaWindow *window,
                                                     int         position);
@@ -552,7 +545,7 @@ compute_layer (MetaWindow *window)
    * fullscreen.
    */
   if (window->layer != META_LAYER_DESKTOP &&
-      WINDOW_HAS_TRANSIENT_TYPE(window) &&
+      meta_window_has_transient_type (window) &&
       window->transient_for == NULL)
     {
       /* We only do the group thing if the dialog is NOT transient for
@@ -754,7 +747,7 @@ create_constraints (Constraint **constraints,
               /* better way I think, so transient-for-group are constrained
                * only above non-transient-type windows in their group
                */
-              if (!WINDOW_HAS_TRANSIENT_TYPE (group_window))
+              if (!meta_window_has_transient_type (group_window))
 #endif
                 {
                   meta_topic (META_DEBUG_STACK, "Constraining %s above %s as it's transient for its group\n",
@@ -861,7 +854,7 @@ ensure_above (MetaWindow *above,
 {
   gboolean is_transient;
 
-  is_transient = WINDOW_HAS_TRANSIENT_TYPE (above) ||
+  is_transient = meta_window_has_transient_type (above) ||
                  above->transient_for == below;
   if (is_transient && above->layer < below->layer)
     {
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 90392051b..8b853b3cb 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -780,6 +780,8 @@ void meta_window_set_gtk_dbus_properties  (MetaWindow *window,
                                            const char *application_object_path,
                                            const char *window_object_path);
 
+gboolean meta_window_has_transient_type   (MetaWindow *window);
+
 void meta_window_set_transient_for        (MetaWindow *window,
                                            MetaWindow *parent);
 
diff --git a/src/core/window.c b/src/core/window.c
index 7eb2fc444..75f62fb24 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -7977,6 +7977,16 @@ check_transient_for_loop (MetaWindow *window,
   return FALSE;
 }
 
+gboolean
+meta_window_has_transient_type (MetaWindow *window)
+{
+  return (window->type == META_WINDOW_DIALOG ||
+          window->type == META_WINDOW_MODAL_DIALOG ||
+          window->type == META_WINDOW_TOOLBAR ||
+          window->type == META_WINDOW_MENU ||
+          window->type == META_WINDOW_UTILITY);
+}
+
 void
 meta_window_set_transient_for (MetaWindow *window,
                                MetaWindow *parent)


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