summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <[email protected]>2013-08-05 16:48:16 +0200
committerraveit65 <[email protected]>2018-04-05 09:06:49 +0200
commit52d44dec116c87c7784337d698cf776db45fa392 (patch)
tree7a8f507d9d43954162f594b2f4c999d3eac76dbf
parentefb0d54b3bf73655f1e30c5e182c9239cb4fc61a (diff)
downloadcaja-52d44dec116c87c7784337d698cf776db45fa392.tar.bz2
caja-52d44dec116c87c7784337d698cf776db45fa392.tar.xz
canvas-item: use gtk_render_icon_surface for the DnD surface
So to get HiDpi support. origin commit: https://gitlab.gnome.org/GNOME/nautilus/commit/31059f33
-rw-r--r--libcaja-private/caja-icon-canvas-item.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 397420e9..88908196 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -515,6 +515,7 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
gboolean is_rtl;
cairo_t *cr;
GtkStyleContext *context;
+ cairo_surface_t *drag_surface;
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), NULL);
@@ -540,14 +541,18 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
width = EEL_CANVAS_ITEM (item)->x2 - EEL_CANVAS_ITEM (item)->x1;
height = EEL_CANVAS_ITEM (item)->y2 - EEL_CANVAS_ITEM (item)->y1;
- surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
+ surface = gdk_window_create_similar_surface (gtk_widget_get_window (GTK_WIDGET (canvas)),
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
cr = cairo_create (surface);
- gtk_render_icon (context, cr, item->details->pixbuf,
- item_offset_x, item_offset_y);
+ drag_surface = gdk_cairo_surface_create_from_pixbuf (item->details->pixbuf,
+ gtk_widget_get_scale_factor (GTK_WIDGET (canvas)),
+ gtk_widget_get_window (GTK_WIDGET (canvas)));
+ gtk_render_icon_surface (context, cr, drag_surface,
+ item_offset_x, item_offset_y);
+ cairo_surface_destroy (drag_surface);
icon_rect.x0 = item_offset_x;