gtkimcontextwayland: Shuffle full resets after IM changes
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 24 Sep 2022 09:45:18 +0000 (11:45 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 24 Sep 2022 09:52:16 +0000 (11:52 +0200)
commitfb280e47d6487d46aa26a85c35838dce0a90bd94
treedd4ae333f2969f09adabf886544507470bd906ff
parentbccb4f87beb9108eb10c44ba5449c267eb7b80b1
gtkimcontextwayland: Shuffle full resets after IM changes

Doing reset() on the text widgets after commit and delete_surrounding
is still too eager for some IMs (e.g. those that expect being able
to commit text while keeping a preedit buffer shown).

However, reset() is more of a "synchronize state" action on Wayland,
and it is still desirable to do that after changes that do come from
the IM (e.g. requesting the new surrounding text and cursor/anchor
positions). Notably here, the text_input protocol may still come up
with a preedit string after this state synchronization happens.

Shuffle the code so that the text widgets do not reset() the IM
context after text is deleted or committed, but the Wayland IM does
apply its practical effects after these actions happen. This keeps
the Wayland IM fully up-to-date wrt text widget state, while not
altering the ::commit and ::delete-surrounding-text behavior for
other IM context implementations.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5200
Fixes: 5b78fe2721 (gtktextview: Also reset IM context after IM...)
Fixes: 7c0a395ff9 (gtktext: Also reset IM context after IM...)
Fixes: 52ac71b972 (gtktextview: Shuffle the places doing IM reset)
Fixes: 9e29739e66 (gtktext: Shuffle the places doing IM reset)
gtk/gtkimcontextwayland.c
gtk/gtktext.c
gtk/gtktextview.c