[gtk+/gestures: 196/202] entry: Check first whether the sequence is handled, fetch later the event



commit f54277204fff17e586ab9a0ae4489632a5f0b0b7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 21 14:51:46 2014 +0200

    entry: Check first whether the sequence is handled, fetch later the event
    
    And always unset/hide the selection popover if unhandled, that means the
    sequence went grabbed/claimed somewhere else and cancelled here.

 gtk/gtkentry.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0d5f6d8..1a35d38 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4706,6 +4706,13 @@ gtk_entry_drag_gesture_end (GtkGestureDrag *gesture,
   if (priv->magnifier_popover)
     gtk_widget_hide (priv->magnifier_popover);
 
+  /* Check whether the drag was cancelled rather than finished */
+  if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
+    {
+      gtk_entry_selection_bubble_popup_unset (entry);
+      return;
+    }
+
   event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
   source = gdk_event_get_source_device (event);
   is_touchscreen = (test_touchscreen ||
@@ -4717,10 +4724,6 @@ gtk_entry_drag_gesture_end (GtkGestureDrag *gesture,
   else if (is_touchscreen)
     gtk_entry_selection_bubble_popup_set (entry);
 
-  /* Check whether the drag was cancelled rather than finished */
-  if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
-    return;
-
   if (in_drag)
     {
       gint tmp_pos = gtk_entry_find_position (entry, priv->drag_start_x);


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