summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2012-09-02xkbcomp: clean up compile_keymap functionRan Benita5-130/+91
We make the xkb_file_type enum sequential instead of masks, and then we don't have to repeat the file types several times in the function. Makes the code cleaner. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02map, state: check for KeycodeInRange only in API functionsRan Benita2-23/+15
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02state: fix mod_names_are_activeRan Benita2-4/+12
This function was always returning -1. Adding a test, we see that test/state.c treat the is_active functions as returning booleans, which would treat -1 as success, so we test for > 0 instead (most users would probably get this wrong as well...). Also update the documentation for the are_active functions, and add a ATTR_NULL_SENTINEL for gcc __attribute__((sentinel)). Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02state: fix type confusion within xkb_state_update_maskRan Benita1-9/+12
idx should be xkb_mod_index_t, while mod is the mask. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02state: remove unneeded optimizationRan Benita1-3/+0
The code that follows does exactly that. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02state: light indicator when either condition is satisfiedRan Benita1-4/+4
For the indicator to be set, it is sufficient for at least one of the group, modifier, or control state to match; this is in line with the xkblib spec, section 8.2 and ComputeAutoState() in xserver/xkb/xkbLEDs.c (though the xserver implementation differs from the spec on some points...). This also adds a tiny optimization to skip the entire check if the mask is empty. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02state: fix led_update_all group mask calculationRan Benita1-4/+4
The one above uses which_mods, this one should use which_groups. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02keycodes: remove outdated commentsRan Benita1-56/+7
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02keycodes: use darray for aliases instead of listRan Benita1-78/+37
Uses slightly more memory, but worth it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02keycodes: use array for indicator names instead of listRan Benita1-85/+48
Using a simple array here to mirror keymap->indicator_names makes much more sense, and is simpler. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02keycodes: ignore "virtual" in indicatorsRan Benita1-65/+41
The distinction between real/virtual indicators is useless for us, we can just ignore it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02symbols: call deinit functions Clear instead of FreeRan Benita1-10/+9
Everywhere else Free is reserved for when the argument is free'd as well. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02symbols: remove comparison of unsigned >= 0Ran Benita1-1/+1
clang warning. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02vmod: remove outdated commentsRan Benita2-36/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02vmod: ClearVModInfo doesn't need the keymapRan Benita3-12/+10
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02vmod: remove useless keymap initializationRan Benita1-3/+0
keymap->vmods is not touched until UpdateModifiersFromCompat, where it initialized and used. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02vmod: remove support for resolving integer to virtual modifierRan Benita2-23/+28
This is only relevant to the virtualModifier= statement in interpret statements in xkb_compat. The current code allows to write e.g. virtualModifier = 4 to get the virtual modifier whose index happens to be 4 (possibly declared in other files or sections, i.e. xkb_types). Doing this is undeterministic, will break without notice, and not used anywhere. Don't allow it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02expr: move op_type/value_type_to_string functions to astRan Benita10-119/+83
Generally the enum-to-string function should appear where the enum is defined. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02vmod: remove support for direct vmod -> real mod mappingRan Benita1-45/+6
The current code supports statements such as: virtual_modifiers NumLock = Mod2; This would set the mapping from the NumLock vmod to the Mod2 real mod directly, without going through the virtualModifier field in an interpret statement (in xkb_compat) or vmods field in a key statement (in xkb_symbols). This is undocumented, unused and complicates things, so remove it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02xkbcomp: seperate keymap-copying code from Compile functionsRan Benita3-72/+87
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02compat: only compute 'bool report' onceRan Benita1-22/+24
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02compat: disallow changing global defaults from within an interpretRan Benita1-3/+6
It's currently possible to write something like this: interpret Num_Lock+Any { virtualModifier = NumLock; action = LockMods(modifiers=NumLock); !indicator.allowExplicit; }; The final statement has the same effect as writing it in the global file scope, which changes the default indicator (which all subsequent indicators start off as). This very strange and also unused; if someone does it he probably expects it to affect only the local scope, and he might then get unexpected behavior. So don't allow it. Also, HandleInterpVar is clearly a misnomer (as it can also change indicator defaults) so rename it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02compat: use darray instead of list for interpsRan Benita1-41/+9
No need for a list here. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02compat: remove "flags" field from xkb_indicator_mapRan Benita3-7/+3
We don't set this field any more. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: ignore "allowExplicit" in indicator statementsRan Benita1-21/+3
Using !allowExplicit sets the XkbIM_NoExplicit flag of the indicator, which means that an XKB client cannot change the state of the indicator using e.g. XkbSetNamedIndicator(). We do not support changing the state of an indicator; furthermore doing it is probably only useful in conjunction with led-drives-keyboard behavior, which we also do not support. This is because setting an indicator without led-drives-keyboard would make the indicator and the modifier/group it's bound to to get out of sync. We can re-add this if we need this info. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: ignore "ledDrivesKbd" in indicator statementsRan Benita1-21/+3
We don't support it, as mentioned in the README, so we should stop processing it and print a message about it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: ignore "group" (compatibility) statementsRan Benita5-106/+14
Group compatibility statements are like the following: group 3 = AltGr; This currently results in: keymap->groups[2].mask = <real mod mapped from AltGr vmod> And we don't do any thing with this value later. The reason it exists in XKB is to support non-XKB clients (i.e. XKB support disabled entirely in the server), which do not know the concept of "group", and use some modifier to distinguish between the first and second keyboard layouts (usually with the AltGr key). We don't care about all of that, so we can forget about it. One artifact of this removal is that xkb_map_num_groups no longer works, because it counted through keymap->groups (this wasn't entirely correct BTW). Instead we add a new num_groups member to the keymap, which just hold the maximum among the xkb_key's num_groups. This also means we don't have to compute anything just to get the number of groups. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: get rid of BindIndicatorsRan Benita1-115/+49
Now that 1fba6189e67 removed support for binding indicator maps by index instead of name, we can remove some more magic which happens now: if an indicator map specifies an indicator name which was not previously declared in a 'indicator 5 = "Caps Lock"'-like statement in xkb_keycodes, we can just look at the next free index and assign it. This also allows us to use a darray for the LEDInfo's instead of a list. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: ignore "index" field in indicator statementsRan Benita1-31/+9
The current code allows to set the "index" field in an indicator statment's body. This would bind the indicator to the specified index, instead of by name (which was declared previously in xkb_keycodes). Doing this is a bad idea, for the same reasons as in 3cd9704, and is also happily not used anywhere. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: remove dead NoAutomatic codeRan Benita1-8/+1
The xkblib spec, table 7.1 (indicators), says: XkbIM_NoAutomatic: Xkb does not automatically change the value of the indicator based upon a change in the keyboard state, regardless of the values for the other fields of the indicator map. xkbcomp (the real one) never actually implemented a way for an indicator statement to set this flag, so it's just dead unused code. We definitely don't want to implement it ourselves, so remove any mention of it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: ignore "locking" field in sym interpretsRan Benita2-25/+4
This field is used in conjunction with key behaviors, which we don't support since c1ea23da5. This is also unused in xkeyboard-config. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: small changesRan Benita3-125/+127
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01compat: add general overviewRan Benita1-0/+104
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01action: convert action field type to enumRan Benita3-155/+200
We can also hide the ActionInfo definition inside action.c. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01types: add "Effects on keymap" to overviewRan Benita2-2/+11
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01Organize xkbcomp/ header filesRan Benita25-382/+438
Various non-functional changes: - Re-add keycodes.h and move some stuff there. - Add parser-priv.h for internal bison/flex stuff. - Don't include headers from other headers, such that file dependencies are immediate in each file. - Rename xkbcomp.h -> ast.h, parseutils.{c,h} -> ast-build.{c,h} - Rename path.{c,h} -> include.{c,h} - Rename keytypes.c -> types.c - Make the naming of XkbFile-related functions more consistent. - Move xkb_map_{new,ref,unref} to map.c. - Remove most extern keyword from function declarations, it's just noise (XKB_EXPORT is what's important here). - Append XKBCOMP_ to include guards. - Shuffle some code around to make all of this work. Splitting this would be a headache.. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01Allocate xkb_component_names on stackRan Benita3-46/+45
Instead of malloc'ing it as well. Also improve the error handling. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01Move ISEMPTY to utils.hRan Benita2-5/+9
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-11Move 'no symbols defined for ...' message to a warningDaniel Stone1-1/+1
Shut up shut up shut up shut up shut up shut up. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-10Combine a couple of macrosRan Benita1-14/+2
Easier to see what it does without the trivial macros. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10action: get rid of xkb_any_actionRan Benita6-82/+63
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 <ran234@gmail.com>
2012-08-10Remove XkbKeyTypeIndex and widen index typeRan Benita2-16/+8
We don't need the macro, and using char for the kt_index is imaginably too small. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10Store actions inside struct xkb_keyRan Benita8-114/+37
Cuts out a lot of useless redirection and space. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10keycodes: save context in Info, not keymapRan Benita4-73/+58
We don't need the keymap in this case, just makes things more verbose. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10Remove xkbcomp/misc.cRan Benita3-160/+132
The KeyName functions are more appropriate in keycodes.c. The ProcessIncludeFile can go to path.c along with the other functions dealing with includes. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10Remove left over keycodes.hRan Benita1-45/+0
For some reason we still track this file in git even though we don't use it any more. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10Remove AutoKeyNames featureRan Benita6-34/+8
If this keymap flag is set, whenever a key name appears in one of the sections which does not exist (i.e. has not been declared in keycodes), it finds the first unused keycode and attaches it that name. This might have been useful when you could compile the symbols section or geometry section without a keycodes section, but we don't support this anymore. It's also pretty useless for any real work, because the user has no way of knowing the keycode and so it will never be used. Finally the only obscure way left to set this flag is by including a keycodes file called "computed". Just remove it. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10map: share some codeRan Benita1-57/+41
Make more extensive use of get_entry_for_key_state, and add key_get_consumed to use in the other consume functions. There's also a slight change in the consumed mods calculations, where we use entry->mods.mask instead of type->mods.mask. The original was copied from what libX11 does but what we do now is more logically correct. The result is exactly the same though because: type->mods.mask ⊇ entry->mods.mask ⊇ entry->preserve.mask Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10Use XKB_{GROUP,LEVEL}_INVALID instead of -1 for errorsRan Benita3-9/+26
The group/level types are unsigned, so it's odd to return -1 for them. Instead use their invalid values (which happen to be == -1). Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-10state: use global static const for fake actionRan Benita1-13/+11
Requires constifying some arguments. Signed-off-by: Ran Benita <ran234@gmail.com>