From: Philip Chimento Date: Tue, 11 Jan 2011 07:37:00 +0000 (-0500) Subject: Also trigger the "command" signal on char input X-Git-Tag: v0.9~159^2~1 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=0fef3cbbff5ee03c5d62143a3874484d024327f3;p=projects%2Fchimara%2Fchimara.git Also trigger the "command" signal on char input Character input should also trigger the ChimaraIF::command signal. --- diff --git a/libchimara/chimara-if.c b/libchimara/chimara-if.c index efbd529..4e8c1d9 100644 --- a/libchimara/chimara-if.c +++ b/libchimara/chimara-if.c @@ -125,6 +125,17 @@ chimara_if_stopped(ChimaraGlk *glk) priv->interpreter = CHIMARA_IF_INTERPRETER_NONE; } +static void +chimara_if_char_input(ChimaraGlk *glk, guint32 win_rock, guint keysym) +{ + CHIMARA_IF_USE_PRIVATE(glk, priv); + g_assert(priv->input == NULL); + + gchar outbuf[6]; + gint outbuflen = g_unichar_to_utf8(gdk_keyval_to_unicode(keysym), outbuf); + priv->input = g_strndup(outbuf, outbuflen); +} + static void chimara_if_line_input(ChimaraGlk *glk, guint32 win_rock, gchar *input) { @@ -161,6 +172,7 @@ chimara_if_init(ChimaraIF *self) /* Connect to signals of ChimaraGlk parent */ g_signal_connect(self, "stopped", G_CALLBACK(chimara_if_stopped), NULL); g_signal_connect(self, "waiting", G_CALLBACK(chimara_if_waiting), NULL); + g_signal_connect(self, "char-input", G_CALLBACK(chimara_if_char_input), NULL); g_signal_connect(self, "line-input", G_CALLBACK(chimara_if_line_input), NULL); g_signal_connect(self, "text-buffer-output", G_CALLBACK(chimara_if_text_buffer_output), NULL); }