Commit Graph

983 Commits (1651e5af465f45f9b6fff7e65ab958425ccda00b)

Author SHA1 Message Date
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
Ran Benita 9ad0be3358 Remove unused debug #defines
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-25 11:11:10 +02:00
Daniel Stone 90f04e042b Perform bounds checking in ExprResolveLevel
Both callers perform the same bounds check, so move it into
ExprResolveLevel itself.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 18:07:29 +00:00
Daniel Stone 1ab058bbb3 Fix typo in ExprResolveKeyCode
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:47:46 +00:00
Daniel Stone e209fe31df Perform bounds checking in ExprResolveGroup
Every caller did the exact same check on the group bounds after calling
ExprResolveGroup, so might as well do it inside.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:33:39 +00:00
Daniel Stone 43ed3ff070 Switch expression resolution priv from char to void
Avoids a lot of really lame casts.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:14:04 +00:00
Daniel Stone eb6d9a0528 Remove chaining support from LookupModMask
Turns out we never use it, so.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:09:06 +00:00
Daniel Stone 11ea079175 Invert LookupModMask/LookupVModMask order
We never want to solely lookup a virtual modifier without also looking
up core modifiers.  So, rather than chaining the vmod lookup inside the
core modifier lookup, invert the ordering.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:07:48 +00:00
Daniel Stone 1a2f2556dd Remove unused LookupPriv::priv
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 17:00:51 +00:00
Daniel Stone 55e058f856 Move some definitions from expr.h to expr.c
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:59:51 +00:00
Daniel Stone 90d86c360a Remove field reference lookup support
None of the lookup functions anyone ever used supported field
references, so don't pretend we do in the API.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:54:54 +00:00
Daniel Stone 590df28cc5 Move groupNames mask definition to its user
groupNames was declared in compat.c as a global to anything which
included compat.h (for which groupNames was its sole reason to exist),
but only ever used in indicators.c.

Which is kind of fortunate, given that e314931e removed identical
definitions of groupNames (as integers, not masks) from both action.c
and symbols.c.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:35:39 +00:00
Daniel Stone 91b8985297 Turn ExprResolveInteger into a simple wrapper
Move the bulk of ExprResolveInteger into an internal function called
ExprResolveIntegerLookup, and introduce ExprResolveInteger as a simple
wrapper which doesn't take priv/lookup arguments.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:24:02 +00:00
Daniel Stone d32822e60f Open-code a radio group SimpleLookup
Because, joke's on you, it wasn't actually looking up radio groups.
Just checking to see if it was a string that was "none", or an integer.

Lord give me strength.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 16:06:01 +00:00
Daniel Stone e314931e8f Add ExprResolveGroup helper
Just a dumb wrapper around ExprResolveInteger.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 15:49:38 +00:00
Daniel Stone 8b47dbbf61 Add ExprResolveButton helper
Just a dumb wrapper around ExprResolveInteger.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 15:47:38 +00:00
Daniel Stone 3431a089cf Introduce ExprResolveLevel helper
Which returns an integer representing the level number represented by
the given expression.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 15:37:53 +00:00
Daniel Stone 193e9b3913 Introduce ExprResolveRadioGroup helper
Just a tiny special-cased version of ExprResolveInteger.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 15:33:40 +00:00
Daniel Stone 26285a7bd9 Remove priv arguments from ExprResolveString
They've never been used.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 14:15:08 +00:00
Daniel Stone b7b49eb0f7 Remove priv arguments from ExprResolveKeySym
They've never been used by its one caller.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 14:10:41 +00:00
Daniel Stone 70033b132b Remove priv arguments from ExprResolveKeyName
They've never been used.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 14:08:55 +00:00
Daniel Stone 482d4faaa1 Remove priv arguments from ExprResolveBoolean
They've never been used.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 13:44:27 +00:00
Daniel Stone 9404157571 Remove priv arguments from ExprResolveFloat
They've never been used.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 13:40:34 +00:00
Daniel Stone 3151ce36fa Remove priv arguments from ExprResolveModMask
What with them now being unused and all.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 13:34:36 +00:00
Daniel Stone 67605d2c90 Introduce ExprResolveVModMask
Which is just a slightly more typesafe wrapper around the chained
ExprResolveModMask everyone was using earlier.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20 13:32:09 +00:00
Daniel Stone fbb82199ee Respect explicit minimum/maximum keycodes
Make sure we carry over an explicit minimum/maximum keycode setting,
rather than just using the computed minimum/maximum; this got broken
while changing the keycode range to be unsigned.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-16 11:18:49 +00:00
Daniel Stone c45cdb0c67 Still more memory leak fixes
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-16 00:22:11 +00:00
Daniel Stone 83f18b1c3a Fix xkbparse.y compilation
Thanks to autotools happily building stale generated sources, I hadn't
actually ever built my xkbparse.y changes.  Fix that so it not only
compiles, but works.  This seems to parse long keycodes correctly,
although I very much would not recommend testing this by declaring
0x1fffffff as your highest keycode.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 19:39:33 +00:00
Daniel Stone eb8c96cbd9 Don't leak SymbolsInfo
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:42:45 +00:00
Daniel Stone 67c874d76d Enable stderr debugging by default
(If debugFlags is set to non-zero.)

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:51 +00:00
Daniel Stone 1a6c3807d6 vmod: Pass xkb_desc explicitly to vmod functions
Some error paths don't set info->xkb correctly, so just do like most
utility functions and pass the xkb_desc explicitly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:50 +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 8f01b14412 xkbscan: Copy, rather than assign, file name
For some reason, lex decided to reduce a strcpy into an assignment,
leading to entirely justified valgrind warnings about invalid reads,
when scanFile was set to a string which may have only ever lived on the
stack of a now-exited function.

