[nautilus] canvas-dnd: Properly calculate device offset for Dnd



commit ee3477068c6d6405826075630c7779e88b050868
Author: Robert Mader <robert mader posteo de>
Date:   Sun Sep 22 15:24:22 2019 +0200

    canvas-dnd: Properly calculate device offset for Dnd
    
    Otherwise the offset will be to small in scaled cases on X11
    and Wayland (and maybe on other plattforms, too).
    
    https://gitlab.gnome.org/GNOME/nautilus/merge_requests/486

 src/nautilus-canvas-dnd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-canvas-dnd.c b/src/nautilus-canvas-dnd.c
index ef83c443f..c5a51bca5 100644
--- a/src/nautilus-canvas-dnd.c
+++ b/src/nautilus-canvas-dnd.c
@@ -1292,6 +1292,7 @@ drag_begin_callback (GtkWidget      *widget,
     int x_offset, y_offset;
     int start_x, start_y;
     GList *dragged_files;
+    double sx, sy;
 
     container = NAUTILUS_CANVAS_CONTAINER (widget);
     window = NAUTILUS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (container)));
@@ -1312,7 +1313,10 @@ drag_begin_callback (GtkWidget      *widget,
     x_offset = start_x - winx;
     y_offset = start_y - winy;
 
-    cairo_surface_set_device_offset (surface, -x_offset, -y_offset);
+    cairo_surface_get_device_scale (surface, &sx, &sy);
+    cairo_surface_set_device_offset (surface,
+                                     -x_offset * sx,
+                                     -y_offset * sy);
     gtk_drag_set_icon_surface (context, surface);
     cairo_surface_destroy (surface);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]