fix gtk: commit pending text on passthrough keys

The GTK IM module only emitted the commit signal when the key was
eaten (r != 0). But when a non-matching key is pressed mid-composition
the engine commits the pending preedit and returns eaten=0 so the raw
key passes through, sending a commit string with eaten=0. GTK dropped
it, silently losing the composed text (e.g. Hangul "ㅇ" + "?" yielded
only "?").

Commit whenever a commit string is present, matching the wayland, ibus
and xim frontends.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-19 12:50:32 +09:00
parent bd2c1aeaca
commit aefe9bc618

View File

@@ -145,7 +145,7 @@ kpress(GtkIMContext *ctx, GdkEventKey *ev)
r = readresp(im, resp, sizeof(resp)); r = readresp(im, resp, sizeof(resp));
if(r < 0) if(r < 0)
return FALSE; return FALSE;
if(r != 0 && resp[0] != '\0') if(resp[0] != '\0')
g_signal_emit_by_name(ctx, "commit", resp); g_signal_emit_by_name(ctx, "commit", resp);
return r != 0; return r != 0;
} }