Compositors send a "done" event after every text-input commit, even if
the reported state (preedit etc) hasn't changed. Acting on such events
is at best wasteful, but can additionally lead to incorrect IME related
effects (e.g., deleting the currently selected text), so ignore them,
similarly to what Qt and GTK do.
The first commit performs some state related cleanups.
--
This solves an IME problem I have been experiencing with compositors that support text-input-v3 (e.g., kwin).
1. Run notepad
2. Write some text
3. Try to select text
Expected result: text is selected
Actual result: text is deleted
What happens is that while the user is selecting text the driver gets a series of `SetIMECompositionRect` callback which cause a series of text-input-v3 `set_cursor_rectangle`-`commit` requests. These `commit`s elicit `done` events from the compositor with no state changes, which we interpret as "clear the composition string" (and by extension the active selection), because that's what such states normally means, and forward them to windows IME.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8196