Make it a strdup() instead.

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
Rob Bradford 615291f1f4 xkbcomp: Silence warning of return of uninitialised value
Some routes through HandleGeometryVar do not set a return value. Set a default
value for the return variable to avoid returning an uninitialised value.
2012-01-05 14:24:11 +00:00
Pekka Paalanen c19661b965 Add xkbc_free_keymap helper
Which just calls XkbcFreeKeyboard with the only arguments you'd ever
pass it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-12-16 12:52:00 +00:00
Rob Bradford 99e29de22d xkbcomp: Copy the string into the buffer rather than updating pointer
Avoids assigning the global pointer to a value that may only have a stack
lifetime:

Fixes valgrind warnings such as:

==24795== Invalid read of size 1
==24795==    at 0x4A06E9A: strcpy (mc_replace_strmem.c:311)
==24795==    by 0x4E54D68: ProcessIncludeFile (misc.c:73)
==24795==    by 0x4E59726: HandleIncludeSymbols.constprop.3 (symbols.c:829)
==24795==    by 0x4E59D8E: HandleSymbolsFile (symbols.c:1673)
==24795==    by 0x4E5A068: CompileSymbols (symbols.c:2211)
==24795==    by 0x4E51A61: CompileKeymap (keymap.c:155)
==24795==    by 0x4E5B410: xkb_compile_keymap_from_components (xkbcomp.c:236)
==24795==    by 0x4E5B587: xkb_compile_keymap_from_rules (xkbcomp.c:161)
==24795==    by 0x405ED2: display_create (window.c:2007)
==24795==    by 0x403732: main (desktop-shell.c:320)
==24795==  Address 0x7fefff0a0 is just below the stack ptr.  To suppress, use:
--workaround-gcc296-bugs=yes
==24795==
==24795== Source and destination overlap in strcpy(0x7fefff430, 0x7fefff430)
==24795==    at 0x4A06F3D: strcpy (mc_replace_strmem.c:311)
==24795==    by 0x4E54D68: ProcessIncludeFile (misc.c:73)
==24795==    by 0x4E59726: HandleIncludeSymbols.constprop.3 (symbols.c:829)
==24795==    by 0x4E59D8E: HandleSymbolsFile (symbols.c:1673)
==24795==    by 0x4E5A068: CompileSymbols (symbols.c:2211)
==24795==    by 0x4E51A61: CompileKeymap (keymap.c:155)
==24795==    by 0x4E5B410: xkb_compile_keymap_from_components (xkbcomp.c:236)
==24795==    by 0x4E5B587: xkb_compile_keymap_from_rules (xkbcomp.c:161)
==24795==    by 0x405ED2: display_create (window.c:2007)
==24795==    by 0x403732: main (desktop-shell.c:320)
2011-10-27 14:30:21 +01:00
Cyril Brulebois f91afe4f3e Add prototype for CheckDefaultMap().
Those warnings disappear accordingly:
|   CC     parseutils.lo
| parseutils.c:742: warning: no previous prototype for ‘CheckDefaultMap’
|   CC     xkbscan.lo
| xkbscan.l: In function ‘XKBParseString’:
| xkbscan.l:220: warning: implicit declaration of function ‘CheckDefaultMap’
| xkbscan.l:220: warning: nested extern declaration of ‘CheckDefaultMap’

Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-03 17:19:09 +02:00
Cyril Brulebois 621c2a7a8c Get rid of unneeded <X11/Xlib.h> include.
There's no need for this xlib include:
|   YACC   xkbparse.c
|   CC     xkbparse.lo
| xkbparse.y:98:22: error: X11/Xlib.h: No such file or directory

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2011-01-29 14:10:35 -05:00
Kristian Høgsberg a63e82be2a Rename XkbcInternAtom() to xkb_intern_atom() and export
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2011-01-29 14:10:22 -05:00
Gaetan Nadon 2422c41b8e config: add keysymdef and xf86keysym as dependencies of ks_tables.h
This would cover the scenario where these headers file are updated,
for example, a new version is installed. Running 'make' again
on libxkbcommon should rebuild ks_tables.h.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:56 -05:00
Gaetan Nadon 69e52ad901 config: makekeys prog should stand alone in the makekeys directory
This program is a utility to generated a header file.
The header file it generates should not be located in the
directory where this utility program is compiled.

Move the /makekeys dir as a sibling of /src.
This reduces the number of bi-directional relationships
between directories.

Make corresponding makefiles simplifications.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:56 -05:00
Gaetan Nadon 89377d5cd1 config: use existing variables KEYSYMDEF_H and XF86KEYSYM_H
These automake variables are not currently used.
The variable KS_HEADERS is not required anymore.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:56 -05:00
Gaetan Nadon f507660421 config: let Automake handle Lex and Yacc dist and cleaning
BUILT_SOURCES and MAINTAINERCLEAN are not needed for lex and yacc
Note that xkbscan was missing on those lines.

