Commit 02742d53 authored by Matthias Clasen's avatar Matthias Clasen

Make debug flags per-display

Tihs lets us toggle debug flags in the inspector without affecting
the inspector itself.
parent f82e4ff3
......@@ -694,6 +694,7 @@ static void
default_display_notify_cb (GdkDisplayManager *dm)
{
_gtk_accessibility_init ();
gtk_set_debug_flags (debug_flags);
}
static void
......@@ -796,6 +797,24 @@ post_parse_hook (GOptionContext *context,
return TRUE;
}
guint
gtk_get_display_debug_flags (GdkDisplay *display)
{
if (display)
return GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (display), "gtk-debug-flags"));
else
return debug_flags;
}
void
gtk_set_display_debug_flags (GdkDisplay *display,
guint flags)
{
if (display)
g_object_set_data (G_OBJECT (display), "gtk-debug-flags", GUINT_TO_POINTER (flags));
else
debug_flags = flags;
}
/**
* gtk_get_debug_flags:
......@@ -810,7 +829,7 @@ post_parse_hook (GOptionContext *context,
guint
gtk_get_debug_flags (void)
{
return debug_flags;
return gtk_get_display_debug_flags (gdk_display_get_default ());
}
/**
......@@ -821,7 +840,7 @@ gtk_get_debug_flags (void)
void
gtk_set_debug_flags (guint flags)
{
debug_flags = flags;
gtk_set_display_debug_flags (gdk_display_get_default (), flags);
}
gboolean
......@@ -832,7 +851,7 @@ gtk_simulate_touchscreen (void)
if (test_touchscreen == 0)
test_touchscreen = g_getenv ("GTK_TEST_TOUCHSCREEN") != NULL ? 1 : -1;
return test_touchscreen > 0 || (debug_flags & GTK_DEBUG_TOUCHSCREEN) != 0;
return test_touchscreen > 0 || (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0;
}
/**
......@@ -1027,7 +1046,7 @@ gtk_init_check (int *argc,
ret = GDK_PRIVATE_CALL (gdk_display_open_default) () != NULL;
if (debug_flags & GTK_DEBUG_INTERACTIVE)
if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
gtk_window_set_interactive_debugging (TRUE);
return ret;
......
......@@ -97,6 +97,18 @@ void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
gboolean gtk_simulate_touchscreen (void);
guint gtk_get_display_debug_flags (GdkDisplay *display);
#ifdef G_ENABLE_DEBUG
#define GTK_DISPLAY_DEBUG_CHECK(display,type) G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type)
#else
#define GTK_DISPLAY_DEBUG_CHECK(display,type) 0
#endif /* G_ENABLE_DEBUG */
G_END_DECLS
#endif /* __GTK_PRIVATE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment