From fbea30bbaf0af1226959a0ba1bb98724e456b129 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 26 Mar 2025 20:13:54 +0000 Subject: [PATCH] GTK: trivially handle preedit signals At present, that just means logging them when KEY_EVENT_DIAGNOSTICS is defined. --- unix/window.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/unix/window.c b/unix/window.c index a172c1c4..6c0752d8 100644 --- a/unix/window.c +++ b/unix/window.c @@ -2117,6 +2117,33 @@ void input_method_commit_event(GtkIMContext *imc, gchar *str, gpointer data) show_mouseptr(inst, false); key_pressed(inst); } + +void input_method_preedit_start_event(GtkIMContext *imc, gpointer data) +{ + GtkFrontend *inst = (GtkFrontend *)data; + +#ifdef KEY_EVENT_DIAGNOSTICS + debug(" - IM preedit-start event\n"); +#endif +} + +void input_method_preedit_changed_event(GtkIMContext *imc, gpointer data) +{ + GtkFrontend *inst = (GtkFrontend *)data; + +#ifdef KEY_EVENT_DIAGNOSTICS + debug(" - IM preedit-changed event\n"); +#endif +} + +void input_method_preedit_end_event(GtkIMContext *imc, gpointer data) +{ + GtkFrontend *inst = (GtkFrontend *)data; + +#ifdef KEY_EVENT_DIAGNOSTICS + debug(" - IM preedit-end event\n"); +#endif +} #endif #define SCROLL_INCREMENT_LINES 5 @@ -5570,6 +5597,12 @@ void new_session_window(Conf *conf, const char *geometry_string) #if GTK_CHECK_VERSION(2,0,0) g_signal_connect(G_OBJECT(inst->imc), "commit", G_CALLBACK(input_method_commit_event), inst); + g_signal_connect(G_OBJECT(inst->imc), "preedit-start", + G_CALLBACK(input_method_preedit_start_event), inst); + g_signal_connect(G_OBJECT(inst->imc), "preedit-changed", + G_CALLBACK(input_method_preedit_changed_event), inst); + g_signal_connect(G_OBJECT(inst->imc), "preedit-end", + G_CALLBACK(input_method_preedit_end_event), inst); #endif if (conf_get_bool(inst->conf, CONF_scrollbar)) g_signal_connect(G_OBJECT(inst->sbar_adjust), "value_changed",