Make debug flags per-display
Tihs lets us toggle debug flags in the inspector without affecting the inspector itself.
This commit is contained in:
@ -694,6 +694,7 @@ static void
|
|||||||
default_display_notify_cb (GdkDisplayManager *dm)
|
default_display_notify_cb (GdkDisplayManager *dm)
|
||||||
{
|
{
|
||||||
_gtk_accessibility_init ();
|
_gtk_accessibility_init ();
|
||||||
|
gtk_set_debug_flags (debug_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -796,6 +797,24 @@ post_parse_hook (GOptionContext *context,
|
|||||||
return TRUE;
|
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:
|
* gtk_get_debug_flags:
|
||||||
@ -810,7 +829,7 @@ post_parse_hook (GOptionContext *context,
|
|||||||
guint
|
guint
|
||||||
gtk_get_debug_flags (void)
|
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
|
void
|
||||||
gtk_set_debug_flags (guint flags)
|
gtk_set_debug_flags (guint flags)
|
||||||
{
|
{
|
||||||
debug_flags = flags;
|
gtk_set_display_debug_flags (gdk_display_get_default (), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -832,7 +851,7 @@ gtk_simulate_touchscreen (void)
|
|||||||
if (test_touchscreen == 0)
|
if (test_touchscreen == 0)
|
||||||
test_touchscreen = g_getenv ("GTK_TEST_TOUCHSCREEN") != NULL ? 1 : -1;
|
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;
|
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);
|
gtk_window_set_interactive_debugging (TRUE);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -97,6 +97,18 @@ void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
|
|||||||
|
|
||||||
gboolean gtk_simulate_touchscreen (void);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_PRIVATE_H__ */
|
#endif /* __GTK_PRIVATE_H__ */
|
||||||
|
|||||||
Reference in New Issue
Block a user