gtktext: Claim gesture more selectively
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 18 Nov 2022 12:57:02 +0000 (13:57 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 18 Nov 2022 17:36:32 +0000 (18:36 +0100)
commit3b940b12f64c78346cbea8a2fafde24690ecd9fe
treedd5884fd857df6002f10cc9ea645f50c0f669623
parent205783d9b04d684a388ac86fd07ad2c9d24c1400
gtktext: Claim gesture more selectively

Even though button 1 (or touch down) presses do most often have
an effect in one way or another (starting drag, moving focus,
starting selection, ...), there is one situation that they do
immediately nothing: When clicking on the entry does not move
the text caret around. Dragging might start a selection, but
the entry did not do anything just yet, and an immediate
button/touch release should remain at "did nothing".

And that is precisely the hint that the Wayland IM context's click
gesture takes, clicks that do not scroll nor move the caret around,
having the GtkText not claim the gesture in that situation makes
the IM gesture able to do its thing without in-fighting.

This is typically not a problem when the GtkText is embedded in
another GtkEditable implementation (e.g. GtkEntry), since the
IM gesture is inactive and capturing from the parent widget, so
gets a pass that it otherwise doesn't get when both gestures are
in the same widget. This makes it work regardless of GtkText not
being a child of a composite widget, like NautilusQueryEditor
and AdwRowEntry.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5351
(cherry-picked from commit 09b982f0264e42bda3e8471bb25abec5ee742ecc)
gtk/gtktext.c