summaryrefslogtreecommitdiff
path: root/gdk/x11
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-01-08 13:44:36 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-01-08 13:44:36 -0500
commit4d60b5b10c472fb3b37465cede661288708e16e6 (patch)
treee4c19b887527b6994ca4bfb5a81bbdad0f3fe244 /gdk/x11
parent3f56c530b3b5c77f2b9194c479afd1cdd25e9a42 (diff)
downloadgtk+-4d60b5b10c472fb3b37465cede661288708e16e6.tar.gz
x11: Fix damage tracking hack
We are setting mime data with a destroy notify on the cairo surface to get notified when cairo registers damage for the surface (in that case, it clears the mime data, calling the destroy notify). Unfortunately, the destroy notify is also called when we remove the mime data ourselves, which was not intentional. Use a flag in the window impl struct to ignore the callback when we are clearing the hook.
Diffstat (limited to 'gdk/x11')
-rw-r--r--gdk/x11/gdkwindow-x11.c30
-rw-r--r--gdk/x11/gdkwindow-x11.h1
2 files changed, 20 insertions, 11 deletions
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 9f189ad626..6106b28d18 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -250,8 +250,10 @@ static void
on_surface_changed (void *data)
{
GdkWindow *window = data;
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
- window_pre_damage (window);
+ if (impl->tracking_damage)
+ window_pre_damage (window);
}
/* We want to know when cairo drawing causes damage to the window,
@@ -269,12 +271,15 @@ hook_surface_changed (GdkWindow *window)
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (impl->cairo_surface)
- cairo_surface_set_mime_data (impl->cairo_surface,
- "x-gdk/change-notify",
- (unsigned char *)"X",
- 1,
- on_surface_changed,
- window);
+ {
+ cairo_surface_set_mime_data (impl->cairo_surface,
+ "x-gdk/change-notify",
+ (unsigned char *)"X",
+ 1,
+ on_surface_changed,
+ window);
+ impl->tracking_damage = 1;
+ }
}
static void
@@ -283,10 +288,13 @@ unhook_surface_changed (GdkWindow *window)
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (impl->cairo_surface)
- cairo_surface_set_mime_data (impl->cairo_surface,
- "x-gdk/change-notify",
- NULL, 0,
- NULL, NULL);
+ {
+ impl->tracking_damage = 0;
+ cairo_surface_set_mime_data (impl->cairo_surface,
+ "x-gdk/change-notify",
+ NULL, 0,
+ NULL, NULL);
+ }
}
static void
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 2bc2417d8b..ed0cbb6cf3 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -73,6 +73,7 @@ struct _GdkWindowImplX11
guint override_redirect : 1;
guint frame_clock_connected : 1;
guint frame_sync_enabled : 1;
+ guint tracking_damage: 1;
gint window_scale;