summaryrefslogtreecommitdiff
path: root/src/xkbcomp/ast.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-09-27 18:49:13 +0200
committerRan Benita <ran234@gmail.com>2012-09-27 21:12:08 +0200
commit3b389b15bfaa33874ee6a2c308241984c8727faa (patch)
tree8302997228575ce60ba9bcfccfc710961a9f7444 /src/xkbcomp/ast.h
parent53cfe8c36211fe3d1fb7576d2c9498f7f67ea6af (diff)
downloadxorg-lib-libxkbcommon-3b389b15bfaa33874ee6a2c308241984c8727faa.tar.gz
Don't limit key names to 4 characters
Currently you can't give a key in xkb_keycodes a name of more than XKB_KEY_NAME_LENGTH (= 4) chars. This is a pretty annoying and arbitrary limitation; it leads to names such as <RTSH>, <COMP>, <PRSC>, <KPAD> etc. which may be hard to decipher, and makes it impossible to give more standard names (e.g. from linux/input.h) to keycodes. The purpose of this, as far as I can tell, was to save memory and to allow encoding a key name directly to a 32 bit value (unsigned long it was). We remove this limitation by just storing the names as atoms; this lifts the limit, allows for easy comparison like the unsigned long thing, and doesn't use more memory than previous solution. It also relieves us from doing all of the annoying conversions to/from long. This has a large diffstat only because KeyNameText, which is used a lot, now needs to take the context in order to resolve the atom. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp/ast.h')
-rw-r--r--src/xkbcomp/ast.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h
index 5b410ca..4d8bc83 100644
--- a/src/xkbcomp/ast.h
+++ b/src/xkbcomp/ast.h
@@ -189,7 +189,7 @@ typedef struct _Expr {
xkb_atom_t str;
unsigned uval;
int ival;
- char keyName[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t keyName;
} value;
} ExprDef;
@@ -210,15 +210,15 @@ typedef struct _VModDef {
typedef struct _KeycodeDef {
ParseCommon common;
enum merge_mode merge;
- char name[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t name;
unsigned long value;
} KeycodeDef;
typedef struct _KeyAliasDef {
ParseCommon common;
enum merge_mode merge;
- char alias[XKB_KEY_NAME_LENGTH];
- char real[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t alias;
+ xkb_atom_t real;
} KeyAliasDef;
typedef struct _KeyTypeDef {
@@ -231,7 +231,7 @@ typedef struct _KeyTypeDef {
typedef struct _SymbolsDef {
ParseCommon common;
enum merge_mode merge;
- char keyName[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t keyName;
ExprDef *symbols;
} SymbolsDef;