Commit Graph

931 Commits (e670d084a6b4431de2ef3b5395c1473ba4b73725)

Author SHA1 Message Date
Ran Benita e670d084a6 include: improve file-not-found error reporting
Only report it once, and not only for rules.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16 15:20:18 +03:00
Ran Benita 09a4f2ca89 keycodes: add KeyNameInfo
Instead of keeping the two files and names arrays.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-15 13:45:55 +03:00
Ran Benita b979a5e95e keycodes: rename computedMin/Max to min/max_key_code
min/max_key_code is more descriptive and matches the names of these
field in xkb_keymap.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-15 02:25:47 +03:00
Ran Benita 4b69d6f71d keycodes: ignore explicit minimum/maximum statements
These statements are pretty pointless for us; we don't restrict keycodes
like X does, and if someone writes e.g. maximum = 255 but only has 100
keys, we currently happily alloc all those empty keys. xkbcomp already
handles the case when these statements aren't given, and uses a computed
min/max instead. We should just always use that.
(Of course since keycodes/evdev currently uses almost all of the
keycodes in the range it declares, including 255, this doesn't save any
memory for the common user right now).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-15 02:09:34 +03:00
Ran Benita c53122cb96 symbols: remove useless grow_alloc of keys array
This just does a big, mostly too big, allocation to save about a dozen
malloc calls. Remove it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:53:27 +03:00
Ran Benita 9a27ac7253 state: use filter->priv instead of modifying the action
in xkb_filter_group_set_new.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 8098daa08f state: move filter initialization to the dispatcher
This removes all of the boilerplate from the *_new functions, and leaves
them just as simple functions which perform the effect of the action on state.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 2c19c9388b state: call xkb_filter_new from the dispatcher
Pass the new filter as a parameter instead of getting a new one in each
action function, and introducing a failure condition there.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 04f1b3be07 state: dispatch actions from a table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 18a0ead587 Rename ACTION_TYPE_LAST to _ACTION_TYPE_NUM_ENTRIES
It's not really "last" per-se, and we use this other format in some
other enums.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 16425ffad9 state: don't keep the xkb_state in the filters
Just pass it as a parameter: to make state.c a bit less stateful.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita c2570d51d1 state, map: constify references to xkb_key
Makes it clear that we treat the keys as immutible values in these
files.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 841f32230a state, map: use keycodes only for the API functions
The policy is now consistent: every API functions which recieves a
keycode should resolve it to an xkb_key first thing, and all the
internal functions use that instead of the keycode.
To facilitate it a bit, we move the KeycodeInRange check to XkbKey
itself, which returns NULL if the keycode is illegal.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 4d3d2ef004 rules: fix mmap failure handling
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:49 +03:00
Ran Benita 96c21e1577 Clean up Init/Clear functions
- The Clear* functions should just free the memory associated with the
  object. If the object is used again, it is Init'd again.
- s/Free/Clear if the actual pointer is not free'd.
- Zeroise object in Init and only initialize non-zero fields.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 21:09:48 +03:00
Ran Benita 7b5a1dd556 symbols: refactor CoypSymbolsDef
To make it easier to follow.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 00:07:55 +03:00
Ran Benita 4c16b39f31 symbols: FindAutomaticType only needs the context
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 00:07:55 +03:00
Ran Benita 8862fd8082 keyseq: test that de(neo) is working properly
This layout stretches us pretty well, so it's good for testing nothing
breaks. There are a couple of things that need looking into, though
(particularly the level5 issue).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14 00:07:55 +03:00
Ran Benita dd6124ca07 symbols: store actions from symbols in the right offset
This regression was introduced in 93ce9c7d4f. This meant that actions
specified inside key {} statments were always going to the first group.
But actions are almost never specified in xkb_symbols so this wasn't
noticed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 21:09:48 +03:00
Ran Benita 898d6fd416 symbols: remove CopyKeyInfo
The code is better without it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 21:09:48 +03:00
Ran Benita 3abfe83e11 symbols: fix real/alias key merge ordering bug
Background:

