Commit Graph

1611 Commits (4812adb0b921b3320ea533a0449ba069d7450029)

Author SHA1 Message Date
Ran Benita 85826c3c13 Simplify HandleInclude functions
Instead of special casing the first include, process it inside the loop
as well. It works perfectly fine.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 21:06:07 +03:00
Ran Benita 861e6a1751 Remove haveSelf include feature
When including a file from another file, its possible to do something
like this:
    include "+some(other)+files"
with the "+" or "|" in the beginning. What will happen then is that
instead of processing the include files separately and then merging into
the existing info, we instead start with the existing info and merge
into it as we go, as if it was written explicitly before the first "+".

It's not particulary clear what this may be useful for. Since it's not
used by xkeyboard-config, not documented anywhere (and google doesn't
bring up anything), completely untested and kind of ugly, remove this
"feature". It most likely never been used.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 20:40:33 +03:00
Ran Benita 730c2bc34f types: use list instead of CommonInfo in PreserveInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 85abd36bf4 types: move global static tok_ atoms into KeyTypesInfo
The atoms are context-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 119c952b82 compat: use list instead of CommonInfo in LEDInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 50b25a1210 Use xkb_group_index_t for group variables throughout
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:37 +03:00
Ran Benita 8237e9c77a Remove _X_EXPORT from xkb_key_get_group/level
We should add them to xkbcommon.h if they need to.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita e21fc886ca compat: use list instead of CommonInfo in SymInterpInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita ba4320f7b3 Move indicators.c code into compat.c
It is only used there. Allows some refactoring.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita dfa0929c6d Convert macros to inline functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita 3fbf4ce315 keycodes: use list instead of CommonInfo in IndicatorNameInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita 4bf987e5f7 keycodes: use list instead of CommonInfo in AliasInfo
Always pass around the KeyNamesInfo which contains the list head.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita cc8b06826b Move alias.c functions into keycodes.c
They are only used in this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita cf4f170bdd symbols: don't use CommonInfo in KeyInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita ebb4d59c58 symbols: use list for ModMapEntry's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita b6e2a56dc0 Add common linked list implementation
Taken from xserver/include/list.h. The changes made are:
* Drop the xorg_ prefix and some typedef from the end.
* Rename _for_each_entry macros to just _foreach (like darray).
* Rename list_is_empty to list_empty (like darray).
* Add a list_replace function which we use later.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:56:13 +03:00
Ran Benita 0a6f9ccde2 symbols: remove alias info
It's never used - all of the aliases are added in the keycodes section.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:56:05 +03:00
Ran Benita d0097f4e60 Pass around xkb_key's instead of keycodes
This way we don't need to look up the key every time. We now only deal
with keycodes in the public API and in keycodes.c.

Also adds an xkb_foreach_key macro, which is used a lot.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:47:29 +03:00
Ran Benita 35a93b8e64 map: verifiy that the keycode is legal
In case someone passes in a bad keycode.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 091a0542ac Remove redundant keymap->keys resizes
The size (i.e. max_keycode) is determined in the keycodes section, which
gets compiled first.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita ad8875c526 Remove GroupsWidth macro
Use key->width directly instead.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita c705a82d60 Remove unused 'groupInfo' in KeyTypeInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 4ccb0ef5cc Get rid of group_info
This is 8 bits which hold how many groups the key has, what to do the
key group is out of bound and the group to redirect to if want to. This
may save a few bytes, but is really annoying. So instead, just lay out
the fields separately. We can optimize later in a sane way, with pahole,
bitfields, etc. if we want.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 4066fcc9b5 Get rid of struct xkb_sym_map
Past its usefulness; put the stuff directly in xkb_key.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:28 +03:00
Ran Benita 7d9f031341 Get rid of struct xkb_key_name
Just embed it directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:45:28 +03:00
Ran Benita e8a6a5f09a Add common xkb_key struct
Instead of having a million arrays from the keycode to various
key-specific info in the keymap, add a single struct xkb_key to hold all
of the data for the key in one object. This way we can pass it around,
do some refactoring and make the code simpler. It's also nice to see
everything in one place.

