mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
Add and use GDK_CHECK_DEBUG macro
This is following what we've already done in GTK+. It avoids direct access to _gdk_debug_flags all over the place.
This commit is contained in:
parent
2ad19c70ce
commit
ee217dc823
@ -386,7 +386,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
{
|
||||
int iter;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
|
||||
@ -415,7 +415,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
|
||||
@ -441,7 +441,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
timings->frame_end_time = g_get_monotonic_time ();
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
@ -452,7 +452,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (timings && timings->complete)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
@ -113,12 +113,15 @@ extern gboolean _gdk_debug_updates;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GDK_NOTE(type,action) G_STMT_START { \
|
||||
if (_gdk_debug_flags & GDK_DEBUG_##type) \
|
||||
#define GDK_DEBUG_CHECK(type) G_UNLIKELY (_gdk_debug_flags & GDK_DEBUG_##type)
|
||||
|
||||
#define GDK_NOTE(type,action) G_STMT_START { \
|
||||
if (GDK_DEBUG_CHECK (type)) \
|
||||
{ action; }; } G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DEBUG_CHECK(type) 0
|
||||
#define GDK_NOTE(type,action)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
@ -345,7 +345,7 @@ gdk_x11_device_core_grab (GdkDevice *device,
|
||||
xconfine_to = GDK_WINDOW_XID (confine_to);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
|
||||
if (GDK_DEBUG_CHECK (NOGRABS))
|
||||
status = GrabSuccess;
|
||||
else
|
||||
#endif
|
||||
|
@ -447,7 +447,7 @@ gdk_x11_device_xi2_grab (GdkDevice *device,
|
||||
&mask.mask_len);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
|
||||
if (GDK_DEBUG_CHECK (NOGRABS))
|
||||
status = GrabSuccess;
|
||||
else
|
||||
#endif
|
||||
|
@ -179,7 +179,7 @@ translate_key_event (GdkDisplay *display,
|
||||
_gdk_x11_event_translate_keyboard_string (&event->key);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
|
||||
if (GDK_DEBUG_CHECK (EVENTS))
|
||||
{
|
||||
g_message ("%s:\t\twindow: %ld key: %12s %d",
|
||||
event->type == GDK_KEY_PRESS ? "key press " : "key release",
|
||||
|
@ -590,7 +590,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
case VisibilityNotify:
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
|
||||
if (GDK_DEBUG_CHECK (EVENTS))
|
||||
switch (xevent->xvisibility.state)
|
||||
{
|
||||
case VisibilityFullyObscured:
|
||||
@ -1236,7 +1236,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||
|
||||
timings->complete = TRUE;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
|
@ -1500,7 +1500,7 @@ xdnd_read_actions (GdkX11DragContext *context_x11)
|
||||
context_x11->xdnd_have_actions = TRUE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_DND)
|
||||
if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
GString *action_str = g_string_new (NULL);
|
||||
if (context->actions & GDK_ACTION_MOVE)
|
||||
@ -1763,7 +1763,7 @@ xdnd_enter_filter (GdkXEvent *xev,
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_DND)
|
||||
if (GDK_DEBUG_CHECK (DND))
|
||||
print_target_list (context->targets);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
|
@ -526,7 +526,7 @@ init_fake_xinerama (GdkScreen *screen)
|
||||
Window win;
|
||||
gint w, h;
|
||||
|
||||
if (!(_gdk_debug_flags & GDK_DEBUG_XINERAMA))
|
||||
if (!GDK_DEBUG_CHECK (XINERAMA))
|
||||
return FALSE;
|
||||
|
||||
/* Fake Xinerama mode by splitting the screen into 4 monitors.
|
||||
|
@ -248,7 +248,7 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_MISC)
|
||||
if (GDK_DEBUG_CHECK (MISC))
|
||||
{
|
||||
static const gchar *const visual_names[] =
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
|
||||
if (impl->toplevel->current_counter_value % 2 == 1)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
XImage *image = XGetImage (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window),
|
||||
|
Loading…
Reference in New Issue
Block a user