The CopySymbolsDef has a comment on a couple of lines which supposedly
fixed a bug:

    /*
     * kt_index[i] may have been set by a previous run (if we have two
     * layouts specified). Let's not overwrite it with the ONE_LEVEL
     * default group if we dont even have keys for this group anyway.
     *
     * FIXME: There should be a better fix for this.
     */
    if (!darray_empty(groupi->levels))
        key->kt_index[i] = types[i];

But neither the comment nor the fix make any sense, because the kt_index
is indexed per group, i.e. each group gets its own type.
The original xkbcomp commit which added this (36fecff58) points to this
bug: https://bugzilla.redhat.com/show_bug.cgi?id=436626
which complains about -layout "ru,us" -variant "phonetic," not working
properly. And indeed when we try:
    sudo ./test/interactive -l ru,us -v
the first group doesn't get any syms for the main keys.

The problem (Clearly the fix above is useless):

The ru(phonetic) map is specified using aliases, e.g. LatQ, LatW instead
of AD01, AD02, etc. When combined with another layout which uses the
real names (AD01, AD02), the symbols code should recognize they are the
same key and merge them into one KeyInfo. The current code does that,
but it doesn't catch the case where the alias was processes *before* the
real one; so we get two KeyInfo's and the later one wins. So e.g. the
ru(phonetic) symbols are ignored.

The fix:

Before adding a new KeyInfo to the keys array, always replace its name
by the real name, which avoids the entire issue. Luckily this is done
pretty late so most error messages should still show the alias name.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 21:09:46 +03:00
Ran Benita 1d6bffc904 symbols: add CopySymbolsToKeymap
Like in the other sections.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita 376e45eb6d symbols: remove mention of keycodes in CopySymbolsDef
Since now we only use the keycode in this function for logging, it's
better not to mention the keycode at all because the XkbKeyGetKeycode
macro is implemented using a dirty hack 0_0
The key name is sufficient to determine uniquely where to look.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita 77ab928e92 symbols: remove unneeded recursion form CopySymbolsDef
This function does some funky stuff, which, as far as I can tell, was
needed to support the functionality of giving different keycodes the
same name and thus make them duplicates (MERGE_ALT_FORM). This stuff was
removed as useless in 0765064b3, but this leftover wasn't noticed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita ce5dbeff60 symbols: add LevelInfo
Add a LevelInfo to hold a single array of level specific info inside
a GroupInfo, instead of keeping the acts, symsMapIndex and
symsMapNumEntries arrays and the numLevels field separate and in sync.
This simplifies the code, and goes a long way toward making  the
key-merging code somewhat understandable. Also uses less memory.

Note that the syms array is still in GroupInfo for now, with the levels
holding offsets into it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita ca87031861 symbols: make xkb_key::syms a plain array
It's never resized.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita ee3ade3924 symbols: shorten symsMapNumEntries to uint from size_t
size_t is too wide for this in 64-bit machines.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita 3cfcbbab38 symbols: consolidate group merging in MergeGroups
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita db45d664d3 symbols: add GroupInfo
GroupInfo keeps all of the info for a specific group in one struct.
This is the old array-of-structures vs. structure-of-arrays, but in this
case readability wins. It would also help with lifting the
XkbNumKbdGroups limit, because we only have to worry about one array
(instead of 6).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita a9fa37396f keymap-dump: don't write spaces between multiple-syms-per-level
This can get a bit unwieldy.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:10 +03:00
Ran Benita 2a5b0c9dc1 symbols: use darray for ModMapEntry instead of list
There's no need for a list here.
[This also happens to be the last place list.h is used.]

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:09 +03:00
Ran Benita 886b0ca502 state: remove unused next field from xkb_filter
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13 15:57:09 +03:00
Daniel Stone 2de55601d8 Update COPYING
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-12 16:58:57 +01:00
Daniel Stone b4b40d73ad Copyright updates
With Dan Nicholson's permission (via email), update his copyright and
license statements to the standard X.Org boilerplate MIT license, as
both myself and Ran have been using.

