Commit Graph

448 Commits (a1f8440d700c7a0b10494d0183fb92b66bda54e3)

Author SHA1 Message Date
Ran Benita 793908a046 Remove unused 'compiled' field in XkbFile
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:36 +01:00
Ran Benita 5fb494eca9 Remove unused debugging function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:31 +01:00
Ran Benita afa34f3d2f Remove unused function XkbcNameMatchesPattern
Because the function is recursive, the compiler didn't say anything, eh.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:25 +01:00
Ran Benita a641a1859b Use stdbool.h
'Cause defining your own True and False is so 1990's.

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

[daniels: Fixed for xkb_desc -> xkb_keymap changes.]
2012-04-30 17:05:57 +01:00
Ran Benita a39ed85f56 Fix formatting in xkbcomp headers
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Fixed for xkb_desc -> xkb_keymap change.]
2012-04-30 17:00:47 +01:00
Daniel Stone 1f81c0e163 Dump include paths when we can't find rules
Since the most common failure mode here is a failure to properly set the
XKB data path, dump the include path so people at least have a clue
where to look.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-26 16:02:49 +02:00
Alan Coopersmith a1c08536a5 Include strings.h in XKBcommonint.h for strcasecmp etc
POSIX specifies that these functions require <strings.h>, but we were
only including <string.h>.  It did work, but still.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2012-04-26 13:49:00 +02:00
Ran Benita b1e49ff980 Reformat actionHandler dispatch table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +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 8fbd44fde6 Implicitly include config.h in all files
The definitions in config.h should be available in all files an
implementation detail; it can be included through the build system
instead of having each file pull it every time.

This is especially helpful with AC_USE_SYSTEM_EXTENSIONS, as _GNU_SOURCE
and friends can have an effect by merely being defined, which can lead
to some confusion if its effective for only half the files.

And we don't really support a build _without_ config.h; so, one less
thing to worry about.

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 b08629f92b Do not enable yacc trace facility unconditionally
Define DEBUG and set yydebug if you want that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:32 +01:00
Ran Benita 913e0740cb Constify a global table and function arguments
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:23 +01:00
Ran Benita d116aaef9f Remove unused struct definition
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:20 +01:00
Ran Benita 28011e71ad Replace remaining use of Atom instead of xkb_atom_t
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:55:59 +01:00
Ran Benita e9537d50d0 Fix possible overflow in scanner
Also reduce the size of scanBuf given that it's allocated on the stack,
and 1024 is enough.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:54:15 +01:00
Ran Benita 8feba630fa Fix KeyInfo's syms array size calculation
When merging group info from two KeyInfo's, the new size of the keysym
array was off. Fix it to match how it is used a few lines below.

