[gtk/wip/carlosg/for-master: 4/6] gtk/textview: Clean up further if the drag gesture is taken over




commit 5e907ebd58b2c9928c92b03a6e4000d23d0774ae
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 5 21:05:18 2020 +0100

    gtk/textview: Clean up further if the drag gesture is taken over
    
    If the gesture becomes captured (e.g. from a parent scrolledwindow), we
    leave some things in the air. Clean these up properly. This is recurrent
    with touch scroll.

 gtk/gtktextview.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f94067eda1..bf3a2b30e3 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7344,11 +7344,6 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
   priv = text_view->priv;
   sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
 
-  if (!drag_gesture_get_text_surface_coords (gesture, text_view,
-                                             &start_x, &start_y, &x, &y))
-    return;
-
-
   clicked_in_selection =
     g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data) == NULL;
   g_object_set_qdata (G_OBJECT (gesture), quark_text_selection_data, NULL);
@@ -7363,6 +7358,10 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
   if (priv->magnifier_popover)
     gtk_widget_hide (priv->magnifier_popover);
 
+  if (!drag_gesture_get_text_surface_coords (gesture, text_view,
+                                             &start_x, &start_y, &x, &y))
+    return;
+
   /* Check whether the drag was cancelled rather than finished */
   if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
     return;


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