Interp: More lazy keysym resolution Resolve the keysyms when we create an InterpDef, rather than directly in the parser. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 3c6146a..6058c5a 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -35,6 +35,7 @@
#include "indicators.h"
#include "action.h"
#include "compat.h"
+#include "parseutils.h"
typedef struct _SymInterpInfo
{
@@ -667,7 +668,12 @@ HandleInterpDef(InterpDef * def, XkbcDescPtr xkb, unsigned merge,
si = info->dflt;
si.defs.merge = merge;
- si.interp.sym = def->sym;
+ if (!LookupKeysym(def->sym, &si.interp.sym))
+ {
+ WARN("Could not resolve keysym %s\n", def->sym);
+ info->errorCount++;
+ return False;
+ }
si.interp.match = pred & XkbSI_OpMask;
si.interp.mods = mods;
if (!HandleInterpBody(def->def, xkb, &si, info))
diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c
index cea1572..f2847e2 100644
--- a/src/xkbcomp/parseutils.c
+++ b/src/xkbcomp/parseutils.c
@@ -219,7 +219,7 @@ BoolVarCreate(Atom nameToken, unsigned set)
}
InterpDef *
-InterpCreate(CARD32 sym, ExprDef * match)
+InterpCreate(char *sym, ExprDef * match)
{
InterpDef *def;
@@ -228,7 +228,7 @@ InterpCreate(CARD32 sym, ExprDef * match)
{
def->common.stmtType = StmtInterpDef;
def->common.next = NULL;
- def->sym = sym;
+ def->sym = strdup(sym);
def->match = match;
}
else
diff --git a/src/xkbcomp/parseutils.h b/src/xkbcomp/parseutils.h
index 9bc0a6b..d96a20b 100644
--- a/src/xkbcomp/parseutils.h
+++ b/src/xkbcomp/parseutils.h
@@ -88,7 +88,7 @@ extern VarDef *BoolVarCreate(Atom /* nameToken */ ,
unsigned /* set */
);
-extern InterpDef *InterpCreate(CARD32 /* sym */ ,
+extern InterpDef *InterpCreate(char * /* sym */ ,
ExprDef * /* match */
);
diff --git a/src/xkbcomp/xkbparse.y b/src/xkbcomp/xkbparse.y
index 1c05356..32f8f0a 100644
--- a/src/xkbcomp/xkbparse.y
+++ b/src/xkbcomp/xkbparse.y
@@ -376,9 +376,9 @@ InterpretDecl : INTERPRET InterpretMatch OBRACE
;
InterpretMatch : KeySym PLUS Expr
- { $$= InterpCreate(XStringToKeysym($1), $3); }
+ { $$= InterpCreate($1, $3); }
| KeySym
- { $$= InterpCreate(XStringToKeysym($1), NULL); }
+ { $$= InterpCreate($1, NULL); }
;
VarDeclList : VarDeclList VarDecl