platform/upstream/libxkbcommon.git
12 years agoexpr: drop ExprResult from ResolveButton
Ran Benita [Mon, 23 Jul 2012 22:22:26 +0000 (01:22 +0300)]
expr: drop ExprResult from ResolveButton

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveLevel
Ran Benita [Mon, 23 Jul 2012 21:51:19 +0000 (00:51 +0300)]
expr: drop ExprResult from ResolveLevel

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveKeyCode
Ran Benita [Mon, 23 Jul 2012 21:23:34 +0000 (00:23 +0300)]
expr: drop ExprResult from ResolveKeyCode

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveGroup
Ran Benita [Mon, 23 Jul 2012 21:10:07 +0000 (00:10 +0300)]
expr: drop ExprResult from ResolveGroup

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveKeysym
Ran Benita [Mon, 23 Jul 2012 20:56:28 +0000 (23:56 +0300)]
expr: drop ExprResult from ResolveKeysym

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveBoolean
Ran Benita [Mon, 23 Jul 2012 16:52:17 +0000 (19:52 +0300)]
expr: drop ExprResult from ResolveBoolean

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveString
Ran Benita [Mon, 23 Jul 2012 12:46:50 +0000 (15:46 +0300)]
expr: drop ExprResult from ResolveString

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveLhs
Ran Benita [Mon, 23 Jul 2012 09:20:05 +0000 (12:20 +0300)]
expr: drop ExprResult from ResolveLhs

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: drop ExprResult from ResolveKeyName
Ran Benita [Mon, 23 Jul 2012 08:56:13 +0000 (11:56 +0300)]
expr: drop ExprResult from ResolveKeyName

Explicit is better than implicit, and this union makes it hard to follow
what's what, particularly the confusion with ival/uval.
The other Resolve functions will follow.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoparser: untabify
Ran Benita [Wed, 25 Jul 2012 18:37:20 +0000 (21:37 +0300)]
parser: untabify

Run vim's :%retab and some resulting indention fixes.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoConvert defines to enums in xkbcomp.h
Ran Benita [Wed, 25 Jul 2012 14:29:08 +0000 (17:29 +0300)]
Convert defines to enums in xkbcomp.h

For statement / expression types.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix incorrect comparison
Ran Benita [Thu, 26 Jul 2012 22:47:32 +0000 (01:47 +0300)]
Fix incorrect comparison

ExprFieldRef goes into the ExprDef op field, not the type field.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoutils: add/replace string equality macros
Ran Benita [Tue, 24 Jul 2012 16:54:14 +0000 (19:54 +0300)]
utils: add/replace string equality macros

It's more tidy and less error prone, since we use strcasecmp == 0 a lot.
We replace strcmp == 0 by streq, strcasecmp == 0 by istreq,
uStrCasePrefix by istreq_prefix and uDupString by strdup_safe.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoDrop Xkbc prefix of text functions
Ran Benita [Tue, 24 Jul 2012 10:24:59 +0000 (13:24 +0300)]
Drop Xkbc prefix of text functions

Not really needed and inconsistent.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoUse xkb_mod_mask_t and xkb_mask_index_t throughout
Ran Benita [Tue, 24 Jul 2012 10:15:40 +0000 (13:15 +0300)]
Use xkb_mod_mask_t and xkb_mask_index_t throughout

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove alloc.{c,h}
Ran Benita [Mon, 23 Jul 2012 18:30:28 +0000 (21:30 +0300)]
Remove alloc.{c,h}

These functions are more appropriate elsewhere now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoscanner: don't strdup key names
Ran Benita [Mon, 23 Jul 2012 14:41:55 +0000 (17:41 +0300)]
scanner: don't strdup key names

The key name is always XkbKeyNameLength (= 4) bytes, so we can maintain
it directly in YYSTYPE union and copy when needed, instead of treating
it like a full blown string and then copy. This means the scanner
checks the length itself.

rulescomp under valgrind, before:
==1038==   total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated
after:
==9377==   total heap usage: 155,643 allocs, 155,643 frees, 9,672,788 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoSome atom related optimizations
Ran Benita [Mon, 23 Jul 2012 13:03:34 +0000 (16:03 +0300)]
Some atom related optimizations

We often get a strdup'd string, just to pass it over the atom_intern and
then immediately free it. But atom_intern then strdup's it again (if
it's not interned already); so instead we can have the interning "steal"
the memory instead of allocing a new one and freeing the old one. This
is done by a new xkb_atom_steal function.

