From 946df2d589acf7199c06057d9811521d66d6ea2d Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 12 Nov 2013 21:17:15 +0100 Subject: Pass TSM_VTE_INVALID for invalid UCS4 values xkbcommon returns 0 for invalid ucs4 values. Unfortunately, this is a valid UCS4 code. That's why TSM requires us to pass TSM_VTE_INVALID instead. So add a short fixup to convert 0 to TSM_VTE_INVALID. We rely on xkbcommon to never return 0 for valid codes now. This seems unfortunate, but the API was broken right from the beginning. Signed-off-by: David Herrmann --- src/wlterm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wlterm.c b/src/wlterm.c index a90bdcd..c87229e 100644 --- a/src/wlterm.c +++ b/src/wlterm.c @@ -384,6 +384,7 @@ static gboolean term_key_cb(GtkWidget *widget, GdkEvent *ev, gpointer data) gboolean b; GdkModifierType cmod; guint key; + uint32_t ucs4; if (e->type != GDK_KEY_PRESS) return FALSE; @@ -435,8 +436,11 @@ static gboolean term_key_cb(GtkWidget *widget, GdkEvent *ev, gpointer data) } } - if (tsm_vte_handle_keyboard(term->vte, e->keyval, 0, - mods, xkb_keysym_to_utf32(e->keyval))) { + ucs4 = xkb_keysym_to_utf32(e->keyval); + if (!ucs4) + ucs4 = TSM_VTE_INVALID; + + if (tsm_vte_handle_keyboard(term->vte, e->keyval, 0, mods, ucs4)) { tsm_screen_sb_reset(term->screen); return TRUE; } -- cgit v1.2.3