mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Introduce new debug macros
Introduce GDK_DISPLAY_DEBUG() and GDK_DEBUG() and the helper function gdk_debug_message(). This is meant to clean up the mess of our current debug statements which wildly mix g_message, g_print and g_printerr.
This commit is contained in:
parent
6c95547c3f
commit
10255eee72
@ -34,6 +34,7 @@
|
|||||||
#include "gdkglcontextprivate.h"
|
#include "gdkglcontextprivate.h"
|
||||||
#include "gdkintl.h"
|
#include "gdkintl.h"
|
||||||
#include "gdk-private.h"
|
#include "gdk-private.h"
|
||||||
|
#include <glib/gprintf.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "gdktypes.h"
|
#include "gdktypes.h"
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -58,6 +59,8 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
|||||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||||
GdkDebugFlags flags);
|
GdkDebugFlags flags);
|
||||||
|
|
||||||
|
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
|
||||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||||
@ -66,14 +69,20 @@ void gdk_display_set_debug_flags (GdkDisplay *display,
|
|||||||
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
|
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
|
||||||
{ action; }; } G_STMT_END
|
{ action; }; } G_STMT_END
|
||||||
|
|
||||||
|
#define GDK_DISPLAY_DEBUG(display,type,...) \
|
||||||
|
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
|
||||||
|
gdk_debug_message (__VA_ARGS__); \
|
||||||
|
|
||||||
#else /* !G_ENABLE_DEBUG */
|
#else /* !G_ENABLE_DEBUG */
|
||||||
|
|
||||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||||
#define GDK_DISPLAY_NOTE(display,type,action)
|
#define GDK_DISPLAY_NOTE(display,type,action)
|
||||||
|
#define GDK_DISPLAY_DEBUG(display,type,...)
|
||||||
|
|
||||||
#endif /* G_ENABLE_DEBUG */
|
#endif /* G_ENABLE_DEBUG */
|
||||||
|
|
||||||
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
||||||
#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action)
|
#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action)
|
||||||
|
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user