It also turns out, that every time we strdup an atom, we don't actually
modify it afterwards. Since we are guaranteed that the atom table will
live as long as the context, we can just use xkb_atom_text instead. This
removes a some more dynamic allocations.

For this change we had to remove the ability to append two strings, e.g.
    "foo" + "bar" -> "foobar"
which is only possible with string literals. This is unused and quite
useless for our purposes.

xkb_atom_strdup is left unused, as it may still be useful.

Running rulescomp in valgrind, Before:
==7907== total heap usage: 173,698 allocs, 173,698 frees, 9,775,973 bytes allocated
After:
==6348== total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: don't divide by zero
Ran Benita [Mon, 23 Jul 2012 18:21:03 +0000 (21:21 +0300)]
expr: don't divide by zero

Calculator parser 101.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: fix canonical types copying
Ran Benita [Mon, 23 Jul 2012 18:18:18 +0000 (21:18 +0300)]
types: fix canonical types copying

Without the re-initialization, the copying fails. This wasn't noticed
because this code practically never gets executed with ordinary keymaps.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: fix valgrind warnings
Ran Benita [Mon, 23 Jul 2012 13:22:20 +0000 (16:22 +0300)]
keycodes: fix valgrind warnings

==7071== Conditional jump or move depends on uninitialised value(s)
==7071==    at 0x40B6CB: AddIndicatorName (keycodes.c:148)
==7071==    by 0x40C34F: MergeIncludedKeycodes (keycodes.c:420)
==7071==    by 0x40C613: HandleIncludeKeycodes (keycodes.c:480)
==7071==    by 0x40D022: HandleKeycodesFile (keycodes.c:733)
==7071==    by 0x40D79F: CompileKeycodes (keycodes.c:881)
==7071==    by 0x401E22: compile_keymap (xkbcomp.c:157)
==7071==    by 0x402091: xkb_map_new_from_kccgst (xkbcomp.c:229)
==7071==    by 0x40216A: xkb_map_new_from_names (xkbcomp.c:254)
==7071==    by 0x4046F5: test_compile_rules (common.c:164)
==7071==    by 0x4015C1: test_rmlvo (rulescomp.c:44)
==7071==    by 0x40180D: main (rulescomp.c:98)

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoparse: remove unused #define
Ran Benita [Mon, 23 Jul 2012 08:25:32 +0000 (11:25 +0300)]
parse: remove unused #define

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: Remove ExprResolveFloat
Ran Benita [Mon, 23 Jul 2012 08:42:22 +0000 (11:42 +0300)]
expr: Remove ExprResolveFloat

Remnant from geometry.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agomakekeys: Add top_srcdir to include path
Daniel Stone [Mon, 23 Jul 2012 22:10:07 +0000 (23:10 +0100)]
makekeys: Add top_srcdir to include path

Fixes distcheck with no /usr/include/xkbcommon.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd test for logging functionality
Ran Benita [Sun, 22 Jul 2012 16:38:14 +0000 (19:38 +0300)]
Add test for logging functionality

Just to make sure everything works properly.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove old logging leftovers
Ran Benita [Sat, 21 Jul 2012 13:10:17 +0000 (16:10 +0300)]
Remove old logging leftovers

Everything has been converted.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoxkbcomp: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:39:18 +0000 (15:39 +0300)]
xkbcomp: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoparse: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:44:48 +0000 (15:44 +0300)]
parse: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agopath: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:37:33 +0000 (15:37 +0300)]
path: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agomisc: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:35:17 +0000 (15:35 +0300)]
misc: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agovmod: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:27:09 +0000 (15:27 +0300)]
vmod: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:19:27 +0000 (15:19 +0300)]
rules: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoexpr: use new log functions
Ran Benita [Sat, 21 Jul 2012 12:12:31 +0000 (15:12 +0300)]
expr: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoaction: use new log functions
Ran Benita [Sat, 21 Jul 2012 11:53:49 +0000 (14:53 +0300)]
action: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: use new log functions
Ran Benita [Fri, 20 Jul 2012 23:08:14 +0000 (02:08 +0300)]
types: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: add keymap to KeyTypesInfo
Ran Benita [Fri, 20 Jul 2012 23:03:25 +0000 (02:03 +0300)]
types: add keymap to KeyTypesInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompat: use new log functions
Ran Benita [Fri, 20 Jul 2012 22:35:46 +0000 (01:35 +0300)]
compat: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompat: add keymap to CompatInfo
Ran Benita [Fri, 20 Jul 2012 22:31:10 +0000 (01:31 +0300)]
compat: add keymap to CompatInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use new log functions
Ran Benita [Fri, 20 Jul 2012 21:58:25 +0000 (00:58 +0300)]
symbols: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: add keymap to SymbolsInfo
Ran Benita [Fri, 20 Jul 2012 21:50:18 +0000 (00:50 +0300)]
symbols: add keymap to SymbolsInfo

