Skip to content

Commit

Permalink
canvas-item: use gtk_render_icon_surface for the DnD surface
Browse files Browse the repository at this point in the history
So to get HiDpi support.

origin commit:
https://gitlab.gnome.org/GNOME/nautilus/commit/31059f33
  • Loading branch information
cosimoc authored and lukefromdc committed Apr 5, 2018
1 parent 35eb416 commit a864855
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libcaja-private/caja-icon-canvas-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit a864855

Please sign in to comment.