diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-11-12 21:17:15 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-11-12 21:17:15 +0100 |
commit | 946df2d589acf7199c06057d9811521d66d6ea2d (patch) | |
tree | 4392d5bda30884399f8e258c2b19bf7f71357365 | |
parent | e8814366e4e04cb411dbccb751903c7381a6c833 (diff) |
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 <dh.herrmann@gmail.com>
-rw-r--r-- | src/wlterm.c | 8 |
1 files 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; } |