and use it. Also make sure info is the first argument to the functions
in this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: use new log functions
Ran Benita [Fri, 20 Jul 2012 16:38:36 +0000 (19:38 +0300)]
keycodes: use new log functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: add keymap to KeyNamesInfo
Ran Benita [Fri, 20 Jul 2012 15:27:37 +0000 (18:27 +0300)]
keycodes: add keymap to KeyNamesInfo

and let the info always be the first argument to the various functions,
just for consistency (and it acting as the contex for this file).

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoAdd logging API
Ran Benita [Fri, 20 Jul 2012 10:10:13 +0000 (13:10 +0300)]
Add logging API

Add new public API to provide the library users with some options to
control and customize the logging output from the library. It is based
upon the skeleton from the libabc demo libray:
https://git.kernel.org/?p=linux/kernel/git/kay/libabc.git
which is public domain and works pretty well.

This requires passing in the context object in every logging call, and
thus the conversion is done file by file. We also remove the global
warningLevel variable in favor of a verbosity level in the context,
which can be set by the user and is silent by default.

One issue is the ACTION calls, which, while nice, do not play very well
with line- and priority-based logging, and would require some
line continuation handling or keeping state or some other compromise. So
instead remove these and just inline them with their respective
warning/error. So instead of:
    ERROR("Memory allocation failed\n")
    ACTION("Removing all files on hardisk\n")
its something like that:
    log_err("Memory allocation failed; Removing all files on harddisk\n")

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoutils: replace FATAL by malloc_or_die
Ran Benita [Fri, 20 Jul 2012 14:20:35 +0000 (17:20 +0300)]
utils: replace FATAL by malloc_or_die

"Out of memory" is enough in this case. If we want to be OOM-safe this
makes it clear where to begin.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoutils: remove Xfuncproto.h and use our own macros
Ran Benita [Fri, 20 Jul 2012 14:09:49 +0000 (17:09 +0300)]
utils: remove Xfuncproto.h and use our own macros

Add XKB_EXPORT to replace _X_EXPORT, and copy the definitions of
_X_ATTRIBUTE_FOO as ATTR_FOO.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoutils: remove uTypedAlloc/Calloc
Ran Benita [Fri, 20 Jul 2012 10:07:30 +0000 (13:07 +0300)]
utils: remove uTypedAlloc/Calloc

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agobuild: drop the include/ directory
Ran Benita [Sun, 22 Jul 2012 21:41:27 +0000 (00:41 +0300)]
build: drop the include/ directory

The include/ dir is somewhat redundant and makes it just a bit harder to
handle the -I directives from out side of automake; without it the
default $(top_buildir) just works.
Here's also some further justifications I found:
http://smcv.pseudorandom.co.uk/2008/09/pc-uninstalled/

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix bison 2.6 and clang warnings
Ran Benita [Fri, 20 Jul 2012 09:48:13 +0000 (12:48 +0300)]
Fix bison 2.6 and clang warnings

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove CommonInfo
Ran Benita [Tue, 17 Jul 2012 14:08:14 +0000 (17:08 +0300)]
Remove CommonInfo

Not used by anything anymore.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: use list instead of CommonInfo for KeyTypeInfo
Ran Benita [Tue, 17 Jul 2012 14:05:28 +0000 (17:05 +0300)]
types: use list instead of CommonInfo for KeyTypeInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoSimplify HandleInclude functions
Ran Benita [Wed, 18 Jul 2012 14:53:27 +0000 (17:53 +0300)]
Simplify HandleInclude functions

Instead of special casing the first include, process it inside the loop
as well. It works perfectly fine.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove haveSelf include feature
Ran Benita [Wed, 18 Jul 2012 13:30:55 +0000 (16:30 +0300)]
Remove haveSelf include feature

When including a file from another file, its possible to do something
like this:
    include "+some(other)+files"
with the "+" or "|" in the beginning. What will happen then is that
instead of processing the include files separately and then merging into
the existing info, we instead start with the existing info and merge
into it as we go, as if it was written explicitly before the first "+".

