windowhandle: Apply surface transform before passing coords to GDK
authorTimm Bäder <mail@baedert.org>
Sun, 17 May 2020 13:28:16 +0000 (15:28 +0200)
committerTimm Bäder <mail@baedert.org>
Sun, 17 May 2020 13:30:50 +0000 (15:30 +0200)
Otherwise coordinates are incorrect and the window can jump around after
starting a drag.

gtk/gtkwindowhandle.c

index 3e411465b5d6319e75621e83f5468fed9cadde11..6ee052e9a4a47b3dbd8a7958b7df27f6f53e2275 100644 (file)
@@ -442,7 +442,8 @@ drag_gesture_update_cb (GtkGestureDrag  *gesture,
     {
       GdkEventSequence *sequence;
       double start_x, start_y;
-      gint window_x, window_y;
+      int native_x, native_y;
+      int window_x, window_y;
       GtkNative *native;
       GdkSurface *surface;
 
@@ -480,6 +481,10 @@ drag_gesture_update_cb (GtkGestureDrag  *gesture,
                                         start_x, start_y,
                                         &window_x, &window_y);
 
+      gtk_native_get_surface_transform (native, &native_x, &native_y);
+      window_x += native_x;
+      window_y += native_y;
+
       surface = gtk_native_get_surface (native);
       gdk_surface_begin_move_drag (surface,
                                    gtk_gesture_get_device (GTK_GESTURE (gesture)),