Commit Graph

1951 Commits (5649e4ae726639ea6185ad9acdaa1c6ec94f8ed5)

Author SHA1 Message Date
Ran Benita f9b95c06c1 parser: remove an unneeded check
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-14 22:10:09 +02:00
Peter Hutterer 59d2a71383 docs: update the include path documentation
Missing from e23f1061b2 and
3a91788d92.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-14 10:17:46 +02:00
Ran Benita 3d43f4806d compat: reject interpret modifier predicate with more than one value
Given

    interpret ISO_Level3_Shift+AnyOf(all,extraneous) { ... };

Previously, extraneous (and further) was ignored. Now it's rejected.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 22:31:46 +02:00
Ran Benita 7d44c7a9f9 expr: fix log message on some unexpected expression types
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 22:09:19 +02:00
Ran Benita 406beecae5 Replace some tabs that sneaked in with spaces
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 22:06:02 +02:00
Ran Benita 322cd8563c parser: fix merge mode only applied to first vmod in a virtual_modifiers statement
Given

    augment virtual_modifiers NumLock,Alt,LevelThree

Previously it was expanded (directly in the parser) to

    augment virtual_modifiers NumLock;
    virtual_modifiers Alt;
    virtual_modifiers LevelThree;

Now it expands to

    augment virtual_modifiers NumLock;
    augment virtual_modifiers Alt;
    augment virtual_modifiers LevelThree;

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 20:37:09 +02:00
Ran Benita 400cc84911 ast: use a separate expr struct for action list
Currently it's under UnaryExpr, which just doesn't make sense.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 20:07:12 +02:00
Ran Benita 8c62d48c0c ast-build: get rid of unhelpful macro
Straightforward code is better here.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-12 19:16:08 +02:00
Ran Benita 4849bc1914 atom: a string is greater than its prefix
Bug accidentally introduced in 9a92b46.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 22:11:22 +02:00
Ran Benita c79c80335b atom: combine atom_intern() and atom_lookup()
Use an "add" bool parameter instead. This simplifies the code a bit.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 21:28:43 +02:00
Ran Benita adbd9c6f08 atom: correct iteration count in hash function
Fixup of ccab349 - unlike the commit message, hash a byte twice instead
of zero times, which is probably better. This is how it was before.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 13:50:59 +02:00
Ran Benita 9ebf97d706 atom: describe how this odd data structure works
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 13:13:30 +02:00
Ran Benita ccab349c99 atom: use a better hash function
FNV-1a instead of the djb2-like one from before.

Keep the unrolling since it seems quite beneficial, even though it loses
one byte if the length is odd...

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 13:01:43 +02:00
Ran Benita 9a92b4643b atom: style changes
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 12:26:19 +02:00
Ran Benita 1fe1b65385 atom: remove handling of garbage input
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 11:40:07 +02:00
Ran Benita a5f95c2b3c atom: use explicit size for fingerprint
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 11:33:45 +02:00
Ran Benita 8ea4a001d1 atom: replace an avoidable strlen
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 00:20:45 +02:00
Ran Benita 6f8bb5ee70 atom: remove redundant field
The field is redundant.

Due to alignment, this will only save memory on 32bit architectures.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-09 00:05:59 +02:00
Ran Benita 2a6155936c test/atom: increase iteration count and print random seed on failure
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-08 22:40:13 +02:00
Ran Benita 2af474e8d0 parser: get rid of "stealing" atoms
This requires (well, at least implemented by) casting away `const` which
is undefined behavior, and clang started to warn about it.

