platform/upstream/libxkbcommon.git
12 years agostate: Add more comprehensive repeating test
Daniel Stone [Fri, 22 Jun 2012 14:29:47 +0000 (15:29 +0100)]
state: Add more comprehensive repeating test

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd xkb_key_repeats
Daniel Stone [Fri, 22 Jun 2012 14:27:05 +0000 (15:27 +0100)]
Add xkb_key_repeats

Does what it says on the box.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoWork out a default repeat for all keys
Daniel Stone [Fri, 22 Jun 2012 14:26:07 +0000 (15:26 +0100)]
Work out a default repeat for all keys

Our early exit in ApplyInterpsToKey meant we weren't hitting the code
that's supposed to set a sensible default autorepeat value for most
keys.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd a test for the results of key sequences
Ran Benita [Tue, 10 Apr 2012 18:20:27 +0000 (21:20 +0300)]
Add a test for the results of key sequences

This test verifies the core purpose of this library, which is to
translate the user's keypresses into keysyms according to the keymap and
the XKB specification.

The tests emulate a series of key presses, and checks that the resulting
keysyms are what we expect.

Several of the tests currently fail, and plenty more should be added and
maybe split up.

It also currently uses an RMLVO keymap, which comes from the
xkeyboard-config data set, and whose behaviour may change in the future.
So it should probably be changed to use several files of our own, but
it's OK for now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoutils: remove unused recalloc and related macros
Ran Benita [Wed, 6 Jun 2012 07:44:22 +0000 (10:44 +0300)]
utils: remove unused recalloc and related macros

Their use is superseded by darray everywhere now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agostate: use darray for filters
Ran Benita [Wed, 6 Jun 2012 07:38:45 +0000 (10:38 +0300)]
state: use darray for filters

For the darray we need to specify the explicit struct xkb_filter type
instead of void*, so we move the definition of struct xkb_state into
state.c thus making it opaque even from the rest of the files. It has
enough getters to get going and is otherwise good style.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray in struct xkb_sym_map
Ran Benita [Wed, 6 Jun 2012 07:01:43 +0000 (10:01 +0300)]
symbols: use darray in struct xkb_sym_map

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for KeyInfo acts
Ran Benita [Tue, 5 Jun 2012 22:22:52 +0000 (01:22 +0300)]
symbols: use darray for KeyInfo acts

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for KeyInfo symsMapNumEntries
Ran Benita [Tue, 5 Jun 2012 21:57:42 +0000 (00:57 +0300)]
symbols: use darray for KeyInfo symsMapNumEntries

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for KeyInfo symsMapIndex
Ran Benita [Tue, 5 Jun 2012 21:39:23 +0000 (00:39 +0300)]
symbols: use darray for KeyInfo symsMapIndex

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: remove sizeSyms array from KeyInfo
Ran Benita [Tue, 5 Jun 2012 16:25:23 +0000 (19:25 +0300)]
symbols: remove sizeSyms array from KeyInfo

This information is kept inside the darray now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for KeyInfo syms array
Ran Benita [Tue, 5 Jun 2012 16:09:01 +0000 (19:09 +0300)]
symbols: use darray for KeyInfo syms array

The arrays found in KeyInfo are by far the most complicated, so this is
taken one member at a time so as not to break anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agodarray: some changes for convenience
Ran Benita [Tue, 5 Jun 2012 15:46:24 +0000 (18:46 +0300)]
darray: some changes for convenience

- Make darray_free also initialize the array back to an empty state, and
  stop worrying about it everywhere.

- Add darray_mem, to access the underlying memory, which we do manually
  now using &darray_item(arr, 0). This makes a bit more clear when we
  actually mean to take the address of a specific item.

- Add darray_copy, to make a deep copy of a darray.

- Add darray_same, to test whether two darrays have the same underlying
  memory (e.g. if the struct itself was value copied). This should used
  where previously two arrays were compared for pointer equality.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agodarray: tweak parameters a bit for better memory usage
Ran Benita [Wed, 30 May 2012 12:55:21 +0000 (15:55 +0300)]
darray: tweak parameters a bit for better memory usage

