Commit Graph

1606 Commits (47d6e5a8d9a5260a57a51f2620f193b105281133)

Author SHA1 Message Date
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
Daniel Stone 70c775f69d kbproto unentanglement: action flags
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 20:38:46 +01:00
Daniel Stone b6e0457195 kbproto unentanglement: XkbLC_*
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 20:16:05 +01:00
Daniel Stone 830fe67132 kbproto unentanglement: XkbIM_*
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 20:07:54 +01:00
Daniel Stone 0b2506db12 kbproto unentanglement: action types
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 19:23:36 +01:00
Daniel Stone 314965b1f0 Remove deprecated actions
We didn't do anything with ISO_Lock, ActionMessage, RedirectKey, and the
device-specifying variants of the pointer actions, so remove those.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 19:23:35 +01:00
Daniel Stone b04d896ab2 kbproto unentanglement: XkbNumVirtualMods
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 19:23:35 +01:00
Daniel Stone 74ec4c1c3f kbproto unentanglement: XkbNumIndicators
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 19:23:35 +01:00
Daniel Stone 4b8ceae91f kbproto untanglement: XkbKbdNumGroups
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 19:23:35 +01:00
Daniel Stone f5dffd2b6e kbproto untanglement: XkbKeyNameLength
Define it ourselves as XKB_KEY_NAME_LENGTH and use that, instead of the
one from XKB.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10 18:26:20 +01:00
Ran Benita 3b6b214c78 rules: use goto instead of state variable
There's no noticeable speed difference, but I think it's nicer and more
explicit than the previous code. Some people just don't like goto,
though..

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-05 16:37:43 +03:00
Ran Benita 0071227e7f rules: rewrite
Rewrite the rules file parser for clarity, performance and memory usage
reduction. The previous implementation was quite hard to navigate and
did a lot of unnecessary work and copying.
This implementation keeps along just the state necessary, and doesn't
perform any copying of the file's content (although the entire file is
mmap'ed as before). Hopefully it's also easier to understand, has better
documentation, and better error checking and reporting. We try to
reproduce the previous behavior in every case.

Note: the diff is pretty confusing; it's likely better to look at the
file directly.

Benchmarks:
    On an old 32-bit Intel processor.
    gcc -O2 -pg
    ./test/rulescomp bench
    grof test/rulescomp

    Before:
        compiled 1000 keymaps in 14.863564304s
        %   cumulative   self              self     total
        time   seconds   seconds    calls  ms/call  ms/call  name
        49.33      4.43     4.43 30610000     0.00     0.00  yylex
        17.93      6.04     1.61    31000     0.05     0.22  yyparse
        6.57      6.63     0.59     1000     0.59     0.59  load_rules
        3.23      6.92     0.29  3637000     0.00     0.00  AppendStmt
        2.45      7.14     0.22   472000     0.00     0.00  AddKeySymbols
        2.12      7.33     0.19  3591000     0.00     0.00  atom_intern
        2.12      7.52     0.19   518000     0.00     0.00  FindNamedKey
        2.00      7.70     0.18   230000     0.00     0.00  FreeStmt
        1.78      7.86     0.16     1000     0.16     0.17  UpdateModifiersFromCompat
        1.34      7.98     0.12   732000     0.00     0.00  AddKeyName
        1.34      8.10     0.12                             __x86.get_pc_thunk.bx

    After:
        compiled 1000 keymaps in 13.874666269s
        %   cumulative   self              self     total
        time   seconds   seconds    calls  ms/call  ms/call  name
        49.82      4.26     4.26 30610000     0.00     0.00  yylex
        22.22      6.16     1.90    31000     0.06     0.22  yyparse
        2.92      6.41     0.25  3591000     0.00     0.00  atom_intern
        2.57      6.63     0.22     1000     0.22     0.25  xkb_components_from_rules
        2.11      6.81     0.18  3637000     0.00     0.00  AppendStmt
        2.11      6.99     0.18   230000     0.00     0.00  FreeStmt
        1.99      7.16     0.17   518000     0.00     0.00  FindNamedKey
        1.99      7.33     0.17     1000     0.17     0.17  UpdateModifiersFromCompat
        1.99      7.50     0.17                             __x86.get_pc_thunk.bx
        1.52      7.63     0.13   150000     0.00     0.00  AddInterp
        1.40      7.75     0.12   472000     0.00     0.00  AddKeySymbols

    On a newer 64-bit Intel processor.
    gcc -O2
    ./test/rules-file bench

    Before:
        processed 20000 times in 15.940546625s

    After:
        processed 20000 times in 5.295026345s

Allocations:
    gcc -O2
    valgrind test/rulescomp

    Before:
    total heap usage: 257,519 allocs, 257,519 frees, 14,766,529 bytes allocated

    After:
    total heap usage: 240,756 allocs, 240,756 frees, 14,007,886 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-05 16:37:02 +03:00
Ran Benita 54d1d5ed5a compat: make LEDInfo a wrapper around xkb_indicator_map
instead of duplicating the fields. The same is done in SymInterpInfo
which wraps xkb_sym_interpret.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-05 13:47:46 +03:00
Ran Benita 5f613988c8 Fold keymap->indicator_names into keymap->indicators
This makes sense, since giving a name to an indicator 'activates' the
indicator_map in that index.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-04 17:20:46 +03:00
Ran Benita af2a8b3a37 Unify some string tables from xkbcomp, text and keymap-dump
We move the LookupEntry struct from expr.h to text.h, along with most of
the lookup tables. This makes them available everywhere.
Looking up a value in the LookupEntry format is slower than direct index
mapping, but it allows multiple names per value (with the canonical one
being first) and "all"- and "none"-type masks. These functions are not
used anywhere efficiency matters.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 7ae0c6bac4 Convert rest of names in xkb_keymap back to atoms
These were kept as atoms, but since the keymap was exposed in the API,
we converted them to strings; no the keymap is no longer exposed, so we
can go back to atoms. They make the keymap smaller (at least on 64-bit
machines) and the comparisons faster.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 1a9968839e expr: make ResolveString return an atom
Almost all callers do xkb_atom_intern on the currently returned string,
while ResolveString converts the atom to the string to begin with...
uselss double work.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 7aa31097bf atom: add xkb_atom_lookup
This will only lookup the string and return the atom if found; it will
not intern it if not. This is useful when e.g. getting a string from the
user (which may be arbitrary) and comparing against atoms.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 651e1dab04 atom: separate lookup logic from atom_intern
This would allow us to add a non-interning xkb_atom_lookup function.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita f205d0f9b6 atom: make type and name of the 'a' field clearer
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 1aa6e2b1e2 test/rules-file: add benchmark
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 480f919d77 test: add rmlvo-to-kccgst tool
For a quick look at what components result from the rules.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 7f04ffc4d3 rules: fix check for appending '|' character when applying
There are two ways to separate multiple files in XKB include statements:
'+' will cause the later file to override the first in case of conflict,
while '|' will cause it augment it (this is done by xkbcomp). '!' is
unrelated here.
Since '|' is practically never used, this wasn't noticed.

In the modified test, the '|some_compat' previously was just ignored.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:12 +03:00
Ran Benita 41472822b6 Use XKB_MOD_INVALID instead of XkbNoModifier
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:12 +03:00
Ran Benita 300f3fb1e0 Don't printf NULL strings
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:12 +03:00
Ran Benita bce90d5b2c xkbcomp: add debug messages of the RMLVO and KcCGST
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:12 +03:00