[mutter] util: Add paint debug flags



commit 20982bf2c8c5fc6aea8a8b74f9e5df8bb9ebe712
Author: Robert Mader <robert mader posteo de>
Date:   Mon Aug 10 15:58:02 2020 +0200

    util: Add paint debug flags
    
    Analogous to `ClutterDrawDebugFlag` but intended for concepts that
    are not present in Clutter, such as Wayland/X11 opaque regions.
    Also add the first flag for the later.
    
    To set the flag, run:
    `Meta.add_debug_paint_flag(Meta.DebugPaintFlag.OPAQUE_REGION)`
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1372

 src/core/util.c | 19 +++++++++++++++++++
 src/meta/util.h | 20 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
---
diff --git a/src/core/util.c b/src/core/util.c
index 70728ebe37..f6327fca16 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -53,6 +53,7 @@ static gboolean is_debugging = FALSE;
 static gboolean replace_current = FALSE;
 static int no_prefix = 0;
 static gboolean is_wayland_compositor = FALSE;
+static int debug_paint_flags = 0;
 
 #ifdef WITH_VERBOSE_MODE
 static FILE* logfile = NULL;
@@ -753,3 +754,21 @@ meta_remove_clutter_debug_flags (ClutterDebugFlag     debug_flags,
 {
   clutter_remove_debug_flags (debug_flags, draw_flags, pick_flags);
 }
+
+void
+meta_add_debug_paint_flag (MetaDebugPaintFlag flag)
+{
+  debug_paint_flags |= flag;
+}
+
+void
+meta_remove_debug_paint_flag (MetaDebugPaintFlag flag)
+{
+  debug_paint_flags &= ~flag;
+}
+
+MetaDebugPaintFlag
+meta_get_debug_paint_flags (void)
+{
+  return debug_paint_flags;
+}
diff --git a/src/meta/util.h b/src/meta/util.h
index c413622db3..a5d7bb3a3a 100644
--- a/src/meta/util.h
+++ b/src/meta/util.h
@@ -116,6 +116,17 @@ typedef enum
   META_DEBUG_INPUT           = 1 << 23
 } MetaDebugTopic;
 
+/**
+ * MetaDebugPaintFlag:
+ * @META_DEBUG_PAINT_NONE: default
+ * @META_DEBUG_PAINT_OPAQUE_REGION: paint opaque regions
+ */
+typedef enum
+{
+  META_DEBUG_PAINT_NONE          = 0,
+  META_DEBUG_PAINT_OPAQUE_REGION = 1 << 0,
+} MetaDebugPaintFlag;
+
 META_EXPORT
 void meta_topic_real      (MetaDebugTopic topic,
                            const char    *format,
@@ -205,4 +216,13 @@ void meta_remove_clutter_debug_flags (ClutterDebugFlag     debug_flags,
                                       ClutterDrawDebugFlag draw_flags,
                                       ClutterPickDebugFlag pick_flags);
 
+META_EXPORT
+void meta_add_debug_paint_flag (MetaDebugPaintFlag flag);
+
+META_EXPORT
+void meta_remove_debug_paint_flag (MetaDebugPaintFlag flag);
+
+META_EXPORT
+MetaDebugPaintFlag meta_get_debug_paint_flags (void);
+
 #endif /* META_UTIL_H */


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