diff options
author | Daniel Stone <daniel@fooishbar.org> | 2010-06-07 22:43:01 +0100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2010-06-15 19:26:49 +0100 |
commit | 02de53d767b20bab1517b4e8a3e7eb3b9e7f15be (patch) | |
tree | e917c813c074a6acb89f03cd15dcc36855c8388c /symbols.c | |
parent | 07cc4d60dea2b4c947fed45b082edae4a53b186a (diff) |
Lazy keysym parsing (avoid XStringToKeysym)
Instead of calling XStringToKeysym on every keysym we parse, store it as
a string until we need to store it in an actual keymap.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'symbols.c')
-rw-r--r-- | symbols.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -27,6 +27,7 @@ #include "xkbcomp.h" #include "tokens.h" #include "expr.h" +#include "parseutils.h" #include <X11/keysym.h> #include <X11/Xutil.h> @@ -968,8 +969,12 @@ AddSymbolsToKey(KeyInfo * key, return False; } key->symsDefined |= (1 << ndx); - memcpy((char *) key->syms[ndx], (char *) value->value.list.syms, - nSyms * sizeof(KeySym)); + for (i = 0; i < nSyms; i++) { + if (!LookupKeysym(value->value.list.syms[i], &key->syms[ndx][i])) { + WSGO1("Could not resolve keysym %s\n", value->value.list.syms[i]); + key->syms[ndx][i] = NoSymbol; + } + } for (i = key->numLevels[ndx] - 1; (i >= 0) && (key->syms[ndx][i] == NoSymbol); i--) { |