wl: a deactivate cannot hand the pending text back

40fd4ab was half right and the sway run said which half.  The compositor
does relay the commit when a client merely disabled its text input while
holding the focus -- that much was read correctly out of sway -- but the
client has stopped listening by then.  On the wire, in that order:

	-> zwp_text_input_v3.disable()
	-> zwp_text_input_v3.commit()
	<- zwp_text_input_v3.preedit_string("")
	<- zwp_text_input_v3.commit_string("가")
	<- zwp_text_input_v3.done()

and the entry unchanged.  GTK3 drops global->current at its own
focus-out, and any client that follows text-input-v3 does the same, since
events between disable and the next enable are to be ignored.  So the
composition is unrecoverable there, by no fault of ours, and the commit
was a request nobody could take.

The code goes back to what it was; the comment does not.  The old one
said the compositor drops the commit, which is true only when the focus
moved, and that half-truth is what invited the change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-17 22:10:31 +09:00
parent 5ff54237ff
commit 8a08efe2bb

12
wl.c
View File

@@ -343,11 +343,12 @@ releasegrab(void)
}
/*
* The context is going: give the client its keys back and the pending
* text, as a lost focus does everywhere else. A client that only
* disabled its text input still holds the focus and takes the commit;
* when the focus itself moved, the compositor sent the text input its
* leave first and drops the commit whatever serial it carries.
* The context is going: give the client its keys back. The pending text
* goes nowhere either way -- the compositor drops a commit once the text
* input has its leave, and a client that disabled its own text input has
* stopped listening, so it throws a relayed commit away. XIM and IBus
* hand the text back here because their focus-out is a round trip the
* client still waits on; a deactivate is not.
*/
static void
leave(void)
@@ -357,7 +358,6 @@ leave(void)
releasekeys();
if(engaged){
sendrequest(Keyrelease, 0, 0, &res);
answer(&res, "");
engaged = 0;
takedraw();
}