summaryrefslogtreecommitdiff
path: root/gdk/x11
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-01-08 11:30:44 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-01-08 11:33:24 -0500
commit709cc0860351a2f77fcdf76396aab61a1e2899a0 (patch)
tree7cc7a93cff45c634ad1b07942994e5b8a4de1956 /gdk/x11
parentea0084cd995283dee00a327c92d9896994e738e1 (diff)
downloadgtk+-709cc0860351a2f77fcdf76396aab61a1e2899a0.tar.gz
x11: Simplify drag cancel animation setup
Instead of creating an intermediate pixbuf, just render the window surface onto the new surface. Doing things this way lets us avoid the cairo_surface_mark_dirty() call in gdk_pixbuf_get_from_window(), which is not generally safe to call on 'random' surfaces - it asserts that the surface has no mime data attached, and the X11 backend uses mime data for damage tracking purposes...
Diffstat (limited to 'gdk/x11')
-rw-r--r--gdk/x11/gdkdnd-x11.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index dd0725262c..86ecb8208c 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -2557,25 +2557,31 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
{
GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
GdkDragAnim *anim;
- GdkPixbuf *pixbuf;
+ cairo_surface_t *win_surface;
cairo_surface_t *surface;
cairo_pattern_t *pattern;
+ cairo_t *cr;
if (success)
return;
- pixbuf = gdk_pixbuf_get_from_window (x11_context->drag_window,
- 0, 0,
- gdk_window_get_width (x11_context->drag_window),
- gdk_window_get_height (x11_context->drag_window));
- surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, x11_context->drag_window);
+ win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window);
+ surface = gdk_window_create_similar_surface (x11_context->drag_window,
+ cairo_surface_get_content (win_surface),
+ gdk_window_get_width (x11_context->drag_window),
+ gdk_window_get_height (x11_context->drag_window));
+ cr = cairo_create (surface);
+ cairo_set_source_surface (cr, win_surface, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+ cairo_surface_destroy (win_surface);
+
pattern = cairo_pattern_create_for_surface (surface);
gdk_window_set_background_pattern (x11_context->drag_window, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (surface);
- g_object_unref (pixbuf);
anim = g_slice_new0 (GdkDragAnim);
anim->context = g_object_ref (x11_context);