It's not particulary clear what this may be useful for. Since it's not
used by xkeyboard-config, not documented anywhere (and google doesn't
bring up anything), completely untested and kind of ugly, remove this
"feature". It most likely never been used.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: use list instead of CommonInfo in PreserveInfo
Ran Benita [Tue, 17 Jul 2012 12:50:24 +0000 (15:50 +0300)]
types: use list instead of CommonInfo in PreserveInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotypes: move global static tok_ atoms into KeyTypesInfo
Ran Benita [Tue, 17 Jul 2012 12:39:27 +0000 (15:39 +0300)]
types: move global static tok_ atoms into KeyTypesInfo

The atoms are context-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompat: use list instead of CommonInfo in LEDInfo
Ran Benita [Mon, 16 Jul 2012 21:53:07 +0000 (00:53 +0300)]
compat: use list instead of CommonInfo in LEDInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoUse xkb_group_index_t for group variables throughout
Ran Benita [Tue, 17 Jul 2012 08:03:43 +0000 (11:03 +0300)]
Use xkb_group_index_t for group variables throughout

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove _X_EXPORT from xkb_key_get_group/level
Ran Benita [Tue, 17 Jul 2012 08:56:00 +0000 (11:56 +0300)]
Remove _X_EXPORT from xkb_key_get_group/level

We should add them to xkbcommon.h if they need to.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompat: use list instead of CommonInfo in SymInterpInfo
Ran Benita [Mon, 16 Jul 2012 21:43:59 +0000 (00:43 +0300)]
compat: use list instead of CommonInfo in SymInterpInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove indicators.c code into compat.c
Ran Benita [Mon, 16 Jul 2012 19:45:16 +0000 (22:45 +0300)]
Move indicators.c code into compat.c

It is only used there. Allows some refactoring.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoConvert macros to inline functions
Ran Benita [Mon, 16 Jul 2012 19:15:43 +0000 (22:15 +0300)]
Convert macros to inline functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: use list instead of CommonInfo in IndicatorNameInfo
Ran Benita [Mon, 16 Jul 2012 18:28:25 +0000 (21:28 +0300)]
keycodes: use list instead of CommonInfo in IndicatorNameInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: use list instead of CommonInfo in AliasInfo
Ran Benita [Mon, 16 Jul 2012 18:25:00 +0000 (21:25 +0300)]
keycodes: use list instead of CommonInfo in AliasInfo

Always pass around the KeyNamesInfo which contains the list head.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove alias.c functions into keycodes.c
Ran Benita [Mon, 16 Jul 2012 14:53:46 +0000 (17:53 +0300)]
Move alias.c functions into keycodes.c

They are only used in this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: don't use CommonInfo in KeyInfo
Ran Benita [Mon, 16 Jul 2012 08:24:48 +0000 (11:24 +0300)]
symbols: don't use CommonInfo in KeyInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use list for ModMapEntry's
Ran Benita [Mon, 16 Jul 2012 08:09:03 +0000 (11:09 +0300)]
symbols: use list for ModMapEntry's

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoAdd common linked list implementation
Ran Benita [Mon, 16 Jul 2012 08:06:33 +0000 (11:06 +0300)]
Add common linked list implementation

Taken from xserver/include/list.h. The changes made are:
* Drop the xorg_ prefix and some typedef from the end.
* Rename _for_each_entry macros to just _foreach (like darray).
* Rename list_is_empty to list_empty (like darray).
* Add a list_replace function which we use later.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: remove alias info
Ran Benita [Mon, 16 Jul 2012 07:15:53 +0000 (10:15 +0300)]
symbols: remove alias info

It's never used - all of the aliases are added in the keycodes section.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoPass around xkb_key's instead of keycodes
Ran Benita [Sun, 15 Jul 2012 12:55:34 +0000 (15:55 +0300)]
Pass around xkb_key's instead of keycodes

This way we don't need to look up the key every time. We now only deal
with keycodes in the public API and in keycodes.c.

Also adds an xkb_foreach_key macro, which is used a lot.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agomap: verifiy that the keycode is legal
Ran Benita [Sun, 15 Jul 2012 11:35:57 +0000 (14:35 +0300)]
map: verifiy that the keycode is legal

In case someone passes in a bad keycode.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove redundant keymap->keys resizes
Ran Benita [Sun, 15 Jul 2012 11:24:54 +0000 (14:24 +0300)]
Remove redundant keymap->keys resizes