Here are some quick numbers from valgrind, running rulescomp only with a
simple, common "us,de" rule set:

before darray: cb047bb
total heap usage: 44,924 allocs, 44,924 frees, 3,162,342 bytes allocated

after darray: c87468e
total heap usage: 52,670 allocs, 52,670 frees, 2,844,517 bytes allocated

tweaking specific inital allocation sizes:
total heap usage: 52,652 allocs, 52,652 frees, 2,841,814 bytes allocated

changing initial alloc = 2 globally
total heap usage: 47,802 allocs, 47,802 frees, 2,833,614 bytes allocated

changing initial alloc = 3 globally
total heap usage: 47,346 allocs, 47,346 frees, 3,307,110 bytes allocated

changing initial alloc = 4 globally
total heap usage: 44,643 allocs, 44,643 frees, 2,853,646 bytes allocated

[ Changing the geometric progression constant from 2 only made things
worse. I tried the golden ratio - not so golden :) ]

The last one is obviously the best, so it was chosen, with the specific
tweaks thrown in as well (these were there before but don't make much
difference). Overall it seems to do better than the previous manual
allocations which is a bit surprising.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoComment out unused fields in xkb_controls
Ran Benita [Fri, 8 Jun 2012 06:54:08 +0000 (09:54 +0300)]
Comment out unused fields in xkb_controls

Until (if) we implement/use them the should take up any (mental) space.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoUnconstify a few string struct fields
Ran Benita [Fri, 8 Jun 2012 06:25:38 +0000 (09:25 +0300)]
Unconstify a few string struct fields

These were made const when the structs were exposed in the API. Now they
are private and we shouldn't mess around with the UNCONSTIFY business.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agotest/dump: allow to run manually
Ran Benita [Tue, 5 Jun 2012 14:48:08 +0000 (17:48 +0300)]
test/dump: allow to run manually

Without the srcdir envvar (and a couple trivial changes).

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove configure check for X11 keysym files
Ran Benita [Sun, 20 May 2012 17:51:50 +0000 (20:51 +0300)]
Remove configure check for X11 keysym files

Since every user building the library, even from git, doesn't need these
files anymore, there's no need to check for them (this goes for makekeys
as well).

The only remaining user is the update-keysyms target, but whoever will
run it again (if ever) will probably know what he's doing (at least
enough to run git diff before git commit). And the defaults should be
fine too.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoMove XKB_KEY_NoSymbol to xkbcommon-keysyms.h
Ran Benita [Sun, 20 May 2012 17:39:35 +0000 (20:39 +0300)]
Move XKB_KEY_NoSymbol to xkbcommon-keysyms.h

This avoids a couple of special cases in the code, and is more
consistent. Since anyone who includes xkbcommon.h also gets
xkbcommon-keysyms.h, and anyone who include xkbcommon-keysyms.h would
want NoSymbol anyway, there's no down side.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoUpdate .gitignore
Ran Benita [Tue, 5 Jun 2012 21:19:48 +0000 (00:19 +0300)]
Update .gitignore

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoAdd keypad sequences to UTF-8 keysym printing
Daniel Stone [Fri, 8 Jun 2012 13:54:31 +0000 (14:54 +0100)]
Add keypad sequences to UTF-8 keysym printing

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd API for getting unicode representation of a keysym
Rob Bradford [Fri, 8 Jun 2012 12:10:28 +0000 (13:10 +0100)]
Add API for getting unicode representation of a keysym

This code uses a table and code derived from
http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c

The added API calls are:

xkb_keysym_to_utf32
xkb_keysym_to_utf8

[daniels: Changed API to be more in line with keysym_get_name, added
          test, changed formatting to 4-space.]

12 years agoFix tiny memory leak in dump test
Daniel Stone [Mon, 4 Jun 2012 15:16:20 +0000 (16:16 +0100)]
Fix tiny memory leak in dump test

We forgot to free the path we'd allocated with asprintf.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAvoid duplicating keysyms for merge if possible
Daniel Stone [Mon, 4 Jun 2012 15:15:10 +0000 (16:15 +0100)]
Avoid duplicating keysyms for merge if possible

