Commit Graph

68 Commits (b064b60984fbbe019c8b173b26d1fcd0a4e4df04)

Author SHA1 Message Date
Mladen Milinkovic a2507c0866 Improve misleading comments #270 2022-02-24 12:43:20 +02:00
Ran Benita de1b6943d2 Move include files to include/ subdirectory
This way we don't specify `include_directorories('.')` which brings in
more than needed.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 10:10:26 +03:00
Ran Benita 5e164ff1f9 build: drop the include/ directory
The include/ dir is somewhat redundant and makes it just a bit harder to
handle the -I directives from out side of automake; without it the
default $(top_buildir) just works.
Here's also some further justifications I found:
http://smcv.pseudorandom.co.uk/2008/09/pc-uninstalled/

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Daniel Stone 9308a46039 Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually
fix up a few things: it really likes justifying struct initialisers.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-17 10:20:15 +01:00
Ran Benita 1f49290131 Enlarge keysym name buffers and mention in comment
The longest keysym is 27 chars long.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-12 09:42:20 +01:00
Daniel Stone 8e2c66e9ea Add xkb_key_repeats
Does what it says on the box.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 15:27:05 +01:00
Ran Benita 58b030bb90 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>
2012-06-09 12:34:57 +03:00
Rob Bradford e0524296d2 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.]
2012-06-08 14:04:49 +01:00
Daniel Stone ebd397e184 Add xkb_map_get_as_string
Returns a newly-allocated string representing the specified keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-29 15:07:18 +01: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 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 471e112208 Document that xkb_state_get_map doesn't take a ref
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:52:33 +01:00
Daniel Stone 7a1201bdf2 Change xkb_key_get_syms to just return a bare int
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:51:37 +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 693d0578f2 Include xkbcommon-names.h from xkbcommon.h
So clients only have one file to include.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:17:13 +01:00
Daniel Stone 3e3ddd43e9 Remove keycode_range_is_legal
It was a pretty pointless check.  Also sanitise the _x11 variant to
actually do what it says on the box.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:16:51 +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
Kristian Høgsberg c6897d2698 Add XKB version of X11 keysyms
With this we're now completely standalone.

add vendor 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 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 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