Automake generates all the rules to handle building, distribution
and cleaning.

Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-08 15:24:21 -05:00
Gaetan Nadon 63e2719a8f config: replace deprecated INCLUDES with AM_CPPFLAGS
Fixes automake warning.

Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-08 15:24:21 -05:00
Gaetan Nadon ceba14dc3e config: update subdirs .gitignore
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-07 10:23:18 -05:00
Jan Engelhardt f8301ebc56 xkbscan: resolve build warning/rpmlint error
xkbscan.l: In function 'setScanState':
xkbscan.l:201:1: warning: control reaches end of non-void function
I: Program returns random data in a function
E: libxkbcommon no-return-in-nonvoid-function xkbscan.l:201

Change return type of setScanState to void, since a return value is
never used by its callers.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
2010-11-11 23:27:21 +01:00
Jon TURNEY f94a64cc08 Link with -no-undefined
Use -no-undefined to assure libtool that the libxkbcommon library has
no unresolved symbols at link time, so that libtool will build a shared
library on platforms require that all symbols are resolved when the
library is linked.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2010-10-26 14:11:38 -04:00
Kristian Høgsberg 8d2c522f31 Don't check for xlib, we don't need it 2010-10-21 21:34:41 -04:00
Kristian Høgsberg c88439dbf0 Update xkb->ctrls->num_groups when copying the keysyms
This used to be set when we read an XKM file.
2010-10-20 22:27:07 -04:00
Kristian Høgsberg 125691573c Restore compatible action structs
This unbreaks the X server code to serialize an xkb_desc, but loses the
32 bit vmod fields.  Needs some work...
2010-10-20 15:57:45 -04:00
Kristian Høgsberg a84c08795e Use flex for generating the scanner, add support for parsing from strings
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-10-20 14:03:53 -04:00
Kristian Høgsberg e879828717 Don't return a static buffer in public API 2010-10-08 15:33:18 -04:00
Adam Jackson 73ca959d7b Dead code removal and static markup
Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-09-27 16:06:48 -04:00
Kristian Høgsberg fb05ee47bf Remove libxkbfile dependency for real this time 2010-09-03 20:35:28 -04:00
Kristian Høgsberg 20bfe1280d Use const char * in struct xkb_rule_names 2010-08-29 21:30:10 -04:00
Kristian Høgsberg be2bd66181 Pull in a few #defines from libxkbfile and lower kbproto requirement 2010-08-25 14:51:52 -04:00
Kristian Høgsberg b3805a2360 Get rid of a few unused #defines in public header 2010-07-02 14:21:59 -04:00
Kristian Høgsberg 97fbc348b0 Rename XkbRMLVOSet to struct xkb_rule_names 2010-07-02 14:21:52 -04:00
Kristian Høgsberg 15f259993e Move private structs and defines to private headers 2010-07-02 12:20:59 -04:00
Kristian Høgsberg 3f0034a990 Rename public entry points to lowercase and underscore 2010-07-02 12:20:59 -04:00
Kristian Høgsberg 9f6026867a Pull in enough structs and defines from XKBstr.h to only need XKB.h
We want to move away from sharing implementation structs and let libX11
and libxkbcommon use each their own set of structs.
2010-07-02 12:20:54 -04:00
Kristian Høgsberg 8e653493d0 Fix warning from CARD32 -> uint32_t conversion 2010-06-30 17:31:34 -04:00
Kristian Høgsberg e10e16ad2f Constify XkbcAtomText()
Atoms aren't mutable and this lets us put tbGetBuffer() back in the box.
2010-06-30 17:30:42 -04:00
Kristian Høgsberg d95b289367 Make XkbcInitAtoms() call optional 2010-06-30 17:13:21 -04:00
Kristian Høgsberg 0ece2cdbaf Drop more malloc/free wrappers 2010-06-30 16:56:24 -04:00
Kristian Høgsberg a76df86572 Use the right action structs
We were casting the union members to the wrong action structs (from kbproto).
2010-06-30 16:33:25 -04:00
Kristian Høgsberg 1723ef1bc7 Copy over missing action structs from kbproto 2010-06-30 15:48:39 -04:00
Kristian Høgsberg 9258cc3dca Rename Xkbc*Action to struct xkb_*_action 2010-06-30 13:31:21 -04:00
Kristian Høgsberg 399d4bd678 Drop malloc wrappers 2010-06-28 06:58:01 -04:00
Kristian Høgsberg 47d3b3969b Drop CARD32 and Opaque types 2010-06-28 06:50:12 -04:00
Daniel Stone 2fb329c964 Copy and duplicate XkbModsRec and XkbKTMapEntryRec
Copy these types in so we can extend the vmod size.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-23 16:25:10 +01:00
Daniel Stone 8693c2652c Add really rudimentary rules caching support
Keep the parsed form of the last-used rules file around, and reuse that
if we get asked for the same ruleset.  If not, bin it and cache the
other one.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone 7257d4c89e Use CARD32 instead of Atom, move geom headers in
Use CARD32 instead of Atom/KeySym/et al to avoid type size confusion
between server and non-server code; relatedly, move the geometry headers
in from kbproto, so every non-simple type (i.e. structs containing
nothing more than basic types) is now copied into xkbcommon.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone b38525421f Interp: More lazy keysym resolution
Resolve the keysyms when we create an InterpDef, rather than directly
in the parser.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone 2c4a045aca Allow external atom databases
Allow people to plug in an external atom database (e.g. the X server's),
so we don't have to migrate our own atoms over later.  We are a bit
over-keen on atoms at the moment, so it does pollute the atom database a
bit though.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone 15b0db5492 Copy in XkbCompatMapRec and XkbSymInterpretRec
These contain actions, so transition them ahead to XkbcAction and move
them into XKBcommon.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone 60e7eeeba1 Use CARD32 instead of Atom, drag in XkbClientMapRec
On 64-bit architectures, XID varies in size between the server (always
32 bits), and non-server (always unsigned long) for some inexplicable
reason.  Use CARD32 instead to avoid this horrible trap.

This involves dragging in XkbClientMapRec so we don't get stuck in the
KeySym trap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:12 +01:00
Daniel Stone d2d787df65 Regroup actions into current vs. deprecated, resize vmod
Use Xkbc* for all our actions that we intend to keep around, and Xkb*
for deprecated ones we can hopefully get rid of, at least internally.

While we're at it, make vmods be a uint32_t.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone e564235b43 xkbcomp: Don't malloc() and free() most scanned tokens
Use a constant buffer instead.  Sigh.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone f246db20f4 Fix compilation with DEBUG
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone acc467de9f xkbcomp: Use fread() instead of getc()
So, it turns out that if you're parsing a fairly large amount of data,
using getc() to get all the input rather than, say, read(), is some kind
of remarkably daft and unperformant idea.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 240a0c3409 xkbcomp: Lazy keysym parsing (avoid XStringToKeysym)
Instead of calling XStringToKeysym on every keysym we parse, store it as
a string until we need to store it in an actual keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 48baabeb38 Atoms: Avoid allocations in XkbAtomText()
XkbAtomGetString() returns a freshly-allocated string, whereas
XkbAtomText() returns the same in a temporary buffer.  XkbAtomText used
to call XkbAtomGetString() and then free the result, which seems quite
spectacularly pointless when you think about it.  Shuffle the atom code
around so we don't have to allocate for XkbAtomText().

This changes semantics slightly wrt non-printable characters, but I
haven't been able to see any effect so far.  And it may well be ever so
slightly quicker.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone a0e180b083 Expose tbGetBuffer to the rest of libxkbcommon
This will let us implement XkbAtomGetString on top of XkbAtomText,
instead of having the latter get a duplicated string, dump it into a
temporary buffer, and subsequently free it (sigh).

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 4346e0065b xkbcomp: keycodes: Silence gcc warnings
It was right to warn us: some of these were actually bogus.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 5df3dff741 xkbcomp: geometry: Plug numerous atom text & expr leaks
This code is absolute misery.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 18039a6c0b xkbcomp: Atom text and expr leak fixes part #973
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone a22386d402 xkbcomp: Don't leak atom text and string exprs, again
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:56 +01:00
Daniel Stone 8904c6eea7 xkbcomp: expr: Use XkbcAtomText instead of GetString
This returns us a temporary string, rather than leaking the atom.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone ad0a3d7c52 xkbcomp: Don't leak atom text and string exprs
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone d20bdd3b9a xkbcomp: vmod: Don't get and immediately intern atoms
XkbcInternAtom(XkbcAtomGetString(atom)) has to be the most spectacularly
broken antipattern I've yet seen.  Just compare the atoms directly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone 50a037cacf xkbcomp: Replace open-coded strdup
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone 85b7f47d8a Add XkbcCanonicaliseComponents
Canonicalises two sets of components (new and old), e.g.:
new: +bar
old: foo
result: foo+bar

This is required as part of the spec, so clients can reuse part of the
device's old keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone 70b64213ca Make keysym <-> string conversion public API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone 62eb167d56 XKB: Text: Use keysym <-> string conversion from keysym.c
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone cdc735c8ca Keysym: Fix conversion for Unicode and bare numbers
Ensure that Unicode string representations are accepted and turned into
numbers, as well as hexadecimal numbers in 0xabcd1234 form; unknown
keysyms are output as 0xabcd1234 in string form.

This also ensures that strings are never returned malloc()ed.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:50 +01:00
Daniel Stone 8e3239a78f KeySym: Actually handle NoSymbol
Add NoSymbol into the keysym table, so keysym <-> string conversion works for
that, too; also eliminate special-casing of VoidSymbol.

This will require special-casing in libX11 to preserve its API.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-25 14:56:57 +10:00
Dan Nicholson 4e854a21aa listing: Drop unused deviceSpec argument
The server might care about this, but ListComponents is just reading xkb
files.
2009-04-21 23:22:25 -07:00
Dan Nicholson 481deea178 xkbcomp: Another fairly major rewrite of the listing mode
The listing code in xkbcomp had been setup to allocate a set of buffers
with file paths and then later parse through them to find which maps were
needed.

All the allocation (with the additional allocation for the components
list) was making it really slow, so this patch makes everything simpler
by just generating the components list as we walk the directory tree.
2009-04-21 06:16:15 -07:00
Dan Nicholson 18b43f8dfe Rewrite listing code to generate XkbComponentListPtr
In xkbcomp, the listing code printed out the xkb files to stdout and the
caller would parse the output. Here, we can just generate a
XkbComponentListPtr and pass it back.

This should be a series of smaller commits, but there was no clean way to
do it since it's basically a complete rewrite except for the core map
matching logic.

A lot of code used for special printing modes in xkbcomp has been
shedded. Callers can massage the output as they please.
2009-04-19 16:34:12 -07:00
Dan Nicholson 559305a5cb xkbcomp: Kill unused listing code and make functions static
Much of this was only called from xkbcomp and not used to generate
listings for the server.
2009-04-16 21:47:28 -07:00
Dan Nicholson 5983a4e69d Scale back global variables
Some of the global variables were either not used anymore or only used
in the listing code.
2009-04-16 20:01:13 -07:00
Dan Nicholson 9520ea0eb3 Add XkbNameMatchesPattern implementation from xkbfile
The xkbcomp listing code matches a glob type pattern against installed
xkb files. This adds a Xkbc implementation of the pattern matching code.
2009-04-13 06:24:36 -07:00
Dan Nicholson fa183ce354 xkbcomp: Fix use of removed macros 2009-04-13 06:24:36 -07:00
Dan Nicholson 3d4c4d06d5 Revert "xkbcomp: Remove listing sources"
This reverts commit c4c9e36fbf. It turns
out that the listing code is used to support the X_kbListComponents
request (via XkbListComponents).

This will have to be refactored into some reasonable interface instead
of the current usage where the server reads xkbcomp stdout. Gross.
2009-04-13 06:24:36 -07:00
Dan Nicholson 3dee8ac999 misc: Coding-style cleanup 2009-04-13 06:24:29 -07:00
Dan Nicholson 53ead9b575 Use xkbpath API for locating rules
Instead of hardcoding the XKB base directory when searching for rules in
the xkbcomp code, we can extend the xkbpath API to cover rules and reuse
it. That will make it more convenient if it's ever exposed so people can
set their XKB search paths in a reasonable way.
2009-04-11 10:39:55 -07:00
Dan Nicholson abbd141935 Add interface to compile keyboard description from keymap files
We need to support generating a keyboard description from a keymap file
because there are just some cases where RMLVO or ktcsg is not enough.

The map choosing logic has been refactored into its own function and now
supports choosing a named or default keymap.
2009-04-10 12:25:51 -07:00
Dan Nicholson 0280b10df9 Make XkbcInitAtoms externally accessible
Applications (like the server) need to initialize the atoms system
before using the rest of the library. Maybe it should just init itself
implicitly.
2009-04-09 14:29:32 -07:00
Dan Nicholson f5d37e279a Constify public API
There's no reason the arguments can't be const.
2009-04-08 17:59:15 -07:00
Dan Nicholson babae38935 Change CompileKeymapFromRules to take XkbRMLVOSet
Let's use a nice interface now that it's available from XKBrulescommon.h.
2009-04-08 17:54:55 -07:00
Dan Nicholson 6a84a34d86 Remove all non-public API from XKBcommon.h header
The noble intention was to expose all the new API and new generic types
in the split out kbproto headers through XKBcommon.h. It turns out that
would be a massive amount of work in the server. Someday, but first just
wedging in XkbCompileKeymap* would be good.

Most of the API is in new internal xkb*.h headers. In order to allow the
XKBcommon.h header to be used from the server, we can't pull in other
headers from kbproto since the server has its own copies. However, types
that are different (XkbDescRec, XkbAction) still have Xkbc equivalents
here, and I think they should be used in the server.
2009-04-08 07:46:25 -07:00
Dan Nicholson b4a3c39b7e Remove KS macros available in XKBfilecommon.h now
A couple of the XkbcKS* macros become redundant with XKBfilecommon.h
split out in kbproto.
2009-04-07 19:56:41 -07:00
Dan Nicholson 5889cef809 Require strdup and remove utils wrapper
This kills a couple warnings from using the uStringDup wrapper. If you
don't have strdup on your platform, you have bigger issues.
2009-04-05 20:27:35 -07:00
Dan Nicholson 8b100fc0a9 Add action datatypes as defined in the server
Some of the XkbAction types are defined differently in the server, so we
add those to XKBcommon.h and use them here like XkbcDescPtr. We'll have
to deal with the impedance mismatch on the client side later.
2009-04-05 15:15:20 -07:00
Dan Nicholson e0e77b71de Coding style cleanup on key allocation functions 2009-04-05 09:30:15 -07:00
Dan Nicholson a2e597675b xkbcomp: Don't say we're exiting when we're not 2009-04-04 12:50:27 -07:00
Dan Nicholson 85039a0d76 xkbcomp: Give keymap file empty name if none supplied
Ensure that the keymap file topName is not NULL since it gets blindly
dereferenced later.
2009-04-04 12:31:55 -07:00
Dan Nicholson 125ce76f5b xkbcomp: Ensure at least keycodes supplied in components
It seems that at least a non-empty keycodes component is required to
compile a XkbcDescPtr.
2009-04-04 12:21:05 -07:00
Dan Nicholson fdd8a9ec1b xkbcomp: Don't dereference NULL VarDefsPtr 2009-04-04 12:17:50 -07:00
Dan Nicholson 99d2f4a5eb xkbcomp: Refactor keymap file generator 2009-04-04 12:16:04 -07:00
Dan Nicholson 8269cbce81 xkbcomp: Generating components requires rules _and_ layout
This came from trial and error, but it seems that you can generate a
valid keymap with only rules and layout.
2009-04-04 10:02:39 -07:00
Dan Nicholson fa96602d0f xkbcomp: Fail when converting rules to components returns an error
XkbcRF_GetComponents was returning an error but leaving the generated
components alone. This ensures that the broken XkbComponentNamesPtr is
freed and the error is passed up to the caller.
2009-04-04 09:51:33 -07:00
Dan Nicholson e72fc29f33 xkbcomp: Cleanup error messages 2009-04-04 09:48:59 -07:00
Dan Nicholson 83367a8d2d xkbcomp: Ensure user has supplied a rules name 2009-04-04 09:46:20 -07:00
Dan Nicholson 5d95a43ad0 Refactor xkbpath so that it implicitly initializes
Instead of requiring the user to call XkbInitIncludePath() and
XkbAddDefaultDirectoriesToPath(), all the path entry points now implicitly
initialize the path. When initializing, the default directories are added
so it's useful.

This provides normal operation without exposing the xkbpath API. That
might happen later to allow apps to edit the XKB search path.
2009-04-04 09:29:43 -07:00
Dan Nicholson 5c91062334 Remove trailing spaces in source files 2009-04-04 09:19:51 -07:00
Dan Nicholson 51eff3d939 Fix cleanup error in names allocation
A conditional got reversed during the coding style cleanup.
2009-04-04 08:55:23 -07:00
Dan Nicholson c38cdc5ded xkbcomp: Ignore generated parser 2009-04-03 21:18:58 -07:00
Dan Nicholson 3a709e399e xkbcomp: Don't segfault if the debug files aren't set
Another interface that needs to be cleaned up.
2009-04-03 21:17:52 -07:00
Dan Nicholson ec86ce1f1a xkbcomp: Declare global debugging vars
These will need to be sanitized at some point, but for now let's just get
the code running.
2009-04-03 20:34:41 -07:00
Dan Nicholson c14c60bb37 xkbcomp: Back out strdup warning cleanup
There are some spots in the code that use strdup without checking the
argument, so we need this to not segfault. Cleanup later...
2009-04-03 20:34:19 -07:00
Dan Nicholson 5216f0c92f Drop keysym.h pollution from XKBcommon.h
There's really no need to pull this into a public header.
2009-04-02 06:37:16 -07:00
Dan Nicholson db03c9b7e9 xkbcomp: Clean up utils prototypes
Includes using a macro for the gcc format attributes instead of repeated
ifdef's.
2009-03-31 19:32:49 -07:00
Dan Nicholson a27e56b6fb xkbcomp: Remove duplicated macros 2009-03-31 07:21:20 -07:00
Dan Nicholson 05daf09f18 xkbcomp: Kill warnings about address always evaluating as true 2009-03-31 07:09:47 -07:00
Dan Nicholson a8d936bda5 Compile keyboard description from XKB rules, too
XkbcCompileKeymapFromRules can be used to generate a XkbDescPtr from XKB
rules instead of using components. The previous XkbcCompileKeymap has
been renamed to XkbcCompileKeymapFromComponents.
2009-03-31 05:43:08 -07:00
Dan Nicholson 94fd317463 Add rules file parsing from xkbfile
Copy over the Xkb_RF* rules parsing functions from xkbfile's maprules.c.
Eventually, this will be tied into xkbcomp's path searching utilities so
you don't need to supply a full path to the rules file. Also, it this
should eventually incorporate the server's RMLVOSet.
2009-03-30 06:31:26 -07:00
Dan Nicholson 3fc0dcc816 Generate keyboard description from components
Finally, we can generate a XkbcDescPtr from a XkbComponentNamesPtr. This
involves turning the components into a parsed XKB file and then passing
it into the compiler. This first conversion needs more error handling.
2009-03-29 08:55:18 -07:00
Dan Nicholson 1115d55549 xkbcomp: Include Xdefs.h for Atom in tokens.h 2009-03-29 08:17:13 -07:00
Dan Nicholson 587a5d956f xkbcomp: Add missing includes for Bool in xkbpath 2009-03-29 08:15:27 -07:00
Dan Nicholson e86b31ce92 Add XKBlib resizing functions
These were originally in XKBMalloc.c.
2009-03-29 08:11:25 -07:00
Dan Nicholson d43a7bf02f Copy xkbfile IsUpper/IsLower macros
xkbcomp was using Xlib's XConvertCase to check upper/lowercase. That's a
lot of code, so hopefully the xkbfile macros using _XkbKSCheckCase are
good enough. This also required that <X11/keysym.h> is included to get
all the XK_* definitions.
2009-03-28 20:22:28 -07:00
Dan Nicholson eff1c53873 Copy XkbEnsureSafeMapName from xkbfile 2009-03-28 19:00:13 -07:00
Dan Nicholson c4c9e36fbf xkbcomp: Remove listing sources
The xkbcomp listing APIs were only needed for the "xkblist" mode, which
won't be supported here.
2009-03-28 18:50:29 -07:00
Dan Nicholson fe94593d02 malloc/misc/xkb: Coding style cleanup 2009-03-28 18:17:34 -07:00
Dan Nicholson 5315e5d14a Add XKBlib API to support keytypes
Added common variants of XkbComputeEffectiveMap, XkbInitCanonicalKeyTypes
and all their needed functions. A couple functions that were in alloc.c
moved to malloc.c to mirror the libX11 sources better.

Original code in

libX11/src/xkb/XKBMalloc.c
libX11/src/xkb/XKBMisc.c
libX11/src/xkb/XKB.c
2009-03-28 17:55:46 -07:00
Dan Nicholson baa9581d81 geom: Coding-style cleanup 2009-03-28 16:21:25 -07:00
Dan Nicholson 62482b9614 Add geometry Compute API from XKBlib
A small needed subset from libX11/src/xkb/XKBGeom.c.
2009-03-28 16:08:46 -07:00
Dan Nicholson 28de09e515 Add xkbcommon macro for XkbKSIsKeypad and XkbKSIsDeadKey(k)
IsKeypad is used in symbols, but we'll just grab them both. It might be
better to split parts of XKBfile.h out eventually.
2009-03-28 15:51:06 -07:00
Dan Nicholson a53b9b1ed3 Add XkbModIndexText replacement
Now, I think we should have all the *Text functions we need.
2009-03-28 15:32:51 -07:00
Dan Nicholson a59ce8f525 Drop another unneeded format argument
Almost cleared of XkbMessage...
2009-03-28 15:24:06 -07:00
Dan Nicholson 54aea7fe8b Add VMod Text functions from xkbfile 2009-03-28 15:12:30 -07:00
Dan Nicholson 46e5e164d6 Copy XkbAddGeom* functions from XKBlib
These are needed by the geometry compiler in xkbcomp.
2009-03-28 14:22:42 -07:00
Dan Nicholson b0acc97a93 xkbcomp: s/XStringToKeysym/XkbcStringToKeysym/ 2009-03-28 14:22:41 -07:00
Dan Nicholson 1f08ae1e56 Expose all the geometry allocation subroutines
We need a couple in xkbcomp, but they might also be needed externally,
too.
2009-03-28 14:22:41 -07:00
Dan Nicholson 39d7be43c8 xkbcomp: Use xkbcommon allocation functions
s/XkbAlloc/XkbcAlloc/ so we don't know XKBlib.
2009-03-28 14:22:41 -07:00
Dan Nicholson b9335d5810 Kill off usage of Display
The use of Display in xkbcomp always boiled down to passing it to
XkbInternAtom and XkbAtomGetString. This shouldn't be a problem here.
2009-03-28 14:22:41 -07:00
Dan Nicholson 2671b777cf Add more *Text functions from xkbfile
This should cover all the usage in xkbcomp. The format arguments were
dropped except for the special case of XkbModMaskText, which needs to
write in XkbCFile format in HandleVModDef. This was just changed to a
Bool to avoid the need for the macros in XKBfile.h.

The function prefixes have been renamed to be unique from xkbfile.
2009-03-28 14:22:41 -07:00
Dan Nicholson 8544cde52e xkbcomp: Drop unused Display argument in Atom functions
The xkbcommon Atom implementation doesn't take Display into account.
2009-03-28 14:22:35 -07:00
Dan Nicholson 72df9bb35f Move *Text APIs into libxkbcommon
These seem like they might be generally useful, and more will be needed
from xkbfile.
2009-03-28 12:01:36 -07:00
Dan Nicholson 18337008b5 libxkbcomp: Use the internal Atom implementation
s/XkbInternAtom/XkbcInternAtom/ and s/XkbAtomGetString/XkbcAtomGetString/
2009-03-28 12:01:36 -07:00
Dan Nicholson c277d3d438 libxkbcomp: s/Status/int/ since we don't have Xlib.h 2009-03-28 12:01:36 -07:00
Dan Nicholson d5a9be653b libxkbcomp: Drop unused format field for *Text functions 2009-03-28 12:01:36 -07:00
Dan Nicholson 6a578de9cb libxkbcomp: Add non-xkbfile XkbActionTypeText 2009-03-28 12:01:36 -07:00
Dan Nicholson 4fe322aa99 libxkbcomp: s/XPointer/char */
Replace XPointer with its definition since we don't have the privilege
of using Xlib.h. Why this is char * and not void *, I'll never know.
2009-03-28 12:01:36 -07:00
Dan Nicholson 37769b5a10 libxkbcomp: s/XkbDescPtr/XkbcDescPtr/
We need to use the keyboard description structure from XKBcommon.h since
it doesn't have the Display field.
2009-03-28 12:01:35 -07:00
Dan Nicholson dd25bbc9ac libxkbcomp: Eradicate XkbFileInfo usage
The only real usage was in the frontend to generate a .xkm file. The
rest of the code just operated on the attached XkbDescPtr. Note that
here we've replaced the usage of the defined field in CompileKeymap with
the equivalent field in a XkbcDescPtr.
2009-03-28 12:01:28 -07:00
Dan Nicholson f3677538f4 libxkbcomp: Include X.h and Xdefs.h for Atom and Bool 2009-03-27 19:30:11 -07:00
Dan Nicholson 30e0103216 libxkbcomp: Remove usage of client-side headers
This will surely break things. Let's see just what we need to replace.
2009-03-27 19:25:14 -07:00
Dan Nicholson a3809b1340 xkbcomp: Add non-xkbfile XkbConfigText 2009-03-27 18:55:13 -07:00
Dan Nicholson f2308e7e55 Ignore files for xkbcomp 2009-03-27 18:44:39 -07:00
Dan Nicholson 23caa60fa9 Ignore ks_tables.h in makekeys directory now 2009-03-27 18:43:12 -07:00
Dan Nicholson 0c1bbb05d9 Import xkbcomp sources for CompileKeymap
A copy of the xkbcomp sources (except the frontend) have been copied in
to provide a means to compile a XkbDescPtr. This definitely doesn't
build or do the right thing yet.
2009-03-27 06:55:32 -07:00
Dan Nicholson f4d8e2932c Move ks_tables.h build into makekeys subdirectory
This avoids the BUILT_SOURCES weirdness and forcing the build into the
makekeys subdirectory. Added a new make variable KS_HEADERS that lists
all the keysym headers we're going to parse.
2009-03-27 06:46:32 -07:00
Dan Nicholson 433a405c98 atom: Coding-style cleanup and refactor
Some coding style nits were cleaned up. Additionally, most of the
functions have been collapsed from the libxkbfile version where there's
distinction with the Xlib atom functions when Display was set. Finally,
the InitAtoms function tests whether the table has already been created
by testing the pointer rather than using a static int.
2009-03-25 20:06:39 -07:00
Dan Nicholson c88c0ba725 Borrow atom implementation from libxkbfile
We need an atom implementation not relying on XInternAtom and friends.
The original code is in

libxkbfile/src/xkbatom.c
2009-03-25 20:06:39 -07:00
Dan Nicholson 46faf56ded alloc/galloc: Coding style cleanup
Mostly tab-to-space conversion plus a few style nits. Dropped the
register keywords as I'm pretty sure modern compilers can be trusted to
do the right thing.
2009-03-25 20:06:33 -07:00
Dan Nicholson 1ff77ecd36 Rename headers to XKBcommon* and install in extensions directory
Following the kbproto convention, the headers will be named XKBcommon.h
and XKBcommonint.h. Furthermore, they'll be installed in X11/extensions
directory with the rest of the XKB headers.
2009-03-25 19:40:57 -07:00
Dan Nicholson 7417310403 Add XkbDescRec initializers and destructors
Copies the code to initialize and destroy an XkbDescRec from libX11. The
original code is in

libX11/src/xkb/XKBAlloc.c
libX11/src/xkb/XKBGAlloc.c
libX11/src/xkb/XKBMAlloc.c
2009-03-25 19:40:26 -07:00
Dan Nicholson d4ddac2b8d Use XKB alloc macros internally
These are used throughout the XKB code, but are defined in XKBsrv.h,
which we'd like to avoid. Internal definitions for True/False have also
been added since they're in Xlib.h
2009-03-19 16:58:45 -07:00
Dan Nicholson 036c23eaf2 Use generated config.h header 2009-03-19 16:25:34 -07:00
Dan Nicholson a45cdf4b0e makekeys: Fix warning about not returning from function
If we've gotten through the for loop in the alias functions, then we
don't have a match.
2009-03-19 16:25:34 -07:00
Dan Nicholson ffa0ccfad9 Use XORG_CWARNFLAGS for more warnings 2009-03-19 16:25:34 -07:00
Dan Nicholson d60166b507 makekeys: No need for strncat 2009-03-19 16:25:26 -07:00
Dan Nicholson e8c7f68539 makekeys: Handle XFree86 special action keys
For some reason, there are a set of keys that have an underscore after
the XF86 prefix when Xlib gets them from XKeysymDB.
2009-03-19 11:51:10 -07:00
Dan Nicholson c005d63c58 makekeys: Always continue when no alias match found 2009-03-19 11:51:10 -07:00
Dan Nicholson 498935c1bc makekeys: Handle aliases in convenience functions
There's no need to pass the alias buffer down.
2009-03-19 11:51:09 -07:00
Dan Nicholson 6518e5482d makekeys: Prepend XF86 to XFree86 keysyms 2009-03-19 11:51:09 -07:00
Dan Nicholson 79ddd7e530 Refactor makekeys with some convenience functions
All the nested ifs in the parsing code were confusing me.
2009-03-19 11:51:09 -07:00
Dan Nicholson 49cda1187f Move makekeys to separate subdir
The build is a little cleaner when makekeys has its own Makefile.
2009-03-19 11:51:09 -07:00
Dan Nicholson 56c3e7440e keysym: Coding style cleanup
Mostly tab-to-space conversion plus a few style nits. Dropped the
register keywords as I'm pretty sure modern compilers can be trusted to
do the right thing.
2009-03-19 11:51:09 -07:00
Dan Nicholson 83f198f1ae Initial implementation of keysym handlers
Add the xkbcommon implementations of XKeysymToString and XStringToKeysym.
These symbols have the namespace prefix of Xkbc and are declared in
X11/XkbCommon.h.

The implementation is taken directly from Xlib, but does not include the
XKeysymDB parsing and hashing yet (if it ever will). A couple type
conversions were needed to keep from using Xlib.h. See original files:

libX11/src/KeysymStr.c
libX11/src/StrKeysym.c
2009-03-19 11:51:09 -07:00
Dan Nicholson d0a4291e74 makekeys: Handle XF86XK_ keysyms in addition to XK_ keysyms 2009-03-19 11:51:09 -07:00
Dan Nicholson fa6a3d122d Generate keysym tables from X and XF86 keysym definitions
The keysym hash table ks_tables.h is generated by makekeys from
keysymdef.h and XF86keysym.h.
2009-03-19 11:51:09 -07:00
Dan Nicholson 7f64541c30 ks_tables: Remove table-specific #ifdefs and add header guard
Since we'll be including ks_tables.h in a single file, we don't need to
make parts conditional. A header guard has been added just to be safe.
2009-03-19 11:51:09 -07:00
Dan Nicholson ddc3178959 makekeys: Coding style cleanup
Mostly tab-to-space conversion, but a couple other nits, too.
2009-03-19 11:50:57 -07:00
Dan Nicholson 27fe8d1657 Add makekeys for creating keysym hash tables
The makekeys utility is used to generate the keysym hash tables during
the build. We try to detect a build machine native compiler so the
tables can be generated when cross compiling.
2009-03-19 10:54:31 -07:00