Commit Graph

116 Commits (5e59ef3f4707c673d325006b662ffdff5d65c7d1)

Author SHA1 Message Date
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 2a0f1780f9 Add context flag to inhibit default include paths
Which will make the context start with no include paths at all.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:52:45 +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 b41c77f8a8 Revert "Unconstify xkb_rules_names"
This reverts commit d007cd0a1f.

This is in fact more restrictive, because it breaks the (common) case
where the strings are const themselved, e.g. "evdev", "us", etc. As is
you must either duplicate the strings or suppress the warnings.

If the user needs to retain the non-const strings, he should instead
just keep them in some other struct and use xkb_rules_names just as
a temporary parameter for xkb_map_new_from_names. Mildly annoying but
acceptable.
2012-05-08 17:28:49 +01:00
Ran Benita 1b9635dfb5 Add xkb_state_get_map()
This is very useful because it avoids redundent pointers in structs
and/or parameter passing in the application.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +01:00
Ran Benita 18e6a6a43e Remove Xfuncproto.h and XKB.h from xkbcommon/xkbcommon.h
The kbproto header is already not needed here anymore.

Move the _X_EXPORT's to the corresponding function definitions, and use
straight extern "C" clauses instead of _XFUNCPROTOBEGIN/END.

It also makes more sense to have the EXPORT's in the source files, as it
provides some documentation to the reader, whereas in the header it's
obvious.

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

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:04:11 +01:00
Ran Benita 073a21076c Constify the syms_out argument to xkb_key_get_syms()
The caller should not mess around with these as they come directly from
our internal structs.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:58:44 +01:00
Ran Benita 467d7bb64e Implement missing xkb_state_ref and add return value
xkb_state_ref was missing.

Also modify the _ref functions to return the object instead of being
void. This is a useful idiom:

    struct my_object my_object_new(struct xkb_state *state)
    {
        [...]
        my_object->state = xkb_state_ref(state);
        [...]
    }

Essentially "taking" a reference, such that you don't forget to
increment it and it's one line less (see example in our own code).

A case could also be made for _unref to return the object or NULL, but
this is quite uncommon.

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

[daniels: Updated for xkb_keymap changes.]
2012-04-09 13:57:36 +01:00
Ran Benita 2590b5a15d Fix compiler warnings
(They were not reported, see next commit).
The reset function declaration didn't match its name in the definition;
the _defaults variant matches better with the rest.

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

[daniels: Updated to current master.]
2012-04-09 13:48:00 +01:00
Daniel Stone d007cd0a1f Unconstify xkb_rules_names
Since we never return an xkb_rules_names and it's all user-provided
strings, seems a bit harsh to have it const.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +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 69111405b0 Properly document xkb_key_get_syms
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 12:48:05 +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
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 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 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 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 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 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 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 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 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 0bb24c2d23 Introduce xkb_keysym_t type
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone d67a94d374 Remove atom functions from public API
They're no longer needed since we don't expose any atoms in the
published API anymore.  As a result, we don't need to support external
atom implementations either.  Result!

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone 731e5c40bc Stringify public name types
Ensure that all names under xkb_desc are strings, rather than atoms.

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
Daniel Stone b28823cc59 Remove KcCGST names from the map
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 16:04:00 +00:00
Daniel Stone f57dcfebf4 Raise keycode range to 32 bits
\o/

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:51 +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