Commit Graph

1589 Commits (599fd9ba39f6343644d621bd02a23b2656e91b51)

Author SHA1 Message Date
Ran Benita bb6ca7682c Make parser and scanner reentrant
All global state is removed from the parser and scanner.
This makes use of the standard facilities in Bison and Flex for
reentrant/pure scanner/lexer and location tracking.

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

[daniels: Updated to current sources.]
2012-03-27 22:41:22 +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 f0cb4ee219 Update xkb_filter_group_lock_func for xkb_key_direction
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 16:15:06 +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
Daniel Stone bc8bbf50dc Fix build for X11 modifier masks
Exposed by include path changes, oops.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 15:51:24 +01:00
Ran Benita 3fa7fdd089 Handle group lock actions
The spec is simple here, as this action has no effect on key releases.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:17:39 +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 2165e16ed9 Fix all -Wsign-compare warnings
i.e comparison of signed and unsigned values. These are mostly
harmless but fixing them allows to compile cleanly with -Wextra.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:15:31 +01:00
Ran Benita 813ddf255d Silence -Wcast-qual warnings
There are some cases where we must free a string with a const qualifier.
Add a macro UNCONSTIFY to trick the compiler into silencing the warning
in the cases where we know what we're doing.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:15:11 +01:00
Ran Benita f08ce9b71b Use strcasecmp consistently instead of uStrCaseCmp
There's no use calling the same thing by a different name.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:13:24 +01:00
Ran Benita 3104a8ef18 Move utility macro from XKBcommonint.h to utils.h
And merge all the similar ones into the same name.
The u* prefix is chosen over the _Xkb prefix because it has more uses
throughout the codebase. But It should now be simple to choose a nice
prefix and stay consistent.

Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: fixed for the case where we have strcasecmp]
2012-03-27 14:12:34 +01:00
Ran Benita 2a5f641657 Remove some more useless stuff
Some unused defines and geometry-removal leftovers (specifically the
file geom.c and the struct for the keyboard coordinates).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:09:53 +01:00
Ran Benita 861b0c79c4 Rewrite recalloc to the correct type
The recalloc function should be expressed in terms of bytes to match its
name. However uTypedRecalloc retains its type so nothing is changed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:09:50 +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
Daniel Stone 2ac8610fad Remove fallback strcasecmp/strncasecmp
Sorry if your libc doesn't have this, but it's not my problem.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:06:56 +01:00
Daniel Stone 55b76a6389 Add include/ to makekeys include path
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 14:05:14 +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 7cc17ec507 Fix a scanf type mismatch
"%o" takes an unsigned int.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:50 +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 1b17708c88 Fix incorrect usage of && instead of &
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:17 +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
Ran Benita 6f7478d775 Fix latin8 upper/lower case check
GCC complained:
misc.c:235:13: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
misc.c:248:13: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

Looking at keysymdef.h shows that the check is indeed wrong. This commit
updates the check to match the latin8 section of keysymdef exactly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:14 +01:00
Ran Benita 3b22373f1f Properly free xkb_state's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:08 +01:00
Ran Benita d9f934ca42 Mention xkb_state_new can return NULL
in the header comments.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:58:27 +01:00
Guillem Jover 087327d9c5 Move doxygen comment before enum item
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2012-03-27 13:45:17 +01:00
Daniel Stone 389c2db1d7 Remove internal API from xkbcommon.h
And move it to XKBcomminint.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 13:44:48 +01:00
Daniel Stone 3dcd7ae02c Remove hardcoded legacy modifier masks
Use the xkb_state_mod_* and xkb_map_mod_* API instead.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:20:42 +01:00
Daniel Stone 729ac12f1c Remove unused changes structs
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:19:42 +01:00
Daniel Stone f89b0a80ba Remove unused members of xkb_state
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:18:50 +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 83b8b4b533 Cosmetic coding style fixups
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:07:40 +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 b6c79ad0d8 LEDs: Fix string comparison bug
This resulted in duplicate sets of modifiers, since we were comparing
pointer equality of two strings, rather than string equality.  Oops.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 14:32:23 +00:00
Daniel Stone 504cc0b858 Check for invalid indices in mod/group state API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 14:31:33 +00:00
Daniel Stone cfb07724b7 Fix documentation bugs with mod/group state API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 14:30:58 +00:00
Daniel Stone aaffcef35d Add a proper README
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 16:57:05 +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 9468d84ad1 Fix (correct, but harmless) const warning
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 14:44:16 +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 272ccbf473 Remove some rogue fprintfs
Oops.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 02:19:44 +00:00
Daniel Stone 1afc6fca4d Don't clear real mods in action modmask
Previously, we would clear out the real modmask when updating the
modmask for action maps, if not using the key's modmask.  The correct
behaviour here is instead to use the key's modmask if using the modmap,
else use the real mods provided with the action originally.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 02:17:58 +00:00
Daniel Stone f44eed3e9a Remove unnecessary allocation in expr.c
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 00:33:29 +00:00
Daniel Stone bcd811ce2f Small constification
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-20 17:24:09 +00:00
Daniel Stone 3d31be5f87 Also print group name in keysym error
Unfortunately we can't get the actual file it was defined in this far
down, but at least give the human-readable name rather than just a group
index.

Also, groups are not zero-indexed, such that index 0 is group 1; fix
that too.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-16 14:29:40 +00:00