The size (i.e. max_keycode) is determined in the keycodes section, which
gets compiled first.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove GroupsWidth macro
Ran Benita [Sun, 15 Jul 2012 11:02:36 +0000 (14:02 +0300)]
Remove GroupsWidth macro

Use key->width directly instead.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove unused 'groupInfo' in KeyTypeInfo
Ran Benita [Tue, 17 Jul 2012 08:51:32 +0000 (11:51 +0300)]
Remove unused 'groupInfo' in KeyTypeInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of group_info
Ran Benita [Sun, 15 Jul 2012 10:51:34 +0000 (13:51 +0300)]
Get rid of group_info

This is 8 bits which hold how many groups the key has, what to do the
key group is out of bound and the group to redirect to if want to. This
may save a few bytes, but is really annoying. So instead, just lay out
the fields separately. We can optimize later in a sane way, with pahole,
bitfields, etc. if we want.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of struct xkb_sym_map
Ran Benita [Sun, 15 Jul 2012 10:15:33 +0000 (13:15 +0300)]
Get rid of struct xkb_sym_map

Past its usefulness; put the stuff directly in xkb_key.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of struct xkb_key_name
Ran Benita [Sun, 15 Jul 2012 10:00:04 +0000 (13:00 +0300)]
Get rid of struct xkb_key_name

Just embed it directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoAdd common xkb_key struct
Ran Benita [Sun, 15 Jul 2012 07:38:05 +0000 (10:38 +0300)]
Add common xkb_key struct

Instead of having a million arrays from the keycode to various
key-specific info in the keymap, add a single struct xkb_key to hold all
of the data for the key in one object. This way we can pass it around,
do some refactoring and make the code simpler. It's also nice to see
everything in one place.

The keys array is still indexed by keycode, which is suboptimal because
there may be a lot of holes (i.e. unused keycodes between min_key_code
and max_key_code). By the end of this series it would be abstracted
enough to replace it by a hash table or similar if there's ever a need.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoReplace KeyInfo 'key' variable name by 'keyi'
Ran Benita [Sun, 15 Jul 2012 09:48:11 +0000 (12:48 +0300)]
Replace KeyInfo 'key' variable name by 'keyi'

We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoReplace xkb_keycode_t 'key' variable name by 'kc'
Ran Benita [Sun, 15 Jul 2012 08:52:54 +0000 (11:52 +0300)]
Replace xkb_keycode_t 'key' variable name by 'kc'

We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoConvert indecipherable macros to inline functions
Ran Benita [Sun, 15 Jul 2012 08:37:54 +0000 (11:37 +0300)]
Convert indecipherable macros to inline functions

This was fun.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: split initialization code from CompileSymbols
Ran Benita [Sat, 14 Jul 2012 22:59:01 +0000 (01:59 +0300)]
symbols: split initialization code from CompileSymbols

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove per_key_repeats and enabled_ctrls to keymap
Ran Benita [Sat, 14 Jul 2012 22:45:34 +0000 (01:45 +0300)]
Move per_key_repeats and enabled_ctrls to keymap

All of the per-key data and global flags are now visible directly in the
keymap.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of xkb_key_names
Ran Benita [Sat, 14 Jul 2012 22:31:34 +0000 (01:31 +0300)]
Get rid of xkb_key_names

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of xkb_indicator
Ran Benita [Sat, 14 Jul 2012 21:46:31 +0000 (00:46 +0300)]
Get rid of xkb_indicator

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of xkb_compat_map
Ran Benita [Sat, 14 Jul 2012 21:39:15 +0000 (00:39 +0300)]
Get rid of xkb_compat_map

Same as xkb_{client,server}_map which were already removed.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of xkb_server_map
Ran Benita [Sat, 14 Jul 2012 21:26:28 +0000 (00:26 +0300)]
Get rid of xkb_server_map

Same as xkb_client_map which was removed before.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoGet rid of xkb_client_map
Ran Benita [Sat, 14 Jul 2012 21:06:11 +0000 (00:06 +0300)]
Get rid of xkb_client_map

We don't make this distinction anymore, and the separate allocations
just make it harder to reason about. Since we require that all of
symbols, types, compat etc. be present, we should just put stuff
directly in the keymap struct.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRun source tree through uncrustify
Daniel Stone [Tue, 17 Jul 2012 09:20:15 +0000 (10:20 +0100)]
Run source tree through uncrustify

