From: Jan Krupa Date: Wed, 16 Oct 2013 12:40:05 +0000 (+0200) Subject: qemu-char: add support for U-prefixed symbols X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=828071592470d0703a283433ea195295dab0ad7d;p=qemu.git 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 Signed-off-by: Michael Tokarev --- 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; }