gdk/x11: Honor hotspot during drag cancel animation
authorRobert Mader <robert.mader@posteo.de>
Mon, 9 Dec 2019 00:45:27 +0000 (01:45 +0100)
committerRobert Mader <robert.mader@posteo.de>
Mon, 9 Dec 2019 00:45:30 +0000 (01:45 +0100)
Otherwise the icon "jumps" to the cursor position with its top left when
the animation starts.
This is especially visible if the dragged item is big, like when dragging
mails in Thunderbird.

gdk/x11/gdkdrag-x11.c

index 3bfb04121cdbb1592ffbf204ba0bad0a7f0a8cc8..724099dab0c4aaa64aaabbf2488b7306204e895f 100644 (file)
@@ -1842,8 +1842,10 @@ gdk_drag_anim_timeout (gpointer data)
 
   gdk_surface_show (drag->drag_surface);
   gdk_x11_surface_move (drag->drag_surface,
-                        drag->last_x + (drag->start_x - drag->last_x) * t,
-                        drag->last_y + (drag->start_y - drag->last_y) * t);
+                        (drag->last_x - drag->hot_x) +
+                        (drag->start_x - drag->last_x) * t,
+                        (drag->last_y - drag->hot_y) +
+                        (drag->start_y - drag->last_y) * t);
   gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
 
   return G_SOURCE_CONTINUE;