There are also some peripheral fixes, and some comments (took me a
few minutes to get what's going on).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:53:26 +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 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 632d9f0336 Eliminate remaining gcc warnings
Various one-liners (mostly removing unused variables) to make the code
safe for the full set of warnings used by the xorg macros.

On Debian-based systems, flex generates incorrect code resulting in two
warnings about yy_getcolumn and yy_setcolumn having no previous
declaration despite being non-static.  Fedora carries a patch to fix
this, and a bug has been filed on Debian's flex to add the patch:
http://bugs.debian.org/667027

Aside from this, it's now safe for --enable-strict-compilation.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone 495d87b06d Don't parse nonsense Unicode/hex keycodes
If a keysym was specified as "U1039andsomeextrastuffontheend", return
NoSymbol rather than 0x10001039; similarly, return NoSymbol for
"0xdeadbeefhitherehowsyourdaybeen" rather than 0xdeadbeef.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 15:12:04 +01:00
Daniel Stone 151fb4fc6d Remove unused device_spec
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 15:12:03 +01:00
Daniel Stone f249919ec6 include resets group compatibility modifiers #43091
This change makes sure that include does not overwrite previous
compatibility modifier settings when the included files does not
explicitly specify them.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>

[Cross-picked from xkbcomp commit 14470719.]
2012-04-03 15:11:42 +01:00
Ran Benita aeaa623d27 Constify a global table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:12:31 +01:00
Ran Benita c83043b3c1 Make temporary fix for stale xkb_atoms
When xkb_free_keymap is called the atoms are all free'd, but action.c
keeps a global copy of interned "true" and "false", which remains stale.

The correct fix is to remove the need for the ActionsInit function
entirely.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:12:27 +01:00
Ran Benita 3c9493795b Fix bugs to allow multiple keymaps in one process
These were several initializations that were forgotten in the previous
memory leak fixes.

Now several xkb_desc's can coexist (relatively) peacefully.

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

[daniels: Only the atom.c is relevant with the new context API.]
2012-04-02 13:11:59 +01:00
Ran Benita ffb610c943 Remove useless check from xkb_intern_atom
The "makeit" variable is always true. Remove it and de-indent.
(Also change the type of the "len" variable to size_t to avoid some
useless casting).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:10:52 +01:00
Ran Benita 7a7ec9b14a Avoid leak in CompileKeymap error path
The NULL check is unneeded, and prevented the atoms from being free'd.

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

[daniels: Updated for xkb_map_unref.]
2012-04-02 13:10:38 +01:00
Ran Benita 84ec6b61a7 Add a NULL check before before strcmp'ing
The names array can have NULL entries for some virtual modifier indexes.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:09:40 +01:00
Ran Benita 8f2c9597ba Use straight strtok_r instead of wrapper
strtok_r is POSIX-2001 and should be fine.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:09:21 +01:00
Ran Benita fb606b06a9 Avoid use of partly initialized VModInfo in error path
Such as:

Compiling path: ./test/data/bad.xkb  mapName:
==1300== Conditional jump or move depends on uninitialised value(s)
==1300==    at 0x4E46166: HandleVModDef (vmod.c:90)
==1300==    by 0x4E3FEC9: HandleKeyTypesFile (keytypes.c:1035)
==1300==    by 0x4E3FBE1: HandleIncludeKeyTypes.constprop.11 (keytypes.c:387)
==1300==    by 0x4E401DD: HandleKeyTypesFile (keytypes.c:1022)
==1300==    by 0x4E3FBE1: HandleIncludeKeyTypes.constprop.11 (keytypes.c:387)
==1300==    by 0x4E401DD: HandleKeyTypesFile (keytypes.c:1022)
==1300==    by 0x4E4026F: CompileKeyTypes (keytypes.c:1150)
==1300==    by 0x4E3DF9B: CompileKeymap (keymap.c:169)
==1300==    by 0x4E465E9: compile_keymap (xkbcomp.c:205)
==1300==    by 0x4E46BE4: xkb_compile_keymap_from_file (xkbcomp.c:290)
==1300==    by 0x400B37: test_file (filecomp.c:47)
==1300==    by 0x4008E3: main (filecomp.c:90)
==1300==  Uninitialised value was created by a stack allocation
==1300==    at 0x4E3FB3F: HandleIncludeKeyTypes.constprop.11 (keytypes.c:366)

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:09:06 +01:00
Daniel Stone cc5588c65b Fail gracefully on failure to find component include
If we can't find the component of the include file we're looking for,
make sure we don't return success when we meant failure, segfault, or
spectacularly leak everything.

Tested with incorrect component includes for keycodes, compat, symbols,
and types.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 17:39:11 +01:00
Daniel Stone 93ce9c7d4f Full support for multiple keysyms per level
Which also involved moving the global symbol map to be per-key instead;
this should probably be split out into a separate commit.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 16:31:09 +01:00
Daniel Stone 9cdc1990fa Parsing support for multiple keysyms per entry
Instead of allowing only one keysym per level per group, do as the
external API indicates and allow multiples.  The existing syntax is:
    key <AD01> { [ q, Q ] };
where the new syntax is:
    key <AD01> { [ q, Q, { H, E, L, L, O },
                 { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G } };

to make the key in the extreme top left of the keyboard do pretty
surprising things in levels 3 and 4.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 01:57:06 +01:00
Daniel Stone 36b8771e1f Don't leak strings in merge declarations
Introduced by the reentrant scanner commit.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 01:49:55 +01:00
Daniel Stone aa9f2bf98d Don't leak include_paths in context
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 01:41:40 +01:00
Daniel Stone 6628cf0bed Remove unused rtrnValue declaration
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-28 19:50:45 +01:00
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 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
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 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 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
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 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 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 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 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 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 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
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 57b551a418 Ensure we always have a complete keymap
Refuse to compile without keycodes + compat + types + symbols.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone 4bc451bf08 Convert CompileKeymap to early-return style
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +00:00
Daniel Stone 59e03bf5f2 Use compile_keymap in xkb_compile_keymap_from_components
We already had this exact function sitting right next to us, so use it
rather than open-coding.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +00:00
Daniel Stone 73919568b0 Add explicit braces
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +00:00
Daniel Stone aa41ab2918 xkbcomp: Turn an array into an anonymous struct
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +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 ed18e65eac Merge remote-tracking branch 'ran/fixes-cont'
Conflicts:
	src/xkbcomp/expr.c

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-05 15:07:28 +00:00
Daniel Stone 65e1ff2f0a Merge remote-tracking branch 'ran/fixes' 2012-03-05 15:00:39 +00:00
Ran Benita e4b4d6b051 Fix "Could not resolve keysym" errors
On many layouts, the following error appears:
Internal error:   Could not resolve keysym 10005b0
(Which is like the trademark of libxkbcommon now, and makes
unicode-heavy symbol files pretty useless).

This occurs when a keysym string (in this case, 10005b0) is passed to
xkb_string_to_keysym, but cannot be resolved.
This in turn happens because the parser passes on hexadecimal keysym
strings without the leading "0x", thus leaving the resolving function
without a way to disambiguate it as a number.

Therefore, make sure to pass on the "0x". The file symbols.c in xkbcomp
project does the same; it probably got lost in translation.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 2473444f92 Refactor XkbFindFileInPath
Also fixes a bug, where the check (typeLen < 1) should have been
(pathLen < 1).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 19e99bb27a Free all atoms along with keymap
The code to do this is taken from xserver, dix/atom.c.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita d94d9b4522 Free IncludePath when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 1e6f956e36 Free scanFile when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita e4447f8131 Fix other misc leaks
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 30d88b93e7 Don't leak the scanner's buffer
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c24d97e45e Don't leak DoodadInfo's from GeometryInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c800c60ace Don't leak ActionInfo's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita d67e73bdbd Don't leak KeyNamesInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 5c40bee62a Don't leak the "minimum"/"maximum" string
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c50c87bca2 Don't leak the various *Info's names when overriding them
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 889a299e3b Free XkbFile's when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita c357a11aa6 Add function to free XkbFile's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:04:04 +02:00
Ran Benita 3216ecc07f Don't cache loaded rules files
This needlessly occupies memory for the lifetime of the library, and
does not make a noticeable difference otherwise.

This rules file won't be loaded more than once in most cases anyway, so
just load it again when it happens.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-04 00:02:14 +02:00
Ran Benita ca9829ea66 Don't cache parsed files
This needlessly occupies memory for the lifetime of the library, and
does not make a noticeable difference otherwise.

Instead, just parse the same file again when it happens.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 23:59:43 +02:00
Ran Benita a64e970809 Remove unneeded freeing mechanisms
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita c7bf368780 Make the sections array local to the keymap compiling function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita baf6a677dc Remove unused global type tokens
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita f549ce078f Use global tables for action string handling
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita d2c3dd0c21 Constify some more text functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita eb738b13ce Constify global tables
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita a0b442356c Use limits.h to find min/max short value
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 266dfae589 Remove useless casts
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 1616b8642c Use strchr instead of index
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03 01:17:57 +02:00
Ran Benita 4bc839ab89 Use memset instead of bzero
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita a3e40917ee Remove return's at the end of void functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita f278cea107 Remove all uses of the register keyword
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita f424251244 Use strdup instead of strlen + malloc + strcpy
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita 6a34e4e19a Don't check for NULL before free()
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-02 22:41:20 +02:00
Ran Benita c41061a005 Use yacc-generated header instead of tokens.h
The yacc implementation can generate all the necessary token
definitions itself; there is no need to maintain a hand written
file for that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:45:29 +02: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
Ran Benita ad4f195eb4 makekeys: Receive the keysym files as arguments
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:09:37 +02:00
Ran Benita 04e687c9da makekeys: Fix build/target word size mismatch when cross-compiling
This matches commit 24283d40b1e4314c6647dda49d2a159833341a8b from
libX11:

    Since makekeys is built using build environment's compiler and
    runs natively, we have to make sure that the size of the
    Signature type is the same on both the native environment
    and the target, otherwise we get mismatches upon running X,
    and some LSB test failures (xts5).

    Use an unsigned 32-bit integer on all platforms.

    Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
    Reviewed-by: Daniel Stone <daniel@fooishbar.org>

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:08:55 +02:00
Ran Benita 744527e9a9 Fix remaining warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita eff72fab5d Fix warnings in scanner and parser
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita 1d969c5cf6 Fix an incorrect sizeof
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita f3e4335fc6 Fix all constness warnings
These are all trivial/obvious fixes which clear a bunch of warnings.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita cca1c05097 Fix possible null dereferences
Fix all reported null dereferences from clang-analyzer.
There seems to be one false negative (in file indicators.c), but it is
fixed anyway.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 12:00:10 +02:00
Ran Benita 9005624f94 Remove unneeded assignments and variables
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:59:56 +02:00
Ran Benita a0dd052644 Remove unused includes of "tokens.h"
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:59:56 +02:00