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.
This commit is contained in:
Carlos Garnacho 2020-11-05 21:05:18 +01:00
parent fa5fa3a881
commit 5e907ebd58

View File

@ -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;