The micro optimization didn't save too many allocations, anyway.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-08 12:13:31 +02:00
Peter Hutterer 31e561fca9 test: remove a superfluous string-is-null check
A few lines above we check path_rel[0], so any null pointer will blow up
before we get here.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-07 11:10:00 +02:00
Peter Hutterer 96ef14ac94 test: fix a potential memory leak
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-07 11:10:00 +02:00
Ran Benita 3515ba19a6 test: xkeyboard-config: bring back the progress bar
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-11-01 10:45:43 +02:00
Peter Hutterer 8f93e22a37 test: xkeyboard-config: invoke the python3 command (#120)
python3 is always python3, but python could be python2 in some cases. Or just
missing (e.g. RHEL8).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:41:16 +02:00
Peter Hutterer 0609073ce0 test: xkeyboard-config: add missing variant tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer f4a0f73882 test: xkeyboard-config: use universal_newlines instead of decode
This way stdin/stdout of the process are opened in text mode and we don't need
manually decode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer 7832cc727c test: xkeyboard-config: flake8 fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer cd5a24aa38 test: xkeyboard-config: handle keyboard interrupts correctly
In python multiprocessing, each process needs to handle (and ignore) the
KeyboardInterrupt to avoid exception logging. This is a separate patch for
easier reviewing, the first hunks merely re-indent all of the
xkbcommontool/xkbcomp functions into a try/except KeyboardInterrupt block.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer 9fc0cb8777 test: xkeyboard-config: print to stderr on failure, stdout otherwise
This is a change in behavior and requires any automated callers to adjust
accordingly. Still, much easier to get the errors that way rather than it
being mixed into a thousands-of-lines output file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer f53838477d test: xkeyboard-config: add a multiprocessing.Pool() to speed up the test
Collect all options into a dictionary, then process that as async actions
through a process pool. This of course requires collecting the various print
statements to avoid mangled output.

This dropped the time to completion from around 14 min to 8 min on my local
machine (unscientific single run only for the original timing).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Peter Hutterer 1e13190685 test: xkeyboard-config: use argparse for the path and the tool selection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 10:24:03 +02:00
Ran Benita 90497b84f8 scripts/makeheader: slight simplification
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-31 21:21:35 +02:00
Sebastian Wick f0c0cb8074 scripts/makeheader: allow overriding the prefix path of the X11 headers
with X11_HEADERS_PREFIX

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-10-31 21:20:08 +02:00
Peter Hutterer 255200faa7 test: add test for the various default include paths
All tests create a temporary directory, set up the environment for that
directory and then check the include paths for the presence of that directory,
ideally in the right position of the list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 19:29:30 +02:00
Peter Hutterer e23f1061b2 Use XDG_CONFIG_HOME as first XKB search path
Use $XDG_CONFIG_HOME/xkb as the primary lookup path for XKB rules. Same
motivation as in 3a91788d92, however the XDG directories are more standard
and recommended these days than application-specific dotfiles.

The XDG spec says to fall back to $HOME/.config where XDG_CONFIG_HOME is not
set so we implement that behavior as well.

Fixes #112

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 19:29:30 +02:00
Ran Benita 6d83838cc2 Bump version to 0.9.1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-20 23:07:52 +03:00
Jan Alexander Steffens (heftig) 4b3783987e context: Don't fail to create the context if HOME isn't available
E.g. when Mutter has CAP_SYS_NICE and thus secure_getenv returns NULL.

Fixes https://bugs.archlinux.org/task/64191

[ran: changed to ignore error]
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-20 23:00:30 +03:00
Ran Benita aa118b4b97 README: update my email address
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-19 00:55:21 +03:00
Ran Benita a88a0710f9 Bump version to 0.9.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-19 00:41:36 +03:00
Ran Benita e41dc19a22 build: remove leftover autotools file
Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-19 00:41:36 +03:00
Ran Benita 45496c33f1 test: fix printf("%s", NULL) in error path
../test/common.c: In function ‘test_get_path’:
    ../test/common.c:171:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
      171 |         fprintf(stderr, "Failed to allocate path (%d chars) for %s\n",
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      172 |                 (int) path_len, path);
          |                 ~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-19 00:38:43 +03:00
Ran Benita 076047b21a keymap-dump: use consistent capitalization for "Group<N>"
It's used capitalized everywhere except a couple places.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-16 10:36:41 +03:00
Ran Benita a6ed0304f7 keymap-dump: fix invalid names used for levels above 8
xkbcomp only accepts the "Level" prefix for a level name for levels 1 to
8, but the keymap dumping code added it always, e.g. "Level15".

The plain integer, e.g. "8", "15" is always accepted, so just use that.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/113

Signed-off-by: Ran Benita <ran@unusedvar.com>
Reported-by: progandy
2019-10-16 10:36:37 +03:00
Ran Benita 3a91788d92 context: move ~/.xkb to before XKB_CONFIG_ROOT in the default include path
Previously, the default include path was XKB_CONFIG_ROOT:~/.xkb.

The ~/.xkb include path is intended to allow the local user to customize
their keymaps without having to modify system paths.

But usually, the user only wants to customize specific parts. When
XKB_CONFIG_ROOT is first, the user can only customize through the "entry
point" (the RMLVO). When ~/.xkb is first, the user can drop in a file
and it will override the system one.

The impetus for this change is the rules file. "evdev" is hard-coded
everywhere, so it not often not possible to change to something else.
And the rules files determines how the rest of the RMLVO is interpreted.
So, to enable customization, we have these options:

A: System includes user.
B: User includes system.
C: Library goes over both in one or the other order.

Option A is problematic due to backward compatibility and is also
unnatural.

Option B gives the user control and is backward compatible, so that's
what we choose. This is also how Compose files are handled, and that
seems to work fine in the wild.

Option C is actually less flexible than B, and more complicated.

(The rules file format doesn't have an include statement yet, but it's
planned).

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-10-03 17:27:00 +03:00
Alan Coopersmith 934d574172 build: Solaris needs __EXTENSIONS__ instead of _GNU_SOURCE
Fix meson build on Solaris by using __EXTENSIONS__ where Linux & other
platforms use _GNU_SOURCE.  Without this the build fails due to missing
prototypes for functions like strdup & getopt not defined in the C99
standard.  (In autoconf, this was handled by AC_USE_SYSTEM_EXTENSIONS.)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-09-11 20:30:37 +03:00
Ran Benita 25cd67daf7 build: remove autotools build
We introduced meson 2 years ago, hopefully that's was enough time for
everyone to convert.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-08-10 20:20:36 +03:00
Ran Benita e7bb7045b8 ci: remove travis CI
We moved to Azure Pipelines.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-08-10 20:20:36 +03:00
Ran Benita d486b54288 Set up CI with Azure Pipelines
[skip ci]
2019-08-09 23:15:26 +03:00
Adrian Perez de Castro cc0e3617a9 CI: Install graphviz using APT
This adds the missing graphviz dependency, from which Doxygen uses
"dot" to create diagrams for the documentation. Also, the meson
dependency is removed as it is installed using Pip, and ninja-build
added.
2019-08-09 23:01:27 +03:00
Adrian Perez de Castro c408adc229 CI: Publish test results from Meson 2019-08-09 23:01:27 +03:00