Commit Graph

2211 Commits (0db1dc1c4a283d13c826108b20871ab5e02b800f)

Author SHA1 Message Date
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
Ran Benita 2fefe558ab tools: fix strcmp mistake in 0066e38
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:34:52 +03:00
Ran Benita 00530bea6b build: use gnu_symbol_visibility instead of explicit -fvisibility
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:06:40 +03:00
Ran Benita 61772c773e build: use nicer / syntax instead of join_paths()
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 16:01:00 +03:00
Ran Benita 0066e387bc tools: make independent from src/
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 15:59:23 +03:00
Ran Benita d67c9cfffb build: use cc.get_supported_arguments()
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 15:24:40 +03:00
Ran Benita 0615c91133 build: remove explicit -Wextra
Implied by `warning_level=2`.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 15:15:31 +03:00
Ran Benita f439ce1889 tools: some minor changes to xkbcli
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 15:06:12 +03:00
Peter Hutterer ce5eb1ac6d tools: link the tools against libxkbcommon.so only
The tools previously linked against a static version (by simply recompiling
everythiong). This isn't necessary, we can link them against libxkbcommon.so.

Only exception: The xbkcli-compile-keymap tool needs a private API for the
--kccgst flag. Avoid this by disabling this flag in the installed tool and
building the same tool, statically linked but not-installed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer a472e030ea tools: avoid use of a private api
This is merely to fill in some NULL pointers anyway, we can just use
the #defines we have available at build time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer cd119a2824 Drop use of ronn, switch to raw roff instead
Drop the ronn source files, check in the generated files instead. This gets rid
of the ruby+gem+ronn toolchain requirement at the cost of having to edit raw man
pages.

ronn files are as-generated but with the preamble and generation date removed.
The latter isn't important enough to keep, it'll just go stale for manually
maintained files and it's not worth setting up a configure_file() just for that
date.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 31b38c3137 tools: don't mangle the path for tools, just exec directly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer ba52e34dce tools: don't assert on 64+ commandline arguments, just return
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer d480f053d2 tools: add a test program to parse the commandline options
A pytest wrapper around our xkbcli tool - copied from libinput.
This calls our various xkbcli tools with varying options and check that they
either succeed or return the right error code. The coverage is limited, it
does not (and cannot) test for all possible combinations but it should provide a
good red flag if we have inconsistent behavior or accidentally break some
combination of flags.

Meanwhile, we can at least assume that all our commandline arguments are parsed
without segfaulting or worse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 449ed2b8e8 tools: drop getopt vs getopt_long differentiation
On all platforms we build on where getopt.h is available, getopt_long is also
available. Only Windows doesn't have either but that's no reason for us to
differentiate between the two.

If we need to special-case getopt vs getopt_long, it's probably better to
implement our own cross-platform version of it and use that.

Fixes #161

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 7d36a3d119 tools: switch how-to-type to getopt_long
This provides consistency with the other tools that now all take long options.
Plus, it's more obvious to have the arguments spelled out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer ab3be693b3 tools: switch interactive-evdev to getopt_long
Requiring long options for this tool means it's immediately obvious what an
invocation does, compare e.g.

  xkbcli interactive-evdev -gcd

to the equivalent:

  xkbcli interactive-evdev --consumed-mode=gtk --enalbe-compose --report-state-changes

This drops the evdev offset argument - that offset should never be anything
other than 8, having this as argument here is more likely to confuse or
produce misleading debugging logs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 714182066d tools: consistently return 2 on invalid usage
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 29e80e7b76 tools: install our tools as xkbcli subcommands
The xkbcli tool usage help is ifdef'd out where the tool isn't built but the
man page always includes all tools. Easier that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer ed57fb8b86 tools: add a xkbcli tool as entry point for the various tools we have
This is the base tool, no subtools are currently connected so you only get help
and version for now. The goal here is to have a git-like infrastructure where
/usr/bin/xkbcli is the main tool, anything else will hide in libexec.

The infrastructure for this is copied from libinput. Tools themselves will
will be installed in $prefix/libexec/xkbcommon and the xkbcli tool forks
off whatever argv[1] is after modifying the PATH to include the libexec dir.

libinput has additional code for checking whether we're running this from the
builddir but it's a bit iffy and it's usefulness is limited - if you're in the
builddir anyway you can just run ./builddir/xkbcli-<toolname> directly.
So for this code here, running ./builddir/xkbcli <toolname> will execute the
one in the prefix/libexecdir.

Since we want that tool available everywhere even where some of the subtools
aren't present, we need to ifdef the getopt handling.

man page generation is handled via ronn which is a ruby program but allows
markdown for the sources. It's hidden behind a meson option to disable where
downloading ronn isn't an option. The setup is generic enough that we can add
other man-pages by just appending to the array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 1b796a7209 meson.build: move registry-list tool down to the tools section
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 10a881a499 meson.build: only build the tools where getopt.h is available
Windows doesn't have getopt.h. This would prevent building the tools but
they are behind other checks that cause them to be disabled. The only tools
that don't need getopt.h  are interactive-wayland and interactive-x11 but
neither is particularly useful on Windows. Just hide all tools behind the getopt
check in preparation for the upcoming tool consolidation work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 76d847ac24 meson.build: move the config.h generation to the bottom
We cannot add to configh_data after this command so let's generate this last.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Peter Hutterer 90ece8fb0a meson.build: registry list is dependent on getopt_long
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00