If we can merge cleanly (i.e. use the entirety of one entry rather than
having to go level by level), then just reuse the existing symbols array
and skip the entire merge process.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoUse $(top_builddir) rather than relative paths
Daniel Stone [Mon, 4 Jun 2012 15:14:42 +0000 (16:14 +0100)]
Use $(top_builddir) rather than relative paths

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoWork around stupid automake dependency-tracking bug
Daniel Stone [Mon, 4 Jun 2012 13:06:01 +0000 (14:06 +0100)]
Work around stupid automake dependency-tracking bug

bison/flex-generated objects, when being run in a VPATH build with
--disable-dependency-tracking (i.e. Gentoo), would fail to be created
because automake didn't bother creating the destination directories
before trying to create the objects.

Fix this by depending on the destination directory stamp, which
according to the automake mailing list, should hopefully remain fairly
stable.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoFix action= NoAction() printing
Daniel Stone [Mon, 4 Jun 2012 13:04:04 +0000 (14:04 +0100)]
Fix action= NoAction() printing

Print it explicitly, rather than type=0x00, with all the private data
too.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoMake xkb_map_get_as_string test more comprehensive
Daniel Stone [Mon, 4 Jun 2012 12:27:41 +0000 (13:27 +0100)]
Make xkb_map_get_as_string test more comprehensive

Add a test/dump.data file which contains the result we're expecting from
xkb_map_get_as_string run on a particularly complex set of keymaps, and
assert that the string representations are the same.  This means that
any updates to xkb_map_get_as_string will also need to update the test
data, but should also ensure that we don't have any more parser
regressions.

Compared with diff to the output of setxkbmap + xkbcomp for the same
keymap; seems completely solid.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoRevert "dump"
Daniel Stone [Mon, 4 Jun 2012 12:08:01 +0000 (13:08 +0100)]
Revert "dump"

(Ahem.)

This reverts commit f43f75fb83e94224000ebc6b0736182546781c5e.

12 years agoRemove fake support for global group range settings
Ran Benita [Wed, 23 May 2012 18:24:50 +0000 (21:24 +0300)]
Remove fake support for global group range settings

A symbols file may contain a global, non key specific setting for
the group out-of-range handling method (wrap, clamp, redirect). Only
that:

* Its parsed and kept in the SymbolsInfo, but is not otherwise used in
  any way (it's the same in the real xkbcomp).
* It's not used in any of xkeyboard-config files.
* It's not mentioned in the xkb specs (only the per-key ones).
* It doesn't make much sense anyway.

So remove the struct field, and emit an "unsupported, ignored" warning.
We don't increment the error count because of it, just continue (the
radio group warning just below is changed to do the same - there's no
reason to possibly abort the entire thing for it).

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

src/xkbcomp/symbols.c

12 years agoSymbols: Don't include NoSymbols in the map
Daniel Stone [Mon, 4 Jun 2012 12:01:33 +0000 (13:01 +0100)]
Symbols: Don't include NoSymbols in the map

Instead of using NoSymbol in the map, we use num_syms == 0 to signify
the non-presence of a symbol.  So instead of adding NoSymbol mappings
to the list regardless, detect them and set num_syms == 0.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoFix multiple errors when merging symbol definitions
Daniel Stone [Mon, 4 Jun 2012 11:54:54 +0000 (12:54 +0100)]
Fix multiple errors when merging symbol definitions

We were getting the size calculation wrong, as well as inconsistently
picking a merge strategy.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agodump
Daniel Stone [Sat, 2 Jun 2012 14:29:21 +0000 (15:29 +0100)]
dump

12 years agokeymap-dump: Print NoAction actions too
Daniel Stone [Sat, 2 Jun 2012 14:25:36 +0000 (15:25 +0100)]
keymap-dump: Print NoAction actions too

