windowhandle: Use drag threshold instead of double click threshold
authorAlexander Mikhaylenko <alexm@gnome.org>
Fri, 25 Dec 2020 17:58:06 +0000 (22:58 +0500)
committerAlexander Mikhaylenko <alexm@gnome.org>
Fri, 29 Jan 2021 07:01:34 +0000 (12:01 +0500)
Now that we have gtk_drag_check_threshold_double(), be consistent with
other draggable widgets and make sure we don't take over a drag before a
child does.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3513

gtk/gtkwindowhandle.c

index f4f2fa6e4981036e2f007f19deac9eb8b8b90068..a4265df7c78b55209ba8bf665cf699127934606c 100644 (file)
@@ -24,6 +24,7 @@
 #include "gtkbinlayout.h"
 #include "gtkbox.h"
 #include "gtkbuildable.h"
+#include "gtkdragsourceprivate.h"
 #include "gtkgestureclick.h"
 #include "gtkgesturedrag.h"
 #include "gtkgestureprivate.h"
@@ -388,16 +389,7 @@ drag_gesture_update_cb (GtkGestureDrag  *gesture,
                         double           offset_y,
                         GtkWindowHandle *self)
 {
-  int double_click_distance;
-  GtkSettings *settings;
-
-  settings = gtk_widget_get_settings (GTK_WIDGET (self));
-  g_object_get (settings,
-                "gtk-double-click-distance", &double_click_distance,
-                NULL);
-
-  if (ABS (offset_x) > double_click_distance ||
-      ABS (offset_y) > double_click_distance)
+  if (gtk_drag_check_threshold_double (GTK_WIDGET (self), 0, 0, offset_x, offset_y))
     {
       double start_x, start_y;
       double native_x, native_y;