Commit Graph

80 Commits (208d957806f5555809c1e511a587211d50c13b70)

Author SHA1 Message Date
Ran Benita 869c687190 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>
2012-05-20 20:31:49 +03:00
Ran Benita beccc37509 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>
2012-05-20 20:31:19 +03:00
Ran Benita b89b8e7023 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>
2012-05-18 20:54:33 +03:00
Daniel Stone 661cb84051 Add benchmarking test to rulescomp
Apparently it only takes us 8ms to build keymaps.  Nice!

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-18 01:04:35 +01:00
Daniel Stone 7b00485a6b 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>
2012-05-11 15:03:43 +01:00
Daniel Stone 46441b1184 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>
2012-05-09 20:49:04 +01:00
Daniel Stone 2761b1a332 Rename serialise to serialize
Yes, British English is correct, but unfortunately we've lost that
battle.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:49:01 +01:00
Daniel Stone 5a3771d149 Add common LED names to xkbcommon-names.h
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:18:30 +01:00
Daniel Stone 6433d72e7c Merge remote-tracking branch 'krh/keysyms'
Conflicts:
	src/keysym.c
	src/misc.c
	src/text.h
	src/xkbcomp/expr.c
	src/xkbcomp/parser.y
	src/xkbcomp/parseutils.c
	src/xkbcomp/symbols.c

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:15:46 +01:00
Kristian Høgsberg ace1e5df6d Use our own keysyms 2012-05-09 14:21:15 -04:00
Ran Benita e7bb1e5fd9 Shorten context to ctx
(This breaks the API.)

"context" is really annoying to type all the time (and we're going to
type it a lot more :). "ctx" is clear, concise and common in many other
libraries. Use it!

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