.uncrustify.cfg committed for future reference also, but had to manually
fix up a few things: it really likes justifying struct initialisers.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoFix typo in out of range group calculation
Ran Benita [Sun, 15 Jul 2012 14:35:35 +0000 (17:35 +0300)]
Fix typo in out of range group calculation

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove unused control num_groups
Ran Benita [Sat, 14 Jul 2012 16:53:13 +0000 (19:53 +0300)]
Remove unused control num_groups

We have xkb_map_num_groups for that.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoConvert missed enum merge_mode variables
Ran Benita [Sat, 14 Jul 2012 12:14:44 +0000 (15:14 +0300)]
Convert missed enum merge_mode variables

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix fileID mess
Ran Benita [Sat, 14 Jul 2012 12:19:12 +0000 (15:19 +0300)]
Fix fileID mess

A few problems here:
* In e.g. keycodes.c the fileID field of the Info struct was never
  initialized to the id of the appropriate file, so it was always 0.
  There's some code which uses it, mostly for warnings.
* Some of the fileID fields were unsigned char, which overflows several
  times, seeing as the ID in some of our tests can get > 1000 (because
  we reuse the context).
* Some sign mismatches.
* fileID vs file_id.

Hopefully this fixes everything. I doubt this stuff had ever worked as
intended, in xkbcomp or otherwise.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agopath: fix error message
Ran Benita [Sat, 14 Jul 2012 09:37:25 +0000 (12:37 +0300)]
path: fix error message

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMake compile_keymap a little nicer
Ran Benita [Fri, 13 Jul 2012 22:12:50 +0000 (01:12 +0300)]
Make compile_keymap a little nicer

Just using the fact that we must have all of the components, without
optional ones.
Also fixes a memleak on the way, by making the functions which allocate
the XkbFiles to free them, which is easier to get right.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove CompileKeymap into xkbcomp.c
Ran Benita [Fri, 13 Jul 2012 21:27:19 +0000 (00:27 +0300)]
Move CompileKeymap into xkbcomp.c

It's nicer to see the code where its used. Removes keymap.c.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRename KSIsLower/Upper and move to keysym.c
Ran Benita [Fri, 13 Jul 2012 15:55:10 +0000 (18:55 +0300)]
Rename KSIsLower/Upper and move to keysym.c

Seems like a more natural place, and allows to remove the src/misc.c
file.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove MERGE_ALT_FORM merge mode
Ran Benita [Fri, 13 Jul 2012 15:34:11 +0000 (18:34 +0300)]
Remove MERGE_ALT_FORM merge mode

The mode comes from the "alternate" keyword, which is unused in
xkeyboard-config and mostly undocumented. Its purpose is to allow to
assign the same key name to multiple key codes, which is not allowed
otherwise (and doesn't make much sense). The xkblib specification
implies that this was part of the overlay functionality, which we also
no longer support.

If we do encounter this keyword, we just treat it as MERGE_DEFAULT. The
keycodes.c code will detect a collision and will ignore all but the
first key code (and the error count is not incremented).

Some peripheral code is also removed as a result.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove InitCanonicalKeyTypes to keytypes.c
Ran Benita [Fri, 13 Jul 2012 14:51:26 +0000 (17:51 +0300)]
Move InitCanonicalKeyTypes to keytypes.c

It's only got one call site and it's in keytypes.c, so move it there and
make it static.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove xkb_kt_map_entry::active
Ran Benita [Fri, 13 Jul 2012 14:37:31 +0000 (17:37 +0300)]
Remove xkb_kt_map_entry::active

Takes the advice of acdad6058d52dc8a3e724dc95448300850d474f2 and removes
this field, since its not used anymore now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove ComputeEffectiveMap code and avoid some duplication
Ran Benita [Fri, 13 Jul 2012 14:31:30 +0000 (17:31 +0300)]
Move ComputeEffectiveMap code and avoid some duplication

The ComputeEffectiveMap function is only called from keytypes.c, with
the last argument NULL, so we can move it there and remove some code.
The function XkbcVirtualModsToRealMods, of which the above is the only
user, is already implemented more simply in compat.c, so make this one
non-static and use it. This leaves src/xkb.c empty, so remove it.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoremove unused function xkb_canonicalise_components
Ran Benita [Fri, 13 Jul 2012 14:10:48 +0000 (17:10 +0300)]
remove unused function xkb_canonicalise_components

commit 46441b1184dfa8553409d493ae6336aabb900d79 removed this from the
public API, and we don't need it internally. So send it to the archives.

Signed-off-by: Ran Benita <ran234@gmail.com>