The failure mode here is a little irritating:
    - server loads map with ISO_Lock action
    - server dumps keymap to string, including:
      interpret ISO_Lock+AnyOfOrAll(None) {
          action= NoAction();
      };
      as we don't (yet) print ISO_Lock actions
    - client parses keymap from string
    - client dumps keymap to string, including:
      interpret ISO_Lock+AnyOfOrAll(None) {
      };
    - this results in a syntax error

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agostringcomp: NULL-terminate string
Daniel Stone [Tue, 29 May 2012 15:15:07 +0000 (16:15 +0100)]
stringcomp: NULL-terminate string

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoPass merge down through indicator creation
Daniel Stone [Tue, 29 May 2012 15:12:54 +0000 (16:12 +0100)]
Pass merge down through indicator creation

To avoid using potentially undefined memory.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd test for xkb_map_new_from_string
Daniel Stone [Tue, 29 May 2012 14:08:35 +0000 (15:08 +0100)]
Add test for xkb_map_new_from_string

Using data from xkb_map_get_as_string.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd xkb_map_get_as_string
Daniel Stone [Fri, 25 May 2012 16:05:39 +0000 (17:05 +0100)]
Add xkb_map_get_as_string

Returns a newly-allocated string representing the specified keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoFix signed vs. unsigned confusion in actions
Daniel Stone [Fri, 25 May 2012 16:58:32 +0000 (17:58 +0100)]
Fix signed vs. unsigned confusion in actions

Some actions could also take relative rather than absolute parameters,
so they really needed to be signed instead of explicitly unsigned.
Oops.

Fixes, e.g., action= MovePtr(x=-1,y=+1), which was reported as
(x=+65535,y=+1).

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agocompat: use darray for acts and key_acts in the server map
Ran Benita [Tue, 22 May 2012 15:00:56 +0000 (18:00 +0300)]
compat: use darray for acts and key_acts in the server map

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeycodes: use darray in KeyNamesInfo
Ran Benita [Tue, 22 May 2012 12:45:42 +0000 (15:45 +0300)]
keycodes: use darray in KeyNamesInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for xkb_sym_map
Ran Benita [Tue, 22 May 2012 12:20:47 +0000 (15:20 +0300)]
symbols: use darray for xkb_sym_map

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeytypes: use darray for level names
Ran Benita [Tue, 22 May 2012 11:18:48 +0000 (14:18 +0300)]
keytypes: use darray for level names

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agosymbols: use darray for KeyInfo
Ran Benita [Tue, 22 May 2012 11:00:16 +0000 (14:00 +0300)]
symbols: use darray for KeyInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoparser: use darray for keysym list
Ran Benita [Tue, 22 May 2012 09:24:54 +0000 (12:24 +0300)]
parser: use darray for keysym list

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeytypes: use darray for xkb_kt_map_entry's
Ran Benita [Tue, 22 May 2012 07:59:46 +0000 (10:59 +0300)]
keytypes: use darray for xkb_kt_map_entry's

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoalloc: use darray in xkb_key_names
Ran Benita [Tue, 22 May 2012 05:39:09 +0000 (08:39 +0300)]
alloc: use darray in xkb_key_names

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agokeytypes: use darray for key types in the client map
Ran Benita [Tue, 22 May 2012 05:07:52 +0000 (08:07 +0300)]
keytypes: use darray for key types in the client map

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompat: use darray for sym_interprets
Ran Benita [Mon, 21 May 2012 21:52:28 +0000 (00:52 +0300)]
compat: use darray for sym_interprets

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocontext: use darray for include paths
Ran Benita [Mon, 21 May 2012 21:37:53 +0000 (00:37 +0300)]
context: use darray for include paths

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoatom: use darray for the node_table
Ran Benita [Mon, 21 May 2012 21:26:58 +0000 (00:26 +0300)]
atom: use darray for the node_table

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: use darray for input line
Ran Benita [Mon, 21 May 2012 21:14:34 +0000 (00:14 +0300)]
rules: use darray for input line

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: use darray for rules and groups
Ran Benita [Mon, 21 May 2012 20:47:44 +0000 (23:47 +0300)]
rules: use darray for rules and groups

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoImport darray.h for common dynamic array code
Ran Benita [Mon, 21 May 2012 20:33:56 +0000 (23:33 +0300)]
Import darray.h for common dynamic array code

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoConstify a static variable
Ran Benita [Tue, 22 May 2012 09:32:06 +0000 (12:32 +0300)]
Constify a static variable

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix incorrect indexing while freeing
Ran Benita [Tue, 22 May 2012 05:04:59 +0000 (08:04 +0300)]
Fix incorrect indexing while freeing

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: add test
Ran Benita [Fri, 18 May 2012 23:35:15 +0000 (02:35 +0300)]
rules: add test

