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
This commit is contained in:
Robert Mader 2020-08-10 15:58:02 +02:00
parent 1dc6a15eac
commit 20982bf2c8
2 changed files with 39 additions and 0 deletions

View File

@ -53,6 +53,7 @@ static gboolean is_debugging = FALSE;
static gboolean replace_current = FALSE; static gboolean replace_current = FALSE;
static int no_prefix = 0; static int no_prefix = 0;
static gboolean is_wayland_compositor = FALSE; static gboolean is_wayland_compositor = FALSE;
static int debug_paint_flags = 0;
#ifdef WITH_VERBOSE_MODE #ifdef WITH_VERBOSE_MODE
static FILE* logfile = NULL; 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); 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;
}

View File

@ -116,6 +116,17 @@ typedef enum
META_DEBUG_INPUT = 1 << 23 META_DEBUG_INPUT = 1 << 23
} MetaDebugTopic; } 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 META_EXPORT
void meta_topic_real (MetaDebugTopic topic, void meta_topic_real (MetaDebugTopic topic,
const char *format, const char *format,
@ -205,4 +216,13 @@ void meta_remove_clutter_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags, ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_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 */ #endif /* META_UTIL_H */