summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@posteo.de>2019-09-22 13:24:22 +0000
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2019-10-14 12:18:54 +0000
commit41dc3da4905fc80d4048f3d872cba07162134cc8 (patch)
treee180ff167ad6263ec2ba9a704d7e7716084d9626
parentf7d68d13e64bc7c6248893d90fa7e42daa2ddecc (diff)
downloadnautilus-41dc3da4905fc80d4048f3d872cba07162134cc8.tar.gz
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 (cherry picked from commit ee3477068c6d6405826075630c7779e88b050868)
-rw-r--r--src/nautilus-canvas-dnd.c6
1 files changed, 5 insertions, 1 deletions
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);