Add a non-extensive test to check that some basic things (e.g. rule
matching, var substitution, indexes and groups) work as expected.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: allow wildcard match against "" layout/varaint
Ran Benita [Sat, 19 May 2012 09:50:47 +0000 (12:50 +0300)]
rules: allow wildcard match against "" layout/varaint

Currently, if you pass in an rmlvo with an empty string for layout or
variant, it would not match layout and variant rules even with
wildcards. But if the rules file had set an appropriate default, and someone
passes in the empty string, than he should get the default.

NULL in this case signifies not wanting to match against the layout or
variant at all, and so the rule should still fail to match NULLs.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: remove struct var_defs
Ran Benita [Fri, 18 May 2012 22:00:52 +0000 (01:00 +0300)]
rules: remove struct var_defs

We can just use struct xkb_rule_names which we already receive as an
argument.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat components_from_rules
Ran Benita [Fri, 18 May 2012 21:53:57 +0000 (00:53 +0300)]
rules: reformat components_from_rules

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat LoadRules and XkbRF_Free
Ran Benita [Fri, 18 May 2012 16:39:25 +0000 (19:39 +0300)]
rules: reformat LoadRules and XkbRF_Free

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: remove unused struct describe_vars
Ran Benita [Fri, 18 May 2012 16:37:01 +0000 (19:37 +0300)]
rules: remove unused struct describe_vars

It's not actually used for anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat AddRule and AddGroup
Ran Benita [Fri, 18 May 2012 15:38:06 +0000 (18:38 +0300)]
rules: reformat AddRule and AddGroup

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat GetComponents
Ran Benita [Fri, 18 May 2012 15:34:47 +0000 (18:34 +0300)]
rules: reformat GetComponents

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat SubstituteVars
Ran Benita [Fri, 18 May 2012 15:25:59 +0000 (18:25 +0300)]
rules: reformat SubstituteVars

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat CheckApplyRules and ApplyPartialMatches
Ran Benita [Fri, 18 May 2012 09:02:29 +0000 (12:02 +0300)]
rules: reformat CheckApplyRules and ApplyPartialMatches

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat CheckGroup and CheckApplyRule
Ran Benita [Fri, 18 May 2012 07:43:24 +0000 (10:43 +0300)]
rules: reformat CheckGroup and CheckApplyRule

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: rewrite MatchOneOf
Ran Benita [Fri, 18 May 2012 08:01:20 +0000 (11:01 +0300)]
rules: rewrite MatchOneOf

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat ApplyRule
Ran Benita [Fri, 18 May 2012 07:33:38 +0000 (10:33 +0300)]
rules: reformat ApplyRule

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat MakeMultiDefs
Ran Benita [Thu, 17 May 2012 23:53:29 +0000 (02:53 +0300)]
rules: reformat MakeMultiDefs

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: use asprintf instead of _Concat function
Ran Benita [Thu, 17 May 2012 23:20:14 +0000 (02:20 +0300)]
rules: use asprintf instead of _Concat function

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat CheckLine and break into several functions
Ran Benita [Thu, 17 May 2012 13:15:46 +0000 (16:15 +0300)]
rules: reformat CheckLine and break into several functions

And remove struct file_spec which is really unneeded. Should be
slightly more clear now.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat SetUpRemap and struct remap_spec
Ran Benita [Thu, 17 May 2012 11:18:31 +0000 (14:18 +0300)]
rules: reformat SetUpRemap and struct remap_spec

Rename to more descriptive names and reformat.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: rewrite get_index to use sscanf
Ran Benita [Thu, 17 May 2012 10:55:38 +0000 (13:55 +0300)]
rules: rewrite get_index to use sscanf

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: don't typedef the structs and rename them
Ran Benita [Wed, 16 May 2012 07:09:03 +0000 (10:09 +0300)]
rules: don't typedef the structs and rename them

