[gtk/debug-envvars-cleanup: 5/6] gtk: Introduce new debug macros
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/debug-envvars-cleanup: 5/6] gtk: Introduce new debug macros
- Date: Fri, 23 Sep 2022 14:33:33 +0000 (UTC)
commit 1fdfe5c7286746651d1ca38461939146d0e10431
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 23 10:10:51 2022 -0400
gtk: Introduce new debug macros
Introduce GTK_DISPLAY_DEBUG() and GTK_DEBUG(), which
mirror the new macros in gdk. They use the same helper
function gdk_debug_message().
gtk/gtkprivate.h | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 7869347cad..c78efc03c6 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -28,6 +28,7 @@
#include <glib-object.h>
#include <gdk/gdk.h>
#include <gdk/gdk-private.h>
+#include <gdk/gdkdebug.h>
#include "gtkcsstypesprivate.h"
#include "gtktexthandleprivate.h"
@@ -135,16 +136,33 @@ GBytes *get_emoji_data (void);
#ifdef G_ENABLE_DEBUG
-#define GTK_DISPLAY_DEBUG_CHECK(display,type) (gtk_get_any_display_debug_flag_set () && G_UNLIKELY
(gtk_get_display_debug_flags (display) & GTK_DEBUG_##type))
-#define GTK_DISPLAY_NOTE(display,type,action) \
- G_STMT_START { \
- if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \
+#define GTK_DISPLAY_DEBUG_CHECK(display,type) \
+ (gtk_get_any_display_debug_flag_set () && \
+ G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type))
+
+#define GTK_DISPLAY_NOTE(display,type,action) \
+ G_STMT_START { \
+ if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \
+ } G_STMT_END
+
+#define GTK_DEBUG(type,...) \
+ G_STMT_START { \
+ if (GTK_DEBUG_CHECK (type)) \
+ gdk_debug_message (__VA_ARGS__); \
+ } G_STMT_END
+
+#define GTK_DISPLAY_DEBUG(display,type,...) \
+ G_STMT_START { \
+ if (GTK_DISPLAY_DEBUG_CHECK (display,type)) \
+ gdk_debug_message (__VA_ARGS__); \
} G_STMT_END
#else
#define GTK_DISPLAY_DEBUG_CHECK(display,type) 0
#define GTK_DISPLAY_NOTE(display,type,action)
+#define GTK_DISPLAY_DEBUG(display,type,...)
+#define GTK_DEBUG(type,...)
#endif /* G_ENABLE_DEBUG */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]