gtktext: Claim drag gesture after an actual selection change

This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
This commit is contained in:
Carlos Garnacho 2022-11-27 13:06:40 +01:00
parent e3b0d57ce7
commit 76d80f7544

View File

@ -3051,8 +3051,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
GdkDevice *source;
guint length;
int tmp_pos;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
int pos, bound;
length = gtk_entry_buffer_get_length (get_buffer (self));
@ -3070,7 +3069,6 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
{
int min, max;
int old_min, old_max;
int pos, bound;
min = gtk_text_move_backward_word (self, tmp_pos, TRUE);
max = gtk_text_move_forward_word (self, tmp_pos, TRUE);
@ -3101,11 +3099,17 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
if (priv->current_pos != max)
pos = min;
}
gtk_text_set_positions (self, pos, bound);
}
else
gtk_text_set_positions (self, tmp_pos, -1);
{
pos = tmp_pos;
bound = -1;
}
if (pos != priv->current_pos)
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gtk_text_set_positions (self, pos, bound);
/* Update touch handles' position */
if (gtk_simulate_touchscreen () ||