Clean up my copyright declarations (in some cases to correct ownership),
and add copyright/license statements from myself and/or Ran where
appropriate.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-12 16:58:54 +01:00
Daniel Stone 14cd8c79cd utils: Replace DEC copyright with Ran's
This is not something I do often, but I have good reason here ...

utils.h has been totally rewritten since import, and now contains no
original DEC content.  Everything in here has been added by Ran, and I
do not believe that any lingering content from previous iterations is
substantial enough as to be copyrightable.

Replace DEC's copyright (and license with hostile advertising clause)
with Ran's boilerplate copyright and license statement.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 17:00:38 +01:00
David Herrmann 095a7f4cf0 xkbcommon-keysyms: Add header protection
As there is currently no stable release of xkbcommon, other projects might
want to include a copy of the keysyms so they can be used even though
libxkbcommon may not be available on the machine. However, if xkbcommon.h
is still included, conflicts will occur. Hence, to avoid nasty hacks,
simply include a header protection in xkbcommon upstream.

[daniels: Added protection to Makefile.am's update-keysyms, as well as
          XKB_KEY_NoSymbol, and a comment noting that it shouldn't be
          updated directly.]

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 16:49:04 +01:00
Helio Chissini de Castro e9405fa20d Android.mk: Remove unnecessary for loop
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 15:11:35 +01:00
Daniel Stone 82de180ede Remove unused ExprResolveKeyName
The only user was removed in 314965b1.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 15:09:37 +01:00
Daniel Stone 14741800a8 Constify keysym <-> Unicode lookup table
Before:
  text     data     bss     dec     hex filename
234422    11288    2304  248014   3c8ce obj-amd64/.libs/libxkbcommon.so.0.0.0

After:
  text     data     bss     dec     hex filename
240694     5016    2304  248014   3c8ce obj-amd64/.libs/libxkbcommon.so.0.0.0

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 14:52:27 +01:00
Pekka Paalanen 517c7ed75c xkbcommon.h build fix for missing stdarg.h
In file included from external/collabora/libxkbcommon/src/xkb-priv.h:87,
                 from external/collabora/libxkbcommon/src/xkbcomp/xkbcomp.h:30,
                 from external/collabora/libxkbcommon/src/xkbcomp/xkbcomp-priv.h:30,
                 from external/collabora/libxkbcommon/src/xkbcomp/action.h:30,
                 from external/collabora/libxkbcommon/src/xkbcomp/action.c:27:
external/collabora/libxkbcommon/xkbcommon/xkbcommon.h:279: error: expected declaration specifiers or '...' before 'va_list'

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-11 14:32:58 +01:00
Daniel Stone 9e6ff7bb2a Update Android.mk
Squashed from commits by Helio Chissini de Castro
<helio.chissini.de.castro@collabora.co.uk> and Pekka Paalanen
<ppaalanen@gmail.com>.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 14:27:54 +01:00
Daniel Stone 28bd10cee7 kbproto unentanglement: drop dependency
\o\ \o/ /o/

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 14:10:41 +01:00
Daniel Stone fa1ea9a5bf kbproto unentanglement: XkbGeomPtsPerMM
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 14:09:20 +01:00
Daniel Stone e60e9523c6 kbproto unentanglement: XkbExplicit*Mask
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 14:05:42 +01:00
Daniel Stone 2eab7efc13 kbproto unentanglement: XkbSI_AutoRepeat
That was the only interp flag, so just turn it into a straight boolean.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 12:32:18 +01:00
Daniel Stone a8d462e366 kbproto unentanglement: XkbSI match flags
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 12:28:29 +01:00
Daniel Stone ed9fd5beb0 kbproto unentanglement: control actions
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 12:20:21 +01:00
Daniel Stone 6573aca0b2 kbproto unentanglement: XkbMaxShiftLevel
... by removing its only use.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 21:05:17 +01:00
Daniel Stone 32bf405376 kbproto unentanglement: Xkb{Wrap,Clamp,Redirect}IntoRange
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 21:02:49 +01:00
Daniel Stone 461f8a7697 actions: Remove PointerDefault affect field
This was always set to affect the default button, so no need for it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 20:40:32 +01:00