fix(text-input): a disable ends the composition like a leave

The window's record of the composing text it was last told (TextStrings().shown)
was cleared only by the compositor's leave. An app that disables and enables
the text input to reset the input method — after it committed the composing
word itself — then never heard of a later composition equal to that word: the
done handler reports a preedit only when it differs from the record. The
disable path clears the record and the pending flags now, as the leave does,
so the first composition after an enable is reported whatever it is.
This commit is contained in:
Jorijn van der Graaf 2026-10-31 16:27:47 +01:00
commit 6f471ca6b1
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB

View file

@ -455,6 +455,12 @@ void Device::ApplyTextInput(Window* window) {
if (!window->textInputEnabled_) return;
window->textInputEnabled_ = false;
zwp_text_input_v3_disable(textInput);
// The disable ends the composition as a leave does: the next enable
// starts afresh, so the record of what the window was last told goes
// with it (a composition equal to it after the enable is new).
textInputHasPreedit = textInputHasCommit = textInputHasDelete = false;
TextStrings().preedit.clear();
TextStrings().shown.clear();
}
zwp_text_input_v3_commit(textInput);
wl_display_flush(display);