[daniels: Fix for xkb -> keymap change.]
2012-05-09 17:52:26 +01:00
Daniel Stone 38cb639082 Change all 'xkb' xkb_keymap names to 'keymap'
To make it a bit more clear what it actually is.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 15:17:25 +01:00
Daniel Stone e1af48bc04 Rename keysym <-> string API
Change them to refer to the string representation of the keysym's name
as a name rather than a string, since we want to add API to get the
Unicode printable representation as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 13:22:34 +01:00
Daniel Stone 124e62e48f Add multiple modifier state matching API
Two new calls allow users to test the exact modifier state, including
verifying that no other modifiers but the ones you wanted are down.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 01:06:10 +01:00
Daniel Stone 74a197d271 Add pre-defined names database
xkbcommon-names.h right now just contains a set of hardcoded modifier
strings that are most commonly used for the usual modifiers.  Provide
definitions of these so people don't have to worry about typoing a
string or mixing up Mod1 and Mod4.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:59:35 +01:00
Daniel Stone c358428009 Add flags to context creation
None defined as yet, but why not.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:51:16 +01:00
Daniel Stone b537b5524a Add flags to keymap compilation entrypoints
No use as yet, but might as well ...

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:48:29 +01:00
Ran Benita b610b2b953 Rename XKBcommonint.h to xkb-priv.h and use it
Make the files in the src/* directory use their own header or a
consilidated private header. This makes the file dependencies clearer.

Also drop the pointless "xkb" file name prefix, add split a few
declarations to their own files (atom.h and text.h).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:29:43 +01:00
Ran Benita fbfbf0aa4b Remove left over filecomp.sh file
Should have removed it in a previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:53 +01:00
Ran Benita 40b56b0fe3 Update .gitignore for automake 1.12
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:52 +01:00
Ran Benita a1e07fb6f6 Uncomment sections of test/rulescomp.c
Fixes an 'unused' warning. There seems to be nothing wrong with these
sections though, all the tests pass.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:50 +01:00
Ran Benita 12b3495ddf Remove unused 'which' and 'merge' arguments
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_desc -> xkb_keymap changes.]
2012-05-01 13:57:31 +01:00
Ran Benita 4b49e0a117 Overhaul test suite
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
  pure C file per test. All of the .sh files are removed, but everything
  that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
  "parallel-test" mechanism. This will create a single log file for each
  test with it's stdout+stderr, and a top level "test-suite.log" file
  for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
  so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
  colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
  That way we can just put the directory in EXTRA_DIST and forget about
  it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
  for a completely non-recursive build.

Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.

It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.

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

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:21:47 +01:00
Daniel Stone ef88c7efab Rename xkb_desc to xkb_keymap
struct xkb_desc was just a hangover from the old XkbDescRec, which isn't
a very descriptive name.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone 9b14e0c311 Tests: Release context on failure to build keymap
No practical effect since they exit(1) regardless, but it keeps valgrind
happy.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 17:38:44 +01:00
Daniel Stone 034ffce664 Use xkb_contexts in keymap compilation
Primarily for the include path, but also for the logging in future.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 17:22:35 +01:00
Daniel Stone 3e9dd7512c Add new context API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 16:59:01 +01:00
Daniel Stone 21f1bff4af Fix distcheck with non-recursive Makefiles
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 15:56:06 +01:00
Ran Benita b5efe41f19 Make build non-recursive
Unify all the different Makefile.am into a single short top level one
(the test/Makefile.am file is left intact though).

This makes the build system simpler to look and should encourage
unifying more currently-disparate code.

Some further motivation can be found in this page:
http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:17:34 +01:00
Ran Benita 602e87805b Define our own NoSymbol value and use it
Since we have our own xkb_keysym_t type, it makes sense to have our own
NoSymbol value instead of the one from X11/X.h.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:16:36 +01:00
Ran Benita d3908b631c Define our own None atom value
Since we define our own xkb_atom_t type, it makes sense not to use the
X11/X.h None value. This way we can also remove a lot of X11 includes.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:16:11 +01:00
Ran Benita 0480f427ad Remove useless stuff from utils
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: fixed conflicts from strcasecmp, added includes to make
          filecomp build again]
2012-03-27 14:09:27 +01:00
Ran Benita d22b8dbbd0 Move utils.{c,h} to be used by the entire project
This is a first step for making consistent use of utils.h also outside
of xkbcomp/ .

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:51 +01:00
Ran Benita f52671a4d1 Remove a few remaining uses of the KeySym type
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:22 +01:00
Ran Benita 8b3e2b9b00 Add xkb test file to EXTRA_DIST
To appease make distcheck.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:19 +01:00
Ran Benita eeb0a21448 Update gitignore for 'state' test
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:15 +01:00
Daniel Stone ede8473490 Add enum xkb_key_direction instead of bool
Use XKB_KEY_UP instead of 0 and XKB_KEY_DOWN instead of 1.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Ran Benita <ran234@gmail.com>
2012-03-27 12:18:41 +01:00
Daniel Stone 7f471a702e Add state serialisation API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:11:27 +01:00
Daniel Stone d039622a65 Rename keymap allocation API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 17:39:12 +00:00
Daniel Stone 3d672fcfea Add LED state API
And also convert state.c to use the state API for mods and groups,
rather than testing the state members directly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 14:32:53 +00:00
Daniel Stone edcaab6512 Round out new state API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 15:25:45 +00:00
Daniel Stone ecea0d71b2 Add new state API
Add new API to deal with xkb_state objects, including
xkb_state_update_key, which runs the XKB action machinery internally to
calculate what exactly happens to the state when a given key is pressed
or released.

The canonical way to deal with keys is now:
    struct xkb_state *state = xkb_state_new(xkb);
    xkb_keysym_t *syms;
    int num_syms;

    xkb_state_update_key(state, key, is_down);
    num_syms = xkb_key_get_syms(state, key, &syms);

More state handling API, including a way to get at or ignore preserved
modifiers, is on its way.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 02:22:04 +00:00
Daniel Stone 7e2dd12142 Add geometry test
Add the dump of my full current X11/XKB keymap as a test for filecomp,
being as it also includes geometry.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-15 09:44:55 +00:00
Daniel Stone b8e950defd filecomp: Fix xkbcomp warning
Ironically, the test for named.xkb included a call that relied on the
default keymap, without the file naming an explicit default.  Go figure.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone ed5c6c1796 Remove geometry support, again
It still parses geometry, but happily throws it away.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +00:00
Ran Benita 0d8874d01c makekeys: update to match the rest of libX11 makekeys
This integrates two commits from libX11:

ebd6ef0a4db0ddef0ae17ad14571518ccdeea5ba
   XStringToKeysym: Special case for XF86 keysyms

    Some XFree86 keysyms were in XKeysymDB as XF86_foo, despite really being
    XF86foo.  So, if we get to the bottom of XStringToKeysym and haven't
    found our XF86_foo, try it again as XF86foo.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

00175397480b76d32bf82b0c7c94c91a2a95954e
    makekeys: Scan vendor keysyms as well as core

    Since we can't really live without vendor keysyms, scan them all in to
    generate ks_tables.h, rather than only doing the core ones, and leaving
    the vendor syms to be manually synchronised with XKeysymDB.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

Notice that the xkey.sh test is changed to match libX11 behavior, i.e.
XKeysymToString(0x1008FE20) -> "XF86Ungrab" as opposed to "XF86_Ungrab".

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:09:37 +02:00
Daniel Stone 3077e97e7c tests: Free returned XKB map
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:38:17 +00:00
Daniel Stone 4e22851141 Introduce xkb_keycode_t for keycodes
And use it consistently everywhere, including with a special long-safe
internal keycode type, to ease the transition to large keycodes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:50 +00:00
Daniel Stone ead9d0cb62 Move include path from X11/extensions/ to xkbcommon/
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:50 +00:00
Gaetan Nadon 5e43e7b46c config: distribute the .sh test programs and test data
The test programs and the test data are required in the tarball
and needed for distcheck.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:57 -05:00