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



commit c9f54aef699978c638c07b0f597c95473a37bc5e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 21 14:57:07 2014 +0200

    textview: 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/gtktextview.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index fdeb932..d793952 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7046,6 +7046,13 @@ gtk_text_view_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_text_view_selection_bubble_popup_unset (text_view);
+      return;
+    }
+
   event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
   device = gdk_event_get_source_device (event);
   is_touchscreen = test_touchscreen ||
@@ -7057,10 +7064,6 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
   else if (is_touchscreen)
     gtk_text_view_selection_bubble_popup_set (text_view);
 
-  /* Check whether the drag was cancelled rather than finished */
-  if (!gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
-    return;
-
   if (clicked_in_selection &&
       !gtk_drag_check_threshold (GTK_WIDGET (text_view), start_x, start_y, x, y))
     {


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