The long prefix is unnecessary now that they are all private.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: reformat input line handling
Ran Benita [Wed, 16 May 2012 06:49:32 +0000 (09:49 +0300)]
rules: reformat input line handling

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: don't use custom logging functions
Ran Benita [Wed, 16 May 2012 06:39:01 +0000 (09:39 +0300)]
rules: don't use custom logging functions

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: only export a single function
Ran Benita [Sun, 13 May 2012 06:49:08 +0000 (09:49 +0300)]
rules: only export a single function

Really all we need from this file is a way to get xkb_component_names
from an xkb_rule_names, which is now the only thing being exposed. This
should allow for some much needed refactoring of this code.

Since this is only used by xkbcomp.c and uses xkbcomp functions, also
move rules.{c,h} under the xkbcomp dir.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agorules: remove unused struct fields and use size_t
Ran Benita [Fri, 11 May 2012 07:04:26 +0000 (10:04 +0300)]
rules: remove unused struct fields and use size_t

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoDon't run the benchmark by default
Ran Benita [Fri, 18 May 2012 15:09:50 +0000 (18:09 +0300)]
Don't run the benchmark by default

For people running 'make check' on every compilation, this can be
a nuisance.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoCreate path.h for the path.c functions
Ran Benita [Sun, 13 May 2012 07:14:10 +0000 (10:14 +0300)]
Create path.h for the path.c functions

No need to stash them in xkbcomp-priv.h; files which need the functions
should explicitly include them.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoChange xkb_map_new_from_fd to use FILE*
Ran Benita [Sun, 13 May 2012 20:31:59 +0000 (23:31 +0300)]
Change xkb_map_new_from_fd to use FILE*

i.e. xkb_map_new_from_file. The reason is that flex only works with
FILE's, so we must use fdopen on the file descriptor; but to avoid a
memory leak, we must also fclose() it, which, in turn, closes the file
descriptor itself.

Either way is not acceptable, so we can either:
* dup() the fd and use fdopen on that, or
* have the user call fdopen on his own, and accept a FILE* instead of an
  fd.

The second one seems better, and is standard C, so why not. We must add
stdio.h to xkbcommon.h though, which is regrettable, but not a big deal.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove FileHandler callback argument
Ran Benita [Sun, 13 May 2012 14:21:02 +0000 (17:21 +0300)]
Remove FileHandler callback argument

It's unneeded; the same function is always passed.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRemove unused allowNone from KeyInfo
Ran Benita [Sun, 13 May 2012 14:23:28 +0000 (17:23 +0300)]
Remove unused allowNone from KeyInfo

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoRevert "Fix KeyInfo's syms array size calculation"
Ran Benita [Sun, 13 May 2012 20:13:10 +0000 (23:13 +0300)]
Revert "Fix KeyInfo's syms array size calculation"

This partly reverts commit 8feba630fa7a4b720c42a9b5b4e4280b0e17a500.

This seems to fix valgrind errors:
==9581== Invalid read of size 4
==9581==    at 0x4E50928: MergeKeyGroups (symbols.c:544)
==9581==    by 0x4E510F3: MergeKeys (symbols.c:644)
==9581==    by 0x4E514C6: AddKeySymbols (symbols.c:722)
==9581==    by 0x4E51A3F: MergeIncludedSymbols (symbols.c:854)
==9581==    by 0x4E51E97: HandleIncludeSymbols (symbols.c:952)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)
==9581==    by 0x4E55A0B: CompileSymbols (symbols.c:2187)
==9581==    by 0x4E4056C: CompileKeymap (keymap.c:160)
==9581==    by 0x4E56953: compile_keymap (xkbcomp.c:149)
==9581==    by 0x4E56AC5: xkb_map_new_from_kccgst (xkbcomp.c:195)
==9581==    by 0x4009D7: test_names (namescomp.c:56)
==9581==    by 0x400A55: main (namescomp.c:75)
==9581==  Address 0x5729b04 is 0 bytes after a block of size 4 alloc'd
==9581==    at 0x4C29024: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9581==    by 0x4E5C37B: recalloc (utils.c:41)
==9581==    by 0x4E4FF50: ResizeKeyGroup (symbols.c:356)
==9581==    by 0x4E5229E: AddSymbolsToKey (symbols.c:1058)
==9581==    by 0x4E52ABB: SetSymbolsField (symbols.c:1214)
==9581==    by 0x4E536C7: HandleSymbolsBody (symbols.c:1481)
==9581==    by 0x4E53A63: HandleSymbolsDef (symbols.c:1543)
==9581==    by 0x4E53DAD: HandleSymbolsFile (symbols.c:1623)
==9581==    by 0x4E51CA4: HandleIncludeSymbols (symbols.c:909)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)
==9581==    by 0x4E51E74: HandleIncludeSymbols (symbols.c:951)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoVarious static analyzer fixes
Ran Benita [Sun, 13 May 2012 15:45:43 +0000 (18:45 +0300)]
Various static analyzer fixes

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix a memleak
Ran Benita [Sun, 13 May 2012 07:38:51 +0000 (10:38 +0300)]
Fix a memleak

