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 16:56:14 +0000 (17:56 +0100)
commitae54374a514aa33b34f95eee94b4a2848b8a16d9
tree41fac1ffe2e1068014c8ded9ba74c3810e4b3fce
parent64b8a8740f0ba27f14a390a720eb035aa9fa3177
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
gtk/gtktext.c