[gtk/dnd-gestures-2: 34/69] Move the rest of the drag-source api over



commit 9b52c919fc3782d8e8f1f228ea76d04cd0d5243c
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 1 13:22:29 2020 -0500

    Move the rest of the drag-source api over
    
    Just reshuffling some source.

 gtk/gtkdnd.c              | 35 -----------------------------------
 gtk/gtkdnd.h              |  9 ---------
 gtk/gtkdragsource.c       | 32 ++++++++++++++++++++++++++++++++
 gtk/gtkdragsource.h       |  7 +++++++
 gtk/gtkgesturelongpress.c |  2 +-
 5 files changed, 40 insertions(+), 45 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index bd6067df9e..20bcb774e1 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -631,38 +631,3 @@ gtk_drag_dest_drop (GtkWidget *widget,
 
   return (site->flags & GTK_DEST_DEFAULT_DROP) ? TRUE : retval;
 }
-
-/***************
- * Source side *
- ***************/
-
-/**
- * gtk_drag_check_threshold: (method)
- * @widget: a #GtkWidget
- * @start_x: X coordinate of start of drag
- * @start_y: Y coordinate of start of drag
- * @current_x: current X coordinate
- * @current_y: current Y coordinate
- * 
- * Checks to see if a mouse drag starting at (@start_x, @start_y) and ending
- * at (@current_x, @current_y) has passed the GTK+ drag threshold, and thus
- * should trigger the beginning of a drag-and-drop operation.
- *
- * Returns: %TRUE if the drag threshold has been passed.
- */
-gboolean
-gtk_drag_check_threshold (GtkWidget *widget,
-                          gint       start_x,
-                          gint       start_y,
-                          gint       current_x,
-                          gint       current_y)
-{
-  gint drag_threshold;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-
-  drag_threshold = gtk_settings_get_dnd_drag_threshold (gtk_widget_get_settings (widget));
-
-  return (ABS (current_x - start_x) > drag_threshold ||
-          ABS (current_y - start_y) > drag_threshold);
-}
diff --git a/gtk/gtkdnd.h b/gtk/gtkdnd.h
index e55a587ac4..c8b0c8c44a 100644
--- a/gtk/gtkdnd.h
+++ b/gtk/gtkdnd.h
@@ -49,15 +49,6 @@ void gtk_drag_highlight   (GtkWidget  *widget);
 GDK_AVAILABLE_IN_ALL
 void gtk_drag_unhighlight (GtkWidget  *widget);
 
-/* Source side */
-
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_drag_check_threshold (GtkWidget *widget,
-                                  gint       start_x,
-                                  gint       start_y,
-                                  gint       current_x,
-                                  gint       current_y);
-
 
 G_END_DECLS
 
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c
index b0300df724..1f4930b3a9 100644
--- a/gtk/gtkdragsource.c
+++ b/gtk/gtkdragsource.c
@@ -39,6 +39,7 @@
 #include "gtkdragiconprivate.h"
 #include "gtkprivate.h"
 #include "gtkmarshalers.h"
+#include "gtksettingsprivate.h"
 
 /**
  * SECTION:gtkdragsource
@@ -781,3 +782,34 @@ gtk_drag_source_drag_cancel (GtkDragSource *source)
       gdk_drag_drop_done (source->drag, success);
     }
 }
+
+/**
+ * gtk_drag_check_threshold: (method)
+ * @widget: a #GtkWidget
+ * @start_x: X coordinate of start of drag
+ * @start_y: Y coordinate of start of drag
+ * @current_x: current X coordinate
+ * @current_y: current Y coordinate
+ * 
+ * Checks to see if a mouse drag starting at (@start_x, @start_y) and ending
+ * at (@current_x, @current_y) has passed the GTK drag threshold, and thus
+ * should trigger the beginning of a drag-and-drop operation.
+ *
+ * Returns: %TRUE if the drag threshold has been passed.
+ */
+gboolean
+gtk_drag_check_threshold (GtkWidget *widget,
+                          int        start_x,
+                          int        start_y,
+                          int        current_x,
+                          int        current_y)
+{
+  gint drag_threshold;
+
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+  drag_threshold = gtk_settings_get_dnd_drag_threshold (gtk_widget_get_settings (widget));
+
+  return (ABS (current_x - start_x) > drag_threshold ||
+          ABS (current_y - start_y) > drag_threshold);
+}
diff --git a/gtk/gtkdragsource.h b/gtk/gtkdragsource.h
index 729a6e258d..8a7a8d0ec5 100644
--- a/gtk/gtkdragsource.h
+++ b/gtk/gtkdragsource.h
@@ -98,6 +98,13 @@ void               gtk_drag_source_attach      (GtkDragSource     *source,
 GDK_AVAILABLE_IN_ALL
 void               gtk_drag_source_detach      (GtkDragSource     *source);
 
+GDK_AVAILABLE_IN_ALL
+gboolean           gtk_drag_check_threshold    (GtkWidget         *widget,
+                                                int                start_x,
+                                                int                start_y,
+                                                int                current_x,
+                                                int                current_y);
+
 
 G_END_DECLS
 
diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c
index fc28c32f57..9639ea151c 100644
--- a/gtk/gtkgesturelongpress.c
+++ b/gtk/gtkgesturelongpress.c
@@ -37,7 +37,7 @@
 #include "gtkgesturelongpressprivate.h"
 #include "gtkgestureprivate.h"
 #include "gtkmarshalers.h"
-#include "gtkdnd.h"
+#include "gtkdragsource.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"


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