Commit Graph

2234 Commits (efdb05d193febfc519f9fe9b770925f27f6a6df1)

Author SHA1 Message Date
Ran Benita 95f8ff8355 test/data: update host.xkb to match keymap-dump style
This is needed for fixing the x11comp test.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-23 18:35:27 +02:00
Ran Benita 4aed3c6811 x11/keymap: fix case with no actions
Possible regression in f41e609bbe (not
confirmed yet).

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-23 18:24:52 +02:00
Ran Benita 13e6543ed4 Bump version to 1.0.2
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-20 21:02:44 +02:00
Ran Benita 1bd3b3c7cb x11: cache X11 atoms
On every keymap notify event, the keymap should be refreshed, which
fetches the required X11 atoms. A big keymap might have a few hundred of
atoms.

A profile by a user has shown this *might* be slow when some intensive
amount of keymap activity is occurring. It might also be slow on a
remote X server.

While I'm not really sure this is the actual bottleneck, caching the
atoms is easy enough and only needs a couple kb of memory, so do that.

On the added bench-x11:

Before: retrieved 2500 keymaps from X in 11.233237s
After : retrieved 2500 keymaps from X in 1.592339s

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-20 13:04:21 +02:00
Ran Benita f41e609bbe x11: eliminate slow divisions
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-20 12:50:50 +02:00
Ran Benita 9caa4128c2 build: combine test & bench internal deps
No need to duplicate this really.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-19 16:19:56 +02:00
Ran Benita d9a22f29c0 ci: fix windows CI failure due to add-path deprecation
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-19 01:31:09 +02:00
Peter Hutterer 6268ba1c77 test: catch unrecognized keysyms in the xkeyboard-config test
Prompted by
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/127

We run the keymap tool with --verbose which will print the messages from the
compiler to the log file as well. And then we can search for the warning
regarding an unrecognized keysym and fail our test based on that.
2020-10-20 11:02:03 +10:00
Peter Hutterer afdc9ceee7 xkbcomp: where a keysym cannot be resolved, set it to NoSymbol
Where resolve_keysym fails we warn but use the otherwise uninitialized variable
as our keysym. That later ends up in the keymap as random garbage hex value.

Simplest test case, set this in the 'us' keymap:
    key <TLDE>               {      [        xyz ] };

And without this patch we get random garbage:
./build/xkbcli-compile-keymap --layout us | grep TLDE:
    key <TLDE>               {      [      0x018a5cf0 ] };

With this patch, we now get NoSymbol:
./build/xkbcli-compile-keymap --layout us | grep TLDE:
    key <TLDE>               {      [        NoSymbol ] };
