summaryrefslogtreecommitdiff
path: root/src/keymap.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/keymap.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/keymap.h')
-rw-r--r--src/keymap.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/keymap.h b/src/keymap.h
index 014ad72..2471d19 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -88,8 +88,6 @@
#include "utils.h"
#include "context.h"
-#define XKB_KEY_NAME_LENGTH 4
-
/* This limit is artificially enforced, we do not depend on it any where.
* The reason it's still here is that the rules file format does not
* support multiple groups very well, and the rules shipped with
@@ -287,8 +285,8 @@ struct xkb_indicator_map {
};
struct xkb_key_alias {
- char real[XKB_KEY_NAME_LENGTH];
- char alias[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t real;
+ xkb_atom_t alias;
};
struct xkb_controls {
@@ -339,7 +337,7 @@ struct xkb_group {
struct xkb_key {
xkb_keycode_t keycode;
- char name[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t name;
enum xkb_explicit_components explicit;