Commit d9b02ea4 authored by Matthias Clasen's avatar Matthias Clasen

gdk: Make debug-updates a per-display setting

Add private API to set this per-display, and make the existing
gdk_window_set_debug_update function set a global default.
parent 5c5c8bdd
......@@ -14,7 +14,9 @@ gdk__private__ (void)
gdk_window_freeze_toplevel_updates,
gdk_window_thaw_toplevel_updates,
gdk_display_get_rendering_mode,
gdk_display_set_rendering_mode
gdk_display_set_rendering_mode,
gdk_display_get_debug_updates,
gdk_display_set_debug_updates
};
return &table;
......
......@@ -27,6 +27,10 @@ GdkRenderingMode gdk_display_get_rendering_mode (GdkDisplay *display);
void gdk_display_set_rendering_mode (GdkDisplay *display,
GdkRenderingMode mode);
gboolean gdk_display_get_debug_updates (GdkDisplay *display);
void gdk_display_set_debug_updates (GdkDisplay *display,
gboolean debug_updates);
typedef struct {
/* add all private functions here, initialize them in gdk-private.c */
gboolean (* gdk_device_grab_info) (GdkDisplay *display,
......@@ -48,6 +52,10 @@ typedef struct {
GdkRenderingMode (* gdk_display_get_rendering_mode) (GdkDisplay *display);
void (* gdk_display_set_rendering_mode) (GdkDisplay *display,
GdkRenderingMode mode);
gboolean (* gdk_display_get_debug_updates) (GdkDisplay *display);
void (* gdk_display_set_debug_updates) (GdkDisplay *display,
gboolean debug_updates);
} GdkPrivateVTable;
GDK_AVAILABLE_IN_ALL
......
......@@ -2302,3 +2302,20 @@ gdk_display_set_rendering_mode (GdkDisplay *display,
{
display->rendering_mode = mode;
}
void
gdk_display_set_debug_updates (GdkDisplay *display,
gboolean debug_updates)
{
display->debug_updates = debug_updates;
display->debug_updates_set = TRUE;
}
gboolean
gdk_display_get_debug_updates (GdkDisplay *display)
{
if (display->debug_updates_set)
return display->debug_updates;
else
return _gdk_debug_updates;
}
......@@ -121,6 +121,9 @@ struct _GdkDisplay
guint has_gl_extension_texture_non_power_of_two : 1;
guint has_gl_extension_texture_rectangle : 1;
guint debug_updates : 1;
guint debug_updates_set : 1;
GdkRenderingMode rendering_mode;
};
......
......@@ -108,6 +108,7 @@ extern GdkWindow *_gdk_parent_root;
extern guint _gdk_debug_flags;
extern guint _gdk_gl_flags;
extern GdkRenderingMode _gdk_rendering_mode;
extern gboolean _gdk_debug_updates;
#ifdef G_ENABLE_DEBUG
......
......@@ -3338,7 +3338,7 @@ gdk_cairo_create (GdkWindow *window)
/* Code for dirty-region queueing
*/
static GSList *update_windows = NULL;
static gboolean debug_updates = FALSE;
gboolean _gdk_debug_updates = FALSE;
static inline gboolean
gdk_window_is_ancestor (GdkWindow *window,
......@@ -3613,7 +3613,9 @@ gdk_window_process_updates_internal (GdkWindow *window)
{
GdkWindowImplClass *impl_class;
GdkWindow *toplevel;
GdkDisplay *display;
display = gdk_window_get_display (window);
toplevel = gdk_window_get_toplevel (window);
if (toplevel->geometry_dirty)
{
......@@ -3653,7 +3655,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
/* Clip to part visible in impl window */
cairo_region_intersect (expose_region, window->clip_region);
if (debug_updates)
if (gdk_display_get_debug_updates (display))
{
cairo_region_t *swap_region = cairo_region_copy (expose_region);
cairo_region_subtract (swap_region, window->active_update_area);
......@@ -4067,6 +4069,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow *window,
{
cairo_region_t *visible_region;
cairo_rectangle_int_t r;
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (window));
......@@ -4086,7 +4089,8 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow *window,
invalidate_impl_subwindows (window, region, child_func, user_data, 0, 0);
if (debug_updates)
display = gdk_window_get_display (window);
if (gdk_display_get_debug_updates (display))
draw_ugly_color (window, visible_region, 0);
while (window != NULL &&
......@@ -4458,7 +4462,7 @@ gdk_window_thaw_toplevel_updates (GdkWindow *window)
void
gdk_window_set_debug_updates (gboolean setting)
{
debug_updates = setting;
_gdk_debug_updates = setting;
}
/**
......
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