summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/idev-keyboard.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-10-03 12:48:36 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-10-03 15:57:00 +0200
commitfe741a85c1912ead26c1a78251e1d490a8a432b3 (patch)
tree9f3692b469b6914d3eb155c257c6a02bad0e1f67 /src/libsystemd-terminal/idev-keyboard.c
parent61d0326a5b1c11a8f2e8e31ec9093e81daa26588 (diff)
downloadsystemd-fe741a85c1912ead26c1a78251e1d490a8a432b3.tar.gz
terminal/idev: don't map XKB_KEY_NoSymbol as ASCII 0
XKB_KEY_NoSymbol is defined as 0 but does not correspond to a VT key with ASCII value 0. No such key exists, so don't try to find such a key.
Diffstat (limited to 'src/libsystemd-terminal/idev-keyboard.c')
-rw-r--r--src/libsystemd-terminal/idev-keyboard.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index d5936b7d23..8dc1c20b14 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -575,7 +575,7 @@ static int8_t guess_ascii(struct xkb_state *state, uint32_t code, uint32_t n_sym
const xkb_keysym_t *s;
int num;
- if (n_syms == 1 && syms[0] < 128)
+ if (n_syms == 1 && syms[0] < 128 && syms[0] > 0)
return syms[0];
keymap = xkb_state_get_keymap(state);
@@ -584,7 +584,7 @@ static int8_t guess_ascii(struct xkb_state *state, uint32_t code, uint32_t n_sym
for (lo = 0; lo < n_lo; ++lo) {
lv = xkb_state_key_get_level(state, code + KBDXKB_SHIFT, lo);
num = xkb_keymap_key_get_syms_by_level(keymap, code + KBDXKB_SHIFT, lo, lv, &s);
- if (num == 1 && s[0] < 128)
+ if (num == 1 && s[0] < 128 && s[0] > 0)
return s[0];
}