.gitignore | 5 .uncrustify.cfg | 228 + Android.mk | 45 Makefile.am | 155 + README | 117 autogen.sh | 2 configure.ac | 90 debian/changelog | 8 debian/control | 2 debian/libxkbcommon-dev.install | 4 include/Makefile.am | 1 include/X11/extensions/XKBcommon.h | 841 ----- makekeys/Makefile.am | 7 makekeys/makekeys.c | 315 -- src/Makefile.am | 30 src/XKBcommonint.h | 89 src/alloc.c | 342 -- src/atom.c | 318 +- src/atom.h | 50 src/context.c | 363 ++ src/darray.h | 383 ++ src/galloc.c | 755 ----- src/geom.c | 182 - src/keymap-dump.c | 808 +++++ src/keysym-utf.c | 960 ++++++ src/keysym.c | 258 + src/list.h | 489 +++ src/malloc.c | 511 --- src/map.c | 422 ++ src/maprules.c | 1041 ------- src/misc.c | 295 -- src/state.c | 911 ++++++ src/text.c | 337 +- src/text.h | 62 src/utils.h | 93 src/xkb-priv.h | 517 +++ src/xkb.c | 143 src/xkballoc.h | 76 src/xkbcomp/.gitignore | 5 src/xkbcomp/Makefile.am | 38 src/xkbcomp/action.c | 2059 ++++++-------- src/xkbcomp/action.h | 127 src/xkbcomp/alias.c | 287 -- src/xkbcomp/alias.h | 56 src/xkbcomp/compat.c | 1864 ++++++++---- src/xkbcomp/compat.h | 7 src/xkbcomp/expr.c | 1426 ++++----- src/xkbcomp/expr.h | 236 - src/xkbcomp/geometry.c | 3730 -------------------------- src/xkbcomp/indicators.c | 571 --- src/xkbcomp/indicators.h | 83 src/xkbcomp/keycodes.c | 1390 +++++---- src/xkbcomp/keycodes.h | 39 src/xkbcomp/keymap.c | 180 - src/xkbcomp/keytypes.c | 1744 ++++-------- src/xkbcomp/listing.c | 520 --- src/xkbcomp/misc.c | 355 -- src/xkbcomp/misc.h | 91 src/xkbcomp/parser.y | 759 +++++ src/xkbcomp/parseutils.c | 1061 +++---- src/xkbcomp/parseutils.h | 270 - src/xkbcomp/path.c | 281 + src/xkbcomp/path.h | 46 src/xkbcomp/rules.c | 1126 +++++++ src/xkbcomp/rules.h | 36 src/xkbcomp/scanner.l | 301 ++ src/xkbcomp/symbols.c | 3255 ++++++++++------------ src/xkbcomp/tokens.h | 105 src/xkbcomp/utils.c | 252 - src/xkbcomp/utils.h | 163 - src/xkbcomp/vmod.c | 366 +- src/xkbcomp/vmod.h | 97 src/xkbcomp/xkbcomp-priv.h | 122 src/xkbcomp/xkbcomp.c | 514 +-- src/xkbcomp/xkbcomp.h | 423 +- src/xkbcomp/xkbparse.y | 767 ----- src/xkbcomp/xkbpath.c | 441 --- src/xkbcomp/xkbpath.h | 60 src/xkbcomp/xkbscan.l | 246 - src/xkbgeom.h | 82 src/xkbmisc.h | 105 src/xkbrules.h | 161 - test/.gitignore | 12 test/Makefile.am | 18 test/bad.xkb | 5 test/basic.xkb | 7 test/canonicalise.c | 87 test/canonicalise.sh | 57 test/common.c | 176 + test/context.c | 45 test/data/compat/accessx | 52 test/data/compat/basic | 48 test/data/compat/caps | 12 test/data/compat/complete | 10 test/data/compat/default | 12 test/data/compat/iso9995 | 80 test/data/compat/ledcaps | 23 test/data/compat/lednum | 23 test/data/compat/ledscroll | 23 test/data/compat/level5 | 51 test/data/compat/misc | 122 test/data/compat/mousekeys | 202 + test/data/compat/pc | 17 test/data/compat/xfree86 | 66 test/data/keycodes/aliases | 99 test/data/keycodes/evdev | 314 ++ test/data/keymaps/bad.xkb | 5 test/data/keymaps/basic.xkb | 6 test/data/keymaps/comprehensive-plus-geom.xkb | 1813 ++++++++++++ test/data/keymaps/default.xkb | 15 test/data/keymaps/divide-by-zero.xkb | 17 test/data/keymaps/no-types.xkb | 1025 +++++++ test/data/keymaps/stringcomp.data | 1927 +++++++++++++ test/data/rules/evdev | 1098 +++++++ test/data/rules/groups | 17 test/data/rules/index | 28 test/data/rules/multiple-options | 27 test/data/rules/simple | 21 test/data/symbols/altwin | 79 test/data/symbols/ca | 530 +++ test/data/symbols/capslock | 74 test/data/symbols/compose | 54 test/data/symbols/ctrl | 57 test/data/symbols/de | 627 ++++ test/data/symbols/eurosign | 23 test/data/symbols/group | 457 +++ test/data/symbols/il | 251 + test/data/symbols/in | 1726 ++++++++++++ test/data/symbols/inet | 1873 +++++++++++++ test/data/symbols/keypad | 633 ++++ test/data/symbols/kpdl | 102 test/data/symbols/latin | 256 + test/data/symbols/level3 | 196 + test/data/symbols/level5 | 147 + test/data/symbols/nbsp | 204 + test/data/symbols/pc | 90 test/data/symbols/ru | 653 ++++ test/data/symbols/shift | 84 test/data/symbols/srvr_ctrl | 125 test/data/symbols/terminate | 7 test/data/symbols/us | 1337 +++++++++ test/data/types/basic | 29 test/data/types/complete | 9 test/data/types/extra | 161 + test/data/types/iso9995 | 18 test/data/types/level5 | 213 + test/data/types/mousekeys | 10 test/data/types/numpad | 67 test/data/types/pc | 115 test/default.xkb | 15 test/filecomp.c | 118 test/filecomp.sh | 34 test/interactive.c | 504 +++ test/keyseq.c | 278 + test/keysym.c | 82 test/log.c | 120 test/named.xkb | 15 test/namescomp.c | 62 test/namescomp.sh | 36 test/rules-file.c | 186 + test/rulescomp.c | 157 - test/rulescomp.sh | 34 test/state.c | 287 ++ test/stringcomp.c | 81 test/test.h | 47 test/xkey.c | 51 test/xkey.sh | 49 xkbcommon-uninstalled.pc.in | 8 xkbcommon.pc.in | 1 xkbcommon/xkbcommon-keysyms.h | 2995 ++++++++++++++++++++ xkbcommon/xkbcommon-names.h | 39 xkbcommon/xkbcommon.h | 719 +++++ 172 files changed, 39190 insertions(+), 21597 deletions(-)
New commits: commit d43308d60c67e866c8420d4111cb9e2c9395656c Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Thu Aug 16 21:34:50 2012 +0300 control: Update Standards-Version, no changes. diff --git a/debian/changelog b/debian/changelog index 48492e2..a5d43dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ libxkbcommon (0.1.0~2-1) UNRELEASED; urgency=low [ Timo Aaltonen ] * Merge master up to f491285a5f. * libxkbcommon-dev.install: Add new headers, rename existing. + * control: Update Standards-Version, no changes. -- Cyril Brulebois <k...@debian.org> Fri, 17 Jun 2011 16:21:08 +0200 diff --git a/debian/control b/debian/control index 52f2b89..cc1e9bf 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends: x11proto-core-dev, x11proto-kb-dev (>= 1.0.5), xkb-data, -Standards-Version: 3.9.1 +Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxkbcommon Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxkbcommon.git commit c57263cad4ea5a9c07fc5b805ddd33449865d012 Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Thu Aug 16 21:33:02 2012 +0300 libxkbcommon-dev.install: Add new headers, rename existing. diff --git a/debian/changelog b/debian/changelog index 7b4d49b..48492e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ libxkbcommon (0.1.0~2-1) UNRELEASED; urgency=low [ Timo Aaltonen ] * Merge master up to f491285a5f. + * libxkbcommon-dev.install: Add new headers, rename existing. -- Cyril Brulebois <k...@debian.org> Fri, 17 Jun 2011 16:21:08 +0200 diff --git a/debian/libxkbcommon-dev.install b/debian/libxkbcommon-dev.install index db79b23..55a9b31 100644 --- a/debian/libxkbcommon-dev.install +++ b/debian/libxkbcommon-dev.install @@ -1,5 +1,7 @@ # Use no wildcards to ensure we spot any update: -usr/include/X11/extensions/XKBcommon.h +usr/include/xkbcommon/xkbcommon.h +usr/include/xkbcommon/xkbcommon-keysyms.h +usr/include/xkbcommon/xkbcommon-names.h usr/lib/libxkbcommon.a usr/lib/libxkbcommon.so usr/lib/pkgconfig/xkbcommon.pc commit 1d051696a23fcd6636c8f75852dc4644aa884d8a Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Thu Aug 16 21:16:47 2012 +0300 bump the version diff --git a/debian/changelog b/debian/changelog index 621ca46..7b4d49b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libxkbcommon (0.1.0~1-1) UNRELEASED; urgency=low +libxkbcommon (0.1.0~2-1) UNRELEASED; urgency=low [ Cyril Brulebois ] * Fix short description for libxkbcommon-dev. [ Timo Aaltonen ] - * Merge master up to c19661b965. + * Merge master up to f491285a5f. -- Cyril Brulebois <k...@debian.org> Fri, 17 Jun 2011 16:21:08 +0200 commit f491285a5f4b5f680a87e9e3076e8499f3ed2a3b Author: Daniel Stone <dan...@fooishbar.org> Date: Thu Aug 9 16:47:53 2012 +0200 Move 'no symbols defined for ...' message to a warning Shut up shut up shut up shut up shut up shut up. Signed-off-by: Daniel Stone <dan...@fooishbar.org> diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 7574520..bd1bfdc 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -1926,7 +1926,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, continue; if (key->num_groups < 1) - log_warn(info.keymap->ctx, + log_info(info.keymap->ctx, "No symbols defined for %s (keycode %d)\n", KeyNameText(key->name), XkbKeyGetKeycode(keymap, key)); commit ec2172f31b25282f8c5a3ec6dd33453cc0acd320 Author: Ran Benita <ran...@gmail.com> Date: Fri Aug 10 22:48:18 2012 +0300 Combine a couple of macros Easier to see what it does without the trivial macros. Signed-off-by: Ran Benita <ran...@gmail.com> diff --git a/src/xkb-priv.h b/src/xkb-priv.h index 61ba590..9c42aeb 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -418,23 +418,11 @@ XkbKeyNumSyms(struct xkb_key *key, xkb_group_index_t group, } static inline xkb_keysym_t * -XkbKeySym(struct xkb_key *key, int ndx) -{ - return &darray_item(key->syms, ndx); -} - -static inline int -XkbKeySymOffset(struct xkb_key *key, xkb_group_index_t group, - xkb_level_index_t level) -{ - return key->sym_index[group * key->width + level]; -} - -static inline xkb_keysym_t * XkbKeySymEntry(struct xkb_key *key, xkb_group_index_t group, xkb_level_index_t level) { - return XkbKeySym(key, XkbKeySymOffset(key, group, level)); + return &darray_item(key->syms, + key->sym_index[group * key->width + level]); } static inline union xkb_action * commit 4c34bda15a4f8c8a16fa03d40bcf989db23023dd Author: Ran Benita <ran...@gmail.com> Date: Fri Aug 10 22:38:07 2012 +0300 action: get rid of xkb_any_action And use union xkb_action instead. We add xkb_private_action, which is the same as xkb_any_action, but only used where the intention is clear. This should take care of whatever sizing changes the action struct might have. Signed-off-by: Ran Benita <ran...@gmail.com> diff --git a/src/keymap-dump.c b/src/keymap-dump.c index f04f6cc..f406f31 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -397,9 +397,9 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, if (!suffix) suffix = ""; - type = ActionTypeText(action->any.type); + type = ActionTypeText(action->type); - switch (action->any.type) { + switch (action->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: @@ -408,10 +408,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, else args = VModMaskText(keymap, action->mods.mods.mods); write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args, - (action->any.type != XkbSA_LockGroup && + (action->type != XkbSA_LockGroup && (action->mods.flags & XkbSA_ClearLocks)) ? ",clearLocks" : "", - (action->any.type != XkbSA_LockGroup && + (action->type != XkbSA_LockGroup && (action->mods.flags & XkbSA_LatchToLock)) ? ",latchToLock" : "", suffix); @@ -425,10 +425,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, action->group.group > 0) ? "+" : "", (action->group.flags & XkbSA_GroupAbsolute) ? action->group.group + 1 : action->group.group, - (action->any.type != XkbSA_LockGroup && + (action->type != XkbSA_LockGroup && (action->group.flags & XkbSA_ClearLocks)) ? ",clearLocks" : "", - (action->any.type != XkbSA_LockGroup && + (action->type != XkbSA_LockGroup && (action->group.flags & XkbSA_LatchToLock)) ? ",latchToLock" : "", suffix); @@ -521,10 +521,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, default: write_buf(buf, "%s%s(type=0x%02x,data[0]=0x%02x,data[1]=0x%02x,data[2]=0x%02x,data[3]=0x%02x,data[4]=0x%02x,data[5]=0x%02x,data[6]=0x%02x)%s", - prefix, type, action->any.type, action->any.data[0], - action->any.data[1], action->any.data[2], - action->any.data[3], action->any.data[4], - action->any.data[5], action->any.data[6], + prefix, type, action->type, action->priv.data[0], + action->priv.data[1], action->priv.data[2], + action->priv.data[3], action->priv.data[4], + action->priv.data[5], action->priv.data[6], suffix); break; } diff --git a/src/xkb-priv.h b/src/xkb-priv.h index f53805f..61ba590 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -148,11 +148,6 @@ struct xkb_mods { xkb_mod_mask_t mask; /* computed effective mask */ }; -struct xkb_any_action { - uint8_t type; - uint8_t data[7]; -}; - struct xkb_mod_action { uint8_t type; uint8_t flags; @@ -240,8 +235,12 @@ struct xkb_pointer_button_action { int8_t button; }; +struct xkb_private_action { + uint8_t type; + uint8_t data[7]; +}; + union xkb_action { - struct xkb_any_action any; struct xkb_mod_action mods; struct xkb_group_action group; struct xkb_iso_action iso; @@ -254,6 +253,7 @@ union xkb_action { struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */ struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */ struct xkb_message_action msg; /* XXX just delete */ + struct xkb_private_action priv; unsigned char type; }; diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index a2dd9ed..0d37688 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -219,7 +219,7 @@ ReportNotFound(struct xkb_keymap *keymap, unsigned action, unsigned field, } static bool -HandleNoAction(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { @@ -277,16 +277,15 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, } static bool -HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleSetLatchMods(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_mod_action *act; + struct xkb_mod_action *act = &action->mods; unsigned rtrn; unsigned t1; xkb_mod_mask_t t2; - act = (struct xkb_mod_action *) action; if (array_ndx != NULL) { switch (field) { case F_ClearLocks: @@ -318,14 +317,13 @@ HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleLockMods(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_mod_action *act; + struct xkb_mod_action *act = &action->mods; unsigned t1; xkb_mod_mask_t t2; - act = (struct xkb_mod_action *) action; if ((array_ndx != NULL) && (field == F_Modifiers)) return ReportActionNotArray(keymap, action->type, field); switch (field) { @@ -370,16 +368,15 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action, } static bool -HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleSetLatchGroup(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_group_action *act; + struct xkb_group_action *act = &action->group; unsigned rtrn; unsigned t1; xkb_group_index_t t2; - act = (struct xkb_group_action *) action; if (array_ndx != NULL) { switch (field) { case F_ClearLocks: @@ -411,15 +408,14 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleLockGroup(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_group_action *act; + struct xkb_group_action *act = &action->group; unsigned t1; xkb_group_index_t t2; - act = (struct xkb_group_action *) action; if ((array_ndx != NULL) && (field == F_Group)) return ReportActionNotArray(keymap, action->type, field); if (field == F_Group) { @@ -435,13 +431,12 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_pointer_action *act; + struct xkb_pointer_action *act = &action->ptr; bool absolute; - act = (struct xkb_pointer_action *) action; if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y))) return ReportActionNotArray(keymap, action->type, field); @@ -493,12 +488,11 @@ static const LookupEntry lockWhich[] = { }; static bool -HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_pointer_button_action *act; + struct xkb_pointer_button_action *act = &action->btn; - act = (struct xkb_pointer_button_action *) action; if (field == F_Button) { int btn; @@ -564,13 +558,12 @@ static const LookupEntry ptrDflts[] = { }; static bool -HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_pointer_default_action *act; + struct xkb_pointer_default_action *act = &action->dflt; - act = (struct xkb_pointer_default_action *) action; if (field == F_Affect) { unsigned int val; @@ -638,12 +631,11 @@ static const LookupEntry isoNames[] = { }; static bool -HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleISOLock(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_iso_action *act; + struct xkb_iso_action *act = &action->iso; - act = (struct xkb_iso_action *) action; if (field == F_Modifiers) { unsigned flags; xkb_mod_mask_t mods; @@ -691,13 +683,12 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_switch_screen_action *act; + struct xkb_switch_screen_action *act = &action->screen; - act = (struct xkb_switch_screen_action *) action; if (field == F_Screen) { const ExprDef *scrn; int val; @@ -771,13 +762,12 @@ const LookupEntry ctrlNames[] = { static bool HandleSetLockControls(struct xkb_keymap *keymap, - struct xkb_any_action *action, + union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_controls_action *act; + struct xkb_controls_action *act = &action->ctrls; - act = (struct xkb_controls_action *) action; if (field == F_Controls) { unsigned int mask; @@ -806,13 +796,12 @@ static const LookupEntry evNames[] = { }; static bool -HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleActionMessage(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_message_action *act; + struct xkb_message_action *act = &action->msg; - act = (struct xkb_message_action *) action; if (field == F_Report) { unsigned int mask; @@ -896,12 +885,12 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleRedirectKey(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { struct xkb_key *key; - struct xkb_redirect_key_action *act; + struct xkb_redirect_key_action *act = &action->redirect; unsigned t1; xkb_mod_mask_t t2; unsigned long tmp; @@ -910,7 +899,6 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, if (array_ndx != NULL) return ReportActionNotArray(keymap, action->type, field); - act = (struct xkb_redirect_key_action *) action; switch (field) { case F_Keycode: if (!ExprResolveKeyName(keymap->ctx, value, key_name)) @@ -948,13 +936,12 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleDeviceBtn(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { - struct xkb_device_button_action *act; + struct xkb_device_button_action *act = &action->devbtn; - act = (struct xkb_device_button_action *) action; if (field == F_Button) { int val; @@ -1034,24 +1021,23 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action, } static bool -HandleDeviceValuator(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandleDeviceValuator(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { -#if 0 - ExprResult rtrn; - struct xkb_device_valuator_action *act; + struct xkb_device_valuator_action *act = &action->devval; + (void) act; - act = (struct xkb_device_valuator_action *) action; /* XXX - Not yet implemented */ -#endif return false; } static bool -HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, +HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value) { + struct xkb_private_action *act = &action->priv; + if (field == F_Type) { int type; @@ -1065,7 +1051,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, return false; } - action->type = (uint8_t) type; + act->type = (uint8_t) type; return true; } else if (field == F_Data) { @@ -1084,7 +1070,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, return false; } - strncpy((char *) action->data, str, sizeof(action->data)); + strncpy((char *) act->data, str, sizeof(act->data)); return true; } else { @@ -1097,16 +1083,16 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, return false; } - if (ndx < 0 || ndx >= sizeof(action->data)) { + if (ndx < 0 || ndx >= sizeof(act->data)) { log_err(keymap->ctx, "The data for a private action is %zu bytes long; " "Attempt to use data[%d] ignored\n", - sizeof(action->data), ndx); + sizeof(act->data), ndx); return false; } if (!ExprResolveInteger(keymap->ctx, value, &datum)) - return ReportMismatch(keymap, action->type, field, "integer"); + return ReportMismatch(keymap, act->type, field, "integer"); if (datum < 0 || datum > 255) { log_err(keymap->ctx, @@ -1115,7 +1101,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, return false; } - action->data[ndx] = (uint8_t) datum; + act->data[ndx] = (uint8_t) datum; return true; } } @@ -1124,7 +1110,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action, } typedef bool (*actionHandler)(struct xkb_keymap *keymap, - struct xkb_any_action *action, unsigned field, + union xkb_action *action, unsigned field, const ExprDef *array_ndx, const ExprDef *value); static const actionHandler handleAction[XkbSA_NumActions + 1] = { @@ -1170,7 +1156,7 @@ ApplyActionFactoryDefaults(union xkb_action * action) int HandleActionDef(ExprDef * def, struct xkb_keymap *keymap, - struct xkb_any_action *action, ActionInfo *info) + union xkb_action *action, ActionInfo *info) { ExprDef *arg; const char *str; diff --git a/src/xkbcomp/action.h b/src/xkbcomp/action.h index 3d63468..5cf67d9 100644 --- a/src/xkbcomp/action.h +++ b/src/xkbcomp/action.h @@ -68,7 +68,7 @@ typedef struct _ActionInfo { extern int HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, - struct xkb_any_action *action, + union xkb_action *action, ActionInfo *info); extern int diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 1fbf2b1..b00f64a 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -158,8 +158,6 @@ ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info) static void InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id) { - unsigned int i; - info->keymap = keymap; info->name = NULL; info->file_id = file_id; @@ -172,9 +170,8 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id) info->dflt.merge = MERGE_OVERRIDE; info->dflt.interp.flags = 0; info->dflt.interp.virtual_mod = XkbNoModifier; + memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act)); info->dflt.interp.act.type = XkbSA_NoAction; - for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++) - info->dflt.interp.act.any.data[i] = 0; ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt); info->ledDflt.file_id = file_id; info->ledDflt.defined = 0; @@ -188,7 +185,6 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id) static void ClearCompatInfo(CompatInfo *info) { - unsigned int i; ActionInfo *next_act; SymInterpInfo *si, *next_si; LEDInfo *led, *next_led; @@ -200,9 +196,8 @@ ClearCompatInfo(CompatInfo *info) info->dflt.merge = MERGE_AUGMENT; info->dflt.interp.flags = 0; info->dflt.interp.virtual_mod = XkbNoModifier; + memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act)); info->dflt.interp.act.type = XkbSA_NoAction; - for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++) - info->dflt.interp.act.any.data[i] = 0; ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt); info->nInterps = 0; list_foreach_safe(si, next_si, &info->interps, entry) @@ -640,7 +635,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, if (arrayNdx) return ReportSINotArray(info, si, field); - if (!HandleActionDef(value, keymap, &si->interp.act.any, info->act)) + if (!HandleActionDef(value, keymap, &si->interp.act, info->act)) return false; si->defined |= SI_FIELD_ACTION; diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 5993a9a..7574520 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -925,7 +925,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, xkb_group_index_t ndx; size_t nActs; ExprDef *act; - struct xkb_any_action *toAct; + union xkb_action *toAct; if (!GetGroupIndex(info, keyi, arrayNdx, ACTIONS, &ndx)) return false; @@ -970,7 +970,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } keyi->actsDefined |= (1 << ndx); - toAct = (struct xkb_any_action *) darray_mem(keyi->acts[ndx], 0); + toAct = darray_mem(keyi->acts[ndx], 0); act = value->value.child; for (i = 0; i < nActs; i++, toAct++) { if (!HandleActionDef(act, info->keymap, toAct, info->action)) { commit 600caac33ade86607372e9cb326fe14c8c2b25d6 Author: Ran Benita <ran...@gmail.com> Date: Fri Aug 10 22:06:12 2012 +0300 Remove XkbKeyTypeIndex and widen index type We don't need the macro, and using char for the kt_index is imaginably too small. Signed-off-by: Ran Benita <ran...@gmail.com> diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 7593068..f04f6cc 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -677,12 +677,12 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (key->explicit & XkbExplicitKeyTypesMask) { bool multi_type = false; - int type = XkbKeyTypeIndex(key, 0); + struct xkb_key_type *type = XkbKeyType(keymap, key, 0); simple = false; - for (group = 0; group < key->num_groups; group++) { - if (XkbKeyTypeIndex(key, group) != type) { + for (group = 1; group < key->num_groups; group++) { + if (XkbKeyType(keymap, key, group) != type) { multi_type = true; break; } @@ -692,17 +692,15 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) for (group = 0; group < key->num_groups; group++) { if (!(key->explicit & (1 << group))) continue; - type = XkbKeyTypeIndex(key, group); + type = XkbKeyType(keymap, key, group); write_buf(buf, "\n\t\t\ttype[group%u]= \"%s\",", group + 1, - xkb_atom_text(keymap->ctx, - keymap->types[type].name)); + xkb_atom_text(keymap->ctx, type->name)); } } else { write_buf(buf, "\n\t\t\ttype= \"%s\",", - xkb_atom_text(keymap->ctx, - keymap->types[type].name)); + xkb_atom_text(keymap->ctx, type->name)); } } diff --git a/src/xkb-priv.h b/src/xkb-priv.h index 630760a..f53805f 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -323,7 +323,7 @@ struct xkb_key { union xkb_action *actions; - unsigned char kt_index[XkbNumKbdGroups]; + unsigned kt_index[XkbNumKbdGroups]; xkb_group_index_t num_groups; /* How many levels the largest group has. */ @@ -396,17 +396,11 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, struct xkb_key *key) #define xkb_foreach_key(iter, keymap) \ xkb_foreach_key_from(iter, keymap, keymap->min_key_code) -static inline unsigned char -XkbKeyTypeIndex(struct xkb_key *key, xkb_group_index_t group) -{ - return key->kt_index[group & 0x3]; -} - static inline struct xkb_key_type * XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key, xkb_group_index_t group) { - return &keymap->types[XkbKeyTypeIndex(key, group)]; + return &keymap->types[key->kt_index[group]]; } static inline xkb_level_index_t commit 87dff888abd107541bf232258793d0bcb162b37d Author: Ran Benita <ran...@gmail.com> Date: Fri Aug 10 18:14:35 2012 +0300 Store actions inside struct xkb_key Cuts out a lot of useless redirection and space. Signed-off-by: Ran Benita <ran...@gmail.com> diff --git a/src/keymap-dump.c b/src/keymap-dump.c index f1d11bd..7593068 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -732,7 +732,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) } if (key->explicit & XkbExplicitInterpretMask) - showActions = XkbKeyHasActions(key); + showActions = (key->actions != NULL); else showActions = false; @@ -746,10 +746,8 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) write_buf(buf, " ] };\n"); } else { - union xkb_action *acts; - int level; + xkb_level_index_t level; - acts = XkbKeyActionsPtr(keymap, key); for (group = 0; group < key->num_groups; group++) { if (group != 0) write_buf(buf, ","); @@ -765,10 +763,11 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) level++) { if (level != 0) write_buf(buf, ", "); - write_action(keymap, buf, &acts[level], NULL, NULL); + write_action(keymap, buf, + XkbKeyActionEntry(key, group, level), + NULL, NULL); } write_buf(buf, " ]"); - acts += key->width; } } write_buf(buf, "\n\t\t};\n"); diff --git a/src/state.c b/src/state.c index 758bbf7..c77365b 100644 --- a/src/state.c +++ b/src/state.c @@ -118,7 +118,7 @@ xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc) if (XkbKeycodeInRange(state->keymap, kc)) key = XkbKey(state->keymap, kc); - if (!key || !XkbKeyHasActions(key)) + if (!key || !key->actions) return &fake; -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1t254j-0001ab...@vasks.debian.org