2020-10-20 09:23:50 +10:00
Ran Benita 21e640fbc7
doc: add note about "short" layout names (#194)
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/193
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-10-11 09:55:14 +03:00
Ran Benita 2c295b10aa Bump version to 1.0.1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-11 15:07:49 +03:00
hhb 69713ce3e9
parser: fix another format string for int64_t (#191) 2020-09-11 15:06:23 +03:00
Ran Benita c5565bd05f tools: align `xkbcli how-to-type` output ourselves
Can possibly add a machine-parsable format if desired, but for now just
have it work nicely.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-09 10:11:54 +03:00
Ran Benita 6178924f28 test/tool-option-parsing: skip testing of disabled tools
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-08 09:45:34 +03:00
Ran Benita c621319e53 test/tool-option-parsing: switch from pytest to unittest
For me, installing pytest for libxkbcommon is a bit problematic, so I
end up skipping it which is not great.

Switch to unittest which is built in to Python. It's not as nice as
pytest but good enough in this case.

Note: I was too lazy to switch the plain asserts to unittest
assertions...

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-08 09:45:34 +03:00
Ran Benita c8f309a2de test/tool-option-parsing: keep isolated by using our own test data
Make it possible to run the test on all machines.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 22:06:22 +03:00
Ran Benita 737030ad5b build: move tests to after tools
So tests can refer to stuff set by the tools section.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 22:03:30 +03:00
Peter Hutterer d327475282 utils: include unistd.h where we have it
MacOS doesn't have eaccess/euidaccess but it does have unistd.h, so let's
include it to silence the R_OK redefinition compiler warnings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 22:01:57 +03:00
Peter Hutterer a350222cc9 context: fix a compiler warning
../src/context.c:57:9: warning: variable 'err' is used uninitialized whenever
'if' condition is true [-Wsometimes-uninitialized]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 22:01:57 +03:00
Peter Hutterer 3039d62a48 registry: mark the rxkb_log function as attribute printf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 22:01:57 +03:00
Ran Benita db98575327 ci: enable xkbregistry on macos job
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 22:01:57 +03:00
Peter Hutterer 13745014c3 test: include unstd.h in the registry test to cut down the MacOS warnings
mkdtmp, rmdir and unlink are in unstd.h on MacOS. Since including that it
doesn't hurt us on Linux, let's do it without ifdefs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 22:01:57 +03:00
Ran Benita 534e54f621 test/data: add rule registry files
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 11:47:34 +03:00
Ran Benita 1c3521993d test/data: sync from xkeyboard-config 2.30
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 11:36:49 +03:00
Ran Benita 461d727830 test/data: change quartz.xkb from CRLF to LF
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07 11:19:45 +03:00
Peter Hutterer 850ba7e636 test: fix the xkbcli --version test
Fixes https://github.com/xkbcommon/libxkbcommon/issues/185

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 11:15:08 +10:00
Ran Benita c6df60d8a7 build: remove old pkgconfig templates
In meson these are generated instead.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-06 22:25:29 +03:00
Ran Benita 12f99d0dfe Bump version to 1.0.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-06 00:00:14 +03:00
Ran Benita 0f8ae6ecd5 xkbcli: fix interactive-x11 not showing in help
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-05 23:41:38 +03:00
Peter Hutterer 66e7f0da20 Revert: tools: add xkbcli-scaffold-new-layout as helper tool
While this tool is useful for users starting with a new keyboard layout, it is a
somewhat bad fit for libxkbcommon. It's the only python tool, we don't even
install it yet (because we're not sure yet what it's supposed to do) and there's
a potential for it to expand into more corner cases.

The only tie it has to libxkbcommon is that it templates the data files that
libxkbcommon reads, but those files are effectively public API.

Let's remove this tool from there and instead move it to a separate git
repository where it can go its own way.

This reverts commit d00cf64dbc
2020-09-03 18:14:16 +10:00
Peter Hutterer 4d0d509129 meson.build: define PATH_MAX where it's missing
PATH_MAX is not POSIX and can be missing on some systems, notably Windows (which
provides MAX_PATH instead tough) and Hurd. Let's define it to a sane value where
missing, i.e.  the one it's defined to in limits.h. Except on Windows where
we're limited to 260.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-01 08:56:56 +10:00
Ran Benita 4b2a91431b ci: fix windows job not finding bison
Instead of using the unpredictable chocolatey let's just handle it
ourselves. The versions are pinned but that's arguably good.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/179
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-08-31 15:28:38 +03:00
Ran Benita d5c6b58152 tools: convert man pages from man format to mdoc format
The mdoc is more semantic and consistent.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-08-31 10:02:47 +03:00
Ran Benita 5649e4ae72 PACKAGING: mention xkbcli
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-08-30 21:59:30 +03:00
Ran Benita e50c3e2cc7 build: fix meson "uses features which were added in newer versions" warning
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-08-30 21:54:21 +03:00
Peter Hutterer ae90a6a0a9 doc: add some disclaimer regarding user-specific key types and compat entries
It's a niche use-case but basically the same as adding symbols, so let's go with
a general handwavy explanation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer d00cf64dbc tools: add xkbcli-scaffold-new-layout as helper tool
This tool set ups the required directory structure and template files to add new
keyboard layouts or options. For example, run like this:

    xkbcli-scaffold-new-layout  --layout 'us(myvariant)' --option 'custom:foo'

This will up the evdev rules file, the evdev.xml file, the symbols/us file and
symbols/custom file in $XDG_CONFIG_HOME so that the user has everything in place
and can start filling in the actual key mappings.

This tool is currently uninstalled until we figure out whether it's useful.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer d7b39f6ffb Add /etc/xkb as extra lookup path for system data files
This completes the usual triplet of configuration locations available for most
processes:
- vendor-provided data files in /usr/share/X11/xkb
- system-specific data files in /etc/xkb
- user-specific data files in $XDG_CONFIG_HOME/xkb

The default lookup order user, system, vendor, just like everything else that
uses these conventions.

For include directives in rules files, the '%E' resolves to that path.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer 05d6efc417 xkbcomp: allow including kccgst files from other paths
Previously, a 'symbols/us' file in path A would shadow the same file in path B.
This is suboptimal, we rarely need to hide the system files - we care mostly
about *extending* them. By continuing to check other lookup paths, we make it
possible for a XDG_CONFIG_HOME/xkb/symbols/us file to have sections including
those from /usr/share/X11/xkb/symbols/us.

Note that this is not possible for rules files which need to be manually
controlled to get the right bits resolved.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer bbc7005b2a xkbcomp: simplify the include path handling
Streamline the code a bit - instead of handling all the if (!file) conditions
handle the case of where we have a file and jump to the end.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer 351b4b9c0b xkbcomp: move the logging of include paths into a helper function
No functional changes, prep work for some other refacturing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Ran Benita a0c1c2f42d build: fix byacc invocation
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/133#issuecomment-670902025
Reported-by: Edward-0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-08-08 14:43:09 +03:00
Peter Hutterer 9b9c5f2094 test: fix the xkeyboard-config test
'xkbcli compile-keymap' doesn't work unless we ninja install first. But for a
test that's to be run from the test directory, that's not a useful option so
let's call the binary directly. The script adds the meson builddir to the PATH
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-29 08:33:26 +10:00
Peter Hutterer 03ecaa6b53 test: ignore the real XDG_CONFIG_HOME during tests
Let's not have our tests fail if the user has an incompatible
$XDG_CONFIG_HOME/xkb directory.

libxkbcommon has fallbacks when XDG_CONFIG_HOME isn't set so we need to override
this with a real directory instead of just unsetting it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-27 19:26:46 +10:00
Ran Benita fcc6b28f5f tools/interactive-evdev: fixup 64bff65
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-27 11:59:21 +03:00
Ran Benita 64bff65a6a tools/interactive-evdev: change --evdev-offset to --without-x11-offset
There is no reason to give full control rather than just enable/disable.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-27 11:51:53 +03:00
Ran Benita 81842f7fbb doc: ignore rxkb, RXBK prefixes in doxygen
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 17:21:46 +03:00
Ran Benita 0df23ea8d7 test/tool-option-parsing: remove --kccgst test, it's private for now
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:38:43 +03:00
Ran Benita 608e9361e3 tools: run test-tool-option-parsing.py like a regular test
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:37:57 +03:00
Ran Benita 9511174075 tools/compile-keymap: hide --kccgst comment on public build
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:37:57 +03:00