diff options
author | Daniel Stone <daniel@fooishbar.org> | 2011-06-21 15:55:59 +0100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2011-06-21 16:03:00 +0100 |
commit | 3caab5aa37decb7b5dc1642a0452efc3e1f5100e (patch) | |
tree | 69380ddbce7a04ec4c5fc290271db1392b84d0a8 | |
parent | b34af8b0aec3a1dfc58f9732996274cbf2646a53 (diff) |
Interp: Allow explicit Any/NoSymbol mappings
Brown paper bag in full effect.
The previous fix, while crushing the previous problem where an unknown
keysym for an interp def would lead to every key matching it, also
ignored explicit Any+AnyOfOrNone(All) mappings.
Such as the one xkeyboard-config relied on for Control to actually
update the modifier state.
Fix this by allowing mappings explicitly declared as Any/NoSymbol, while
ignoring only those with failed keysym lookups. Unfortunately, due to
the structure of the parser, it's a deeply inelegant fix.
Verified with a quick check of all layouts (albeit using default
variants only) in xkeyboard-config that this results in no changes to
the output at all, compared to xkbcomp 1.1.1.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | compat.c | 4 | ||||
-rw-r--r-- | parseutils.c | 7 | ||||
-rw-r--r-- | parseutils.h | 2 | ||||
-rw-r--r-- | xkbcomp.h | 1 | ||||
-rw-r--r-- | xkbparse.y | 4 |
5 files changed, 11 insertions, 7 deletions
@@ -658,9 +658,9 @@ HandleInterpDef(InterpDef * def, XkbDescPtr xkb, unsigned merge, ACTION("Symbol interpretation ignored\n"); return True; } - if (def->sym == NoSymbol) + if (def->ignore) { - ERROR("Couldn't determine keysym\n"); + ERROR("Couldn't lookup keysym\n"); ACTION("Symbol interpretation ignored\n"); return True; } diff --git a/parseutils.c b/parseutils.c index fe0a536..ca665e2 100644 --- a/parseutils.c +++ b/parseutils.c @@ -220,7 +220,7 @@ BoolVarCreate(Atom nameToken, unsigned set) } InterpDef * -InterpCreate(KeySym sym, ExprDef * match) +InterpCreate(const char *sym_str, ExprDef * match) { InterpDef *def; @@ -229,7 +229,10 @@ InterpCreate(KeySym sym, ExprDef * match) { def->common.stmtType = StmtInterpDef; def->common.next = NULL; - def->sym = sym; + if (LookupKeysym(sym_str, &def->sym) == 0) + def->ignore = True; + else + def->ignore = False; def->match = match; } else diff --git a/parseutils.h b/parseutils.h index c6ac4ce..8b8a6c1 100644 --- a/parseutils.h +++ b/parseutils.h @@ -88,7 +88,7 @@ extern VarDef *BoolVarCreate(Atom /* nameToken */ , unsigned /* set */ ); -extern InterpDef *InterpCreate(KeySym /* sym */ , +extern InterpDef *InterpCreate(const char * /* sym_str */ , ExprDef * /* match */ ); @@ -243,6 +243,7 @@ typedef struct _InterpDef KeySym sym; ExprDef *match; VarDef *def; + Bool ignore; } InterpDef; typedef struct _IndicatorNameDef @@ -374,9 +374,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 |