gdk: Mark window surfaces as dirty before reading from them

We do not know what happened to this surface outside of GDK.
Especially for foreign windows, they will have been modified
by external applications.

So be on the safe side and tell Cairo to clear all its caches.

https://bugzilla.gnome.org/show_bug.cgi?id=754952
This commit is contained in:
Benjamin Otte 2015-09-18 02:04:10 +02:00
parent 3ac8a120fe
commit 15d043c5d2

View File

@ -93,6 +93,14 @@ gdk_pixbuf_get_from_window (GdkWindow *src,
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
surface = _gdk_window_ref_cairo_surface (src);
/* We do not know what happened to this surface outside of GDK.
* Especially for foreign windows, they will have been modified
* by external applications.
* So be on the safe side and:
*/
cairo_surface_mark_dirty (surface);
dest = gdk_pixbuf_get_from_surface (surface,
src_x, src_y,
width, height);