The keys array is still indexed by keycode, which is suboptimal because
there may be a lot of holes (i.e. unused keycodes between min_key_code
and max_key_code). By the end of this series it would be abstracted
enough to replace it by a hash table or similar if there's ever a need.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:45:22 +03:00
Ran Benita e668d00956 Replace KeyInfo 'key' variable name by 'keyi'
We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:39:37 +03:00
Ran Benita 81d029f563 Replace xkb_keycode_t 'key' variable name by 'kc'
We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:35:48 +03:00
Ran Benita a52fb7e21c Convert indecipherable macros to inline functions
This was fun.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:29 +03:00
Ran Benita c064b95c7c symbols: split initialization code from CompileSymbols
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:29 +03:00
Ran Benita caca60f391 Move per_key_repeats and enabled_ctrls to keymap
All of the per-key data and global flags are now visible directly in the
keymap.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:29 +03:00
Ran Benita 1313af8fb5 Get rid of xkb_key_names
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:28 +03:00
Ran Benita 50fef8eb8a Get rid of xkb_indicator
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:22:20 +03:00
Ran Benita ed08261768 Get rid of xkb_compat_map
Same as xkb_{client,server}_map which were already removed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:22:20 +03:00
Ran Benita 3de9d87498 Get rid of xkb_server_map
Same as xkb_client_map which was removed before.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:22:19 +03:00
Ran Benita 219243fe1b Get rid of xkb_client_map
We don't make this distinction anymore, and the separate allocations
just make it harder to reason about. Since we require that all of
symbols, types, compat etc. be present, we should just put stuff
directly in the keymap struct.

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

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-17 10:20:15 +01:00
Ran Benita c6c937abc2 Fix typo in out of range group calculation
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-15 17:35:35 +03:00
Ran Benita 7d400657f5 Remove unused control num_groups
We have xkb_map_num_groups for that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 19:54:07 +03:00
Ran Benita 6c3e0811d4 Convert missed enum merge_mode variables
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 15:20:14 +03:00
Ran Benita 43bf4136c9 Fix fileID mess
A few problems here:
* In e.g. keycodes.c the fileID field of the Info struct was never
  initialized to the id of the appropriate file, so it was always 0.
  There's some code which uses it, mostly for warnings.
* Some of the fileID fields were unsigned char, which overflows several
  times, seeing as the ID in some of our tests can get > 1000 (because
  we reuse the context).
* Some sign mismatches.
* fileID vs file_id.

Hopefully this fixes everything. I doubt this stuff had ever worked as
intended, in xkbcomp or otherwise.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 15:19:12 +03:00
Ran Benita 70683f7deb path: fix error message
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 13:04:59 +03:00
Ran Benita d705c5d97c Make compile_keymap a little nicer
Just using the fact that we must have all of the components, without
optional ones.
Also fixes a memleak on the way, by making the functions which allocate
the XkbFiles to free them, which is easier to get right.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 11:47:05 +03:00
Ran Benita fe4f990902 Move CompileKeymap into xkbcomp.c
It's nicer to see the code where its used. Removes keymap.c.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 00:29:31 +03:00
Ran Benita 57374c3237 Rename KSIsLower/Upper and move to keysym.c
Seems like a more natural place, and allows to remove the src/misc.c
file.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:11:15 +03:00
Ran Benita 0765064b35 Remove MERGE_ALT_FORM merge mode
The mode comes from the "alternate" keyword, which is unused in
xkeyboard-config and mostly undocumented. Its purpose is to allow to
assign the same key name to multiple key codes, which is not allowed
otherwise (and doesn't make much sense). The xkblib specification
implies that this was part of the overlay functionality, which we also
no longer support.

If we do encounter this keyword, we just treat it as MERGE_DEFAULT. The
keycodes.c code will detect a collision and will ignore all but the
first key code (and the error count is not incremented).

Some peripheral code is also removed as a result.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:07:03 +03:00
Ran Benita dd85790c73 Move InitCanonicalKeyTypes to keytypes.c
It's only got one call site and it's in keytypes.c, so move it there and
make it static.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:07:03 +03:00
Ran Benita 0aaa84d8f1 Remove xkb_kt_map_entry::active
Takes the advice of acdad6058d and removes
this field, since its not used anymore now.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:07:03 +03:00
Ran Benita 3e65531f13 Move ComputeEffectiveMap code and avoid some duplication
The ComputeEffectiveMap function is only called from keytypes.c, with
the last argument NULL, so we can move it there and remove some code.
The function XkbcVirtualModsToRealMods, of which the above is the only
user, is already implemented more simply in compat.c, so make this one
non-static and use it. This leaves src/xkb.c empty, so remove it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:07:03 +03:00
Ran Benita a3378338bd remove unused function xkb_canonicalise_components
commit 46441b1184 removed this from the
public API, and we don't need it internally. So send it to the archives.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:07:03 +03:00