[gtk: 1/2] gdk/x11: Honor hotspot during drag cancel animation



commit 7a46378e7147e2f80add314256c64a268bd50137
Author: Robert Mader <robert mader posteo de>
Date:   Mon Dec 9 01:45:27 2019 +0100

    gdk/x11: Honor hotspot during drag cancel animation
    
    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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 3bfb04121c..724099dab0 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -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;


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