Commit Graph

1146 Commits (9f75e0ab2efdc555cf1aa2b7d2bcad1533673a8a)

Author SHA1 Message Date
Ran Benita 9f75e0ab2e state: use stdbool in filters
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:06 +00:00
Ran Benita e8c0396f97 doc: use README as doxygen main page overview
The doxygen page looked a bit dead, the README fills it nicely, and is
already written in the markdown format which doxygen uses (I think?).

Unfortunately the USE_MDFILE_AS_MAINPAGE doxygen config doesn't seem to
do anything.. So we just add a {#mainpage} tag at the top of the README
which isn't so bad. BUT we still need some config option (the
no_extension=md part) so that doxygen will accept README instead of
README.md or somesuch. And that requires an even newer release, 1.8.3.1,
released 2013-01. But if an older version is used, it doesn't spew out
warnings but just skips the README, which is fine.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:06 +00:00
Ran Benita 40e5de9ac4 doc: update Doxyfile template to one from newer version
We want to use the USE_MDFILE_AS_MAINPAGE option which was introduced in
doxygen 1.8.3 (released 2012-12).

Right now the new options are commented, otherwise older doxygen spews
these these warnings, which can be ignored:

warning: ignoring unsupported tag `USE_MDFILE_AS_MAINPAGE =' at line 794, file doc/Doxyfile
warning: ignoring unsupported tag `MATHJAX_FORMAT         =' at line 1210, file doc/Doxyfile
warning: ignoring unsupported tag `EXTERNAL_SEARCH        =' at line 1257, file doc/Doxyfile
warning: ignoring unsupported tag `SEARCHENGINE_URL       =' at line 1265, file doc/Doxyfile
warning: ignoring unsupported tag `SEARCHDATA_FILE        =' at line 1271, file doc/Doxyfile
warning: ignoring unsupported tag `EXTERNAL_SEARCH_ID     =' at line 1278, file doc/Doxyfile
warning: ignoring unsupported tag `EXTRA_SEARCH_MAPPINGS  =' at line 1287, file doc/Doxyfile

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:06 +00:00
Ran Benita e33dd591bb doc: some improvements
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:06 +00:00
Ran Benita 57bfde3aff keymap: rename xkb_kt_map_entry to xkb_key_type_entry
That's a better name and fits more nicely.
Also change type->map to type->entries.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:06 +00:00
Ran Benita 6a39a0657d Fix pointer style nit
(I really dislike this one for some reason..)

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 56ba986613 Remove file_id entirely
It is not used anymore.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 64c002627d symbols: remove file_id
See previous commits.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 4921eb7416 compat: remove file_id
See previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 2b6e576f26 types: remove file_id
See previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 2ddb9e4f98 types: put all copy-to-keymap code in one function
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita 4bd0610f13 keycodes: remove KeyNamesInfo::merge
Not used.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita b06ef2b826 keycodes: unwrap KeyNameInfo
We don't need the struct any more, it only contains one field now.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita a78c1f0a04 keycodes: remove file_id
The file_id thing is used to identify the XkbFile some statement
originally came from. This is needed to avoid spurious warnings; for
example, if you write the same alias twice in a file, that's redundant,
and you'd want a warning about it. However if intentionally override it
from another file, that's fine, and you shouldn't get a warning. So by
comparing the file_id's the needed log verbosity is changed.

However, the file_id mechanism is really not needed, because we already
have that info! Each KeyNamesInfo corresponds to one XkbFile, so if the
conflict occurred while handling that one file -> same_file = true, and
if it occurs while merging two Info's -> same_file = false.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita f8d3ec9f6f keymap: don't use darray for key aliases
With a little tweak to the copy-to-keymap routine in keycodes.c we can
use a normal array.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita ea3cf26db5 keycodes: don't do unnecessary copies while merging
If 'into' in empty we can just steal 'from'.

Also move the alias-merging into the big function, it's nicer this way.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:05 +00:00
Ran Benita cd6a71fc63 state: small style fix
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 71eb033eef Move a couple of general keymap functions from keycodes.c
To get a key by name and resolve an alias - this makes sense for
everyone.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 82c3e39360 keycodes: remove unneeded alias conflict check
This is already checked when adding a new alias and merging aliases, so
it can never happen when we get to copying to the keymap.

Also the log verbosity decision there is quite useless, we should just
warn always and be done with it. So we can remove the file_id from
AliasInfo, and collapse the alias functions together.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 614f60e3fa xkbcomp: handle XKB file include's better
The 'merge_mode' situation is quite messy, and we've introduced a
regression compared to original xkbcomp: when handling a composite
include statement, such as
    replace "foo(bar)+baz(bla)|doo:dee"
and merging the entire resulting *Info back into the including *Info,
we actually use the merge mode that is set by the last part (here it is
"augment" because of the '|'), when we should be using the one set for
the whole statement (here "replace").

We also take the opportunity to clean up a bit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita a7b1f80d34 Build cleanly with clang
clang doesn't like the use of typeof with out default flags, so just
don't use it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 79329e1022 Don't try to build linux-specific tests on non-linux
Some tests use linux/input.h (and epoll), but we're building on some
other kernels (e.g. debian freebsd). We could just copy the file but
it's GPL. We could also skip the tests (exit code 77) but it doesn't
really matter.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 14842d6dc9 keymap: abstract a bit over the keymap format
Make it a bit easier to experiment with other formats.

Add a struct xkb_keymap_format_operations, which currently contains the
keymap compilation and _get_as_string functions. Each format can
implement whatever it wants from these.

The current public entry points become wrappers which do some error
reporting, allocation etc., and calling to the specific format. The
wrappers are all moved to src/keymap.c, so there are no XKB_EXPORT's
under src/xkbcomp/ anymore.

The only format available now is normal text_v1.

This is all not very KISS, and adds some indirection, but it is helpful
and somewhat cleaner.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita d1eae42ac5 text: some style changes
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 4e8dcca86d text: clean up and fix the *MaskText functions
The snprintf trick that LedStateText and ControlMaskText do cannot work,
because you can't use the buffer as an argument to write to itself!
(posix at least has 'restrict' there). So those two actually never
worked for more than one value (i.e. with a +).

Fix that, and do the same cleanup to ModMaskText. Now we have 3
functions which look exactly the same, oh well.

Also increase the context text buffer size, you never know.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 540feef3bb More spelling errors
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita a0fc9066ef test/rmlvo-to-kccgst: free memory before exit
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita b36d5b23d2 parser: also skip 'section' ELEMENT
It's for geometry only.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 35657c660a ast-build: remove malloc_or_die
This should be fixed properly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita a7b9c73d28 keycodes: fix spelling in error message
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 958b27284f Remove list.h
We don't use it anymore and it's easy to add back if needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 2b352c11dd Makefile.am: don't create INSTALL and ChangeLog
It may be xorg standard but it's completely useless and clutter the
directory.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 98ccbf9aff keymap-dump: move writing 'key {}' in symbols to its own function
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 4a59c84e43 keymap-dump: remove some ugly empty lines
xkbcomp prints them too, but that's just annoying. Also xkb_keycodes
doesn't have it already.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita e95dac76f2 keymap-dump: don't indent after xkb_keymap {
xkbcomp doesn't indent there, so it's easier to diff.
Also saves some horizontal space which is sorely needed when looking at
these files (especially the xkb_symbols).

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 9842b7a58a keymap-dump: style cleanups
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita d1f7100bcf ast: add error handling to XkbFileFromComponents
And try to not repeat ourselves.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita a46e4cc163 Fix dead assignments
"Value stored to 'stmt' is never read"
"Value stored to 'grp_to_use' is never read"

And change 'grp' to 'group' if we're here.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita c7aef16649 keysym: print unicode keysyms uppercase and 0-padded
Use the same format as XKeysymToString.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita dd81d5e0c0 Change some log functions to take ctx instead of keymap
They don't need the keymap, only the context.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita a4904ee1b7 keycodes: some minor style
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 60bb639bbe action: s/hndlrType/handler_type
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita fab28da39f compat: make it clear which 'dflt' is meant
Also s/dflt/default.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita b5c1b1d221 symbols: make it clear which 'dflt' is meant
A bit easier at a glance. Also, vowels are cool, so just say 'default'.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita fc56b5134f ast: constify argument
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 164cec6636 symbols: fix bad 'merge' assignment
Bug introduced in 2a5b0c9dc1, was causing
some keys to be merged incorrectly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 8cee749000 Change 'indicator' to 'led' everywhere possible
The code currently uses the two names interchangeably.
Settle on 'led', because it is shorter, more recognizable, and what we
use in our API (though of course the parser still uses 'indicator').

In camel case we make it 'Led'.
We change 'xkb_indicator_map' to just 'xkb_led' and the variables of
this type are 'led'. This mimics 'xkb_key' and 'key'.
IndicatorNameInfo and LEDInfo are changed to 'LedNameInfo' and
'LedInfo', and the variables are 'ledi' (like 'keyi' etc.). This is
instead of 'ii' and 'im'.

This might make a few places a bit confusing, but less than before I
think. It's also shorter.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 10c351f516 test/interactive: change variable name for 'xkb' to 'keymap'
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 089c3a1811 state: fix unbound virtual modifier bug
Recent xkeyboard-config introduced the following line in symbols/level3:
    vmods = LevelThree,
However, the XKM format which xkbcomp produces for the X server can't
handle explicit virtual modifiers such as this:
https://bugs.freedesktop.org/show_bug.cgi?id=4927

So by doing the following, for example:

setxkbmap -layout de (or another 3-level layouts)
xkbcomp $DISPLAY out.xkb
xkbcomp out.xkb $DISPLAY

The modifier is lost and can't be used for switching to Level3 (see the
included test).

We, however, are affected worse by this bug when we load the out.xkb
keymap. First, the FOUR_LEVEL_ALPHABETIC key type has these entries:
    map[None] = Level1;
    map[Shift] = Level2;
    map[Lock]  = Level2;
    map[LevelThree] = Level3;
    [...]
Now, because the LevelThree virtual modifier is not bound to anything,
the effective mask of the "map[LevelThree]" entry is just 0. So when
the modifier state is empty (initial state), this entry is chosen, and
we get Level3, instead of failing to match any entry and getting the
default Level1.

The difference in behavior from the xserver stems from this commit:
acdad6058d
Which removed the entry->active field. Without bugs, this would be
correct; however, it seems in this case we should just follow the
server's behavior.

The server sets the entry->active field like so in XKBMisc.c:
    /* entry is active if vmods are bound */
    entry->active = (mask != 0);
The xkblib spec explains this field, but does not specify how to
initialize it. This commit does the same as above but more directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:01 +00:00
Ran Benita 0ad8bf573f test/interactive: also print the level
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:01 +00:00