Commit Graph

465 Commits (4aef083e46568664708f57b5aaa356e858c1f4de)

Author SHA1 Message Date
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
Daniel Stone 7dbd304021 More useful errors for invalid keysyms
Instead of generating a fairly droll internal error, generate a warning
also telling us exactly where the bad definition was.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-16 14:22:04 +00:00
Daniel Stone f40e0790f2 Fix non-useModMapMods action masks
By ensuring their mask is only the vmods, rather than also potentially
including the key's modmap.  Also remove the unnecessary vmodmask
indirection.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-16 13:59:24 +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 9452165837 Plug leaks in geometry parsing
When parsing a geometry file, don't leak the elements we've created.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-15 09:44:55 +00:00
Daniel Stone 937d40492c Remove more float support
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-15 09:33:56 +00:00
Daniel Stone 3560bf7bf4 Also update vmod -> indicator maps
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-15 08:36:09 +00:00
Daniel Stone 0e0b5b00af Update modifiers after building keymap
The server used to have to go and do this on our own, but we can do
better than that: after we've compiled the keymap, go through and bind
virtual modifiers to everything that needs it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 18:24:37 +00:00
Daniel Stone 62444a117c Convert interp action from xkb_any_action to xkb_action
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 17:06:09 +00:00
Daniel Stone 4e704e7fae Add xkb_get_syms_by_level
Which allows you to pass in a group and a level rather than a
fully-formed state.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 17:05:09 +00:00
Daniel Stone 3d38da0c5b Fix leak in xkbcomp.c
Accidentally regressed this one briefly, oops.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 17:04:36 +00:00
Daniel Stone 54aa839c0e Remove component listing code
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 12:00:54 +00:00
Daniel Stone 3ee370e969 Remove unused control members
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 12:00:54 +00:00
Daniel Stone 5dd817339d Add a tiny bit of documentation to xkbcommon.h
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-14 11:56:59 +00:00
Daniel Stone bc07452542 Add xkb_key_get_syms API
(And a slight cosmetic header reformatting.)

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-13 19:06:05 +00:00
Daniel Stone 9dde0f3371 Revert "Use XKB_COMMON_* modifier defines in ExprResolveModMask"
Because indices and masks are not at all the same thing.

This reverts commit 645275406f.
2012-03-13 12:46:37 +00:00
Daniel Stone 645275406f Use XKB_COMMON_* modifier defines in ExprResolveModMask
Rather than the ones from XKB.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 14:42:30 +00:00
Daniel Stone f9b3a14e08 Remove overlay support as well
Right now we just silently ignore overlay controls, which is probably
bad, but it's not the easiest to fix.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 14:36:30 +00:00
Daniel Stone 24c61d0f78 Remove half-implemented radio groups
It looks like this could never have worked anyway, what with num_rg
always being 0 everywhere.  Remove it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 14:27:06 +00:00
Daniel Stone e7c8bac79d Remove indirect XkbCM* and XkbSM* macros
The XkbKey* macros used to work through XkbCM* and XkbSM* variants, for
the xkb_map and xkb_server_map respectively; the latter versions weren't
used by anyone at all, so just bin them and make the macros work
directly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 14:08:43 +00:00
Daniel Stone 671ab1bf8f Handle XkbFiles without a name
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 13:54:03 +00:00
Daniel Stone c8fd3ea4b6 Move allocation of xkb_desc into CompileKeymap
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10 13:48:13 +00:00
Daniel Stone 971eb485c5 Clean up xkb_keysym_to_string message
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 20:01:33 +00:00
Daniel Stone 17bcc4c163 Remove geometry even harder
Not the most elegant fix, but will do for now.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone a0e756fd83 Introduce xkb_atom_t type
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00