Introduced in 38cb639082ec4b31725d4ce4e35af63938691631.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoFix configure check for xkbparse.c instead of parser.c
Ran Benita [Wed, 9 May 2012 22:02:29 +0000 (01:02 +0300)]
Fix configure check for xkbparse.c instead of parser.c

This obscure test is easy to miss.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agoAdd xkbcommon-uninstalled.pc
Pekka Paalanen [Tue, 15 May 2012 12:23:42 +0000 (15:23 +0300)]
Add xkbcommon-uninstalled.pc

12 years agoUse eaccess() only if available
Pekka Paalanen [Tue, 15 May 2012 12:23:41 +0000 (15:23 +0300)]
Use eaccess() only if available

Fixes build on Android.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoFix out-of-tree build for config.h
Pekka Paalanen [Tue, 15 May 2012 12:23:40 +0000 (15:23 +0300)]
Fix out-of-tree build for config.h

config.h appreas in the build dir, not src dir.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoAdd benchmarking test to rulescomp
Daniel Stone [Thu, 17 May 2012 23:56:36 +0000 (00:56 +0100)]
Add benchmarking test to rulescomp

Apparently it only takes us 8ms to build keymaps.  Nice!

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoUse $(AM_V_GEN) to prettyfi makekeys step
Kristian Høgsberg [Fri, 11 May 2012 15:14:27 +0000 (16:14 +0100)]
Use $(AM_V_GEN) to prettyfi makekeys step

12 years agoRename 'ctx' back to 'context' in external API
Daniel Stone [Fri, 11 May 2012 14:03:43 +0000 (15:03 +0100)]
Rename 'ctx' back to 'context' in external API

Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.

This partially reverts e7bb1e5f.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd xkbcommon-keysyms.h to Makefile.am
Daniel Stone [Fri, 11 May 2012 13:28:54 +0000 (14:28 +0100)]
Add xkbcommon-keysyms.h to Makefile.am

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoDocument that xkb_state_get_map doesn't take a ref
Daniel Stone [Wed, 9 May 2012 19:52:33 +0000 (20:52 +0100)]
Document that xkb_state_get_map doesn't take a ref

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoChange xkb_key_get_syms to just return a bare int
Daniel Stone [Wed, 9 May 2012 19:51:37 +0000 (20:51 +0100)]
Change xkb_key_get_syms to just return a bare int

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoMove KcCGST API to internal-only
Daniel Stone [Wed, 9 May 2012 19:49:04 +0000 (20:49 +0100)]
Move KcCGST API to internal-only

And don't export it.  We don't need it for X11 support, let alone
anything else.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoRename serialise to serialize
Daniel Stone [Wed, 9 May 2012 19:20:12 +0000 (20:20 +0100)]
Rename serialise to serialize

Yes, British English is correct, but unfortunately we've lost that
battle.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoAdd common LED names to xkbcommon-names.h
Daniel Stone [Wed, 9 May 2012 19:18:30 +0000 (20:18 +0100)]
Add common LED names to xkbcommon-names.h

Signed-off-by: Daniel Stone <daniel@fooishbar.org>