aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorJan Krupa <JKrupa@suse.com>2013-10-16 14:40:05 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2013-11-13 15:48:38 +0400
commit828071592470d0703a283433ea195295dab0ad7d (patch)
treebb0e92b0869540330504008cd546f76062bd3e63 /ui
parent3751e72246b3efd9902bddc7fbd20df8f86bab21 (diff)
qemu-char: add support for U-prefixed symbols
This patch adds support for Unicode symbols in keymap files. This feature was already used in some keyboard layouts in QEMU generated from XKB (e.g. Arabic) but it wasn't implemented in QEMU source code. There is no need for check of validity of the hex string after U character because strtol returns 0 in case the conversion was unsuccessful. Signed-off-by: Jan Krupa <jkrupa@suse.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'ui')
-rw-r--r--ui/keymaps.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/keymaps.c b/ui/keymaps.c
index f373cc53d9..80d658d907 100644
--- a/ui/keymaps.c
+++ b/ui/keymaps.c
@@ -33,6 +33,12 @@ static int get_keysym(const name2keysym_t *table,
if (!strcmp(p->name, name))
return p->keysym;
}
+ if (name[0] == 'U' && strlen(name) == 5) { /* try unicode Uxxxx */
+ char *end;
+ int ret = (int)strtoul(name + 1, &end, 16);
+ if (*end == '\0' && ret > 0)
+ return ret;
+ }
return 0;
}