Commit Graph

2186 Commits (1c1542d64f37c67bf29c3de1e06735fd79cc50ea)

Author SHA1 Message Date
Peter Hutterer 121cd37753 CI: split and rename the workflows to windows/macos/linux
"main" is a bit non-descriptive, let's name them after the platforms we run them
on. Splitting them up allows us to be less selective on how we run the various
workflows, e.g. always running the linux one.
2022-01-17 21:44:48 +10:00
M Hickford 9bbe629aad Update README.md
Co-authored-by: Ran Benita <ran@unusedvar.com>
2022-01-11 16:49:22 +02:00
matthickford 2e571b4392 Add instructions to run tests. Add build/ to .gitignore. 2022-01-11 16:49:22 +02:00
Alex Xu (Hello71) 8531ea723f build: add enable-tools option
this is mainly useful for multilib, but may be useful for other users as well

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
2021-12-05 12:55:51 +02:00
Peter Hutterer 50a24569b8 tools/list: print an empty string for null vendor strings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-11 08:26:36 +10:00
Peter Hutterer abb115c78f tools/list: enclose the the various field names in quotes
Because otherwise the 'no' layout is treated as disagreement with whatever is to
be disagreed with. Fixed in YAML 1.2 but that's not universally supported.

Fixes #268
2021-11-11 08:26:36 +10:00
Ran Benita e8cb431144 man: mention `xkbcli list` output is meant to be in YAML 1.2 format
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-11-01 23:56:22 +02:00
Ran Benita ae3b010e62 ci: possible fix for release workflow
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-09-17 00:00:11 +03:00
Ran Benita 88222c8d40 Bump version to 1.3.1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-09-10 22:51:34 +03:00
Ran Benita 4a576ab184 x11: try to fix crash in xkb_x11_keymap_new_from_device error handling
In 1b3a1c277a we changed the error
handling in this code to not bail out immediately but only after
everything has been processed, to simplify the code. But I suspect the
code isn't prepared for this and that's what causing the crash reported
in the issue.

Bring back the short-circuit error handling which would hopefully fix
such crashes.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/252
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-09-09 16:52:47 +03:00
Ran Benita 4e361712d2 x11: stylistic fixes
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-08-31 22:03:03 +03:00
Ran Benita f8c430cf71 tools/how-to-type: add --keysym for how to type a keysym
Previously, could only check how to type a Unicode codepoint, but
searching for a keysym directly is also occasionally useful.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-07-31 22:03:33 +03:00
Simon Ser 5419e57736 tools/interactive-x11: use keysym to look for Esc
Don't assume that keycode 9 means Escape. Instead, use the keymap
to check for Esc.

Logic copied from the Wayland version.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-12 12:25:48 +03:00
Ran Benita eb59a1c55b bench/compose: fix compose file path
Forgotten in e2465c2.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-06-10 17:13:57 +03:00
Ran Benita 1318bedbb7 ci: some tweaks
- Reduce permissions
- Update some stuff

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:38:37 +03:00
Ran Benita c4fdcba305 ci: also link to tarball in github release
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:22:56 +03:00
Ran Benita 1f7ffde982 ci: automatically create github release when tag is pushed
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/233
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:20:12 +03:00
Ran Benita 8507af731a test/tool-option-parsing: don't depend on build prefix
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/244
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:11:10 +03:00
Ran Benita 98f07da895 test/compose: add tests for xkb_compose_table_new_from_locale lookup
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:07:06 +03:00
Ran Benita 5b1b2f7546 test/compose: clean up after a setenv
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 20:00:24 +03:00
Ran Benita e2465c2a69 tests/data: add files needed to fully test compose
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 19:58:40 +03:00
Ran Benita 09ac27f744 ignore: remove no longer relevant gitignore files
These were relevant for the autoconf build but now we're meson only.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 19:51:02 +03:00
Ran Benita 7062ab97b6 xkbcommon: deprecate XK_approxeq and XK_notapproxeq
Sync xorg-proto commit
25f3278b85

Fixes: #82
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 19:36:22 +03:00
Peter Hutterer 8e9f943d38 scripts/update-keysyms: fix path to the include files after de1b6943d
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-14 08:45:03 +10:00
Ran Benita b6aadd57d9 tools: add compose tool for Compose debugging
Not very useful so not exposed in xkbcli.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-08 21:37:28 +03:00
Ran Benita 1915632e06 compose: add mapped locale to Compose-file-not-found error log
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-08 21:08:37 +03:00
Ran Benita 13ba9135c0 Bump version to 1.3.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-01 23:51:23 +03:00
Ran Benita 16fe837d8d atom: rewrite as a hash table
While the previous 1987-style[0] scheme was fun (and I reasonably
optimized it for a fair comparison), this task is more suited to a hash
table. Even a simple implementation beats the old one.

[0] Seems to have first appeared in X11R1, released September 1987.
    See server/dix/atom.c here: https://www.x.org/releases/X11R1/X.V11R1.tar.gz

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 16:41:32 +03:00
Ran Benita baf5522649 bench: add atom benchmark
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 16:41:32 +03:00
Ran Benita 5f8c2fa41a bench/rulescomp: decrease benchmark iterations
No need for more, and easier to convert to milliseconds per iteration.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 12:32:21 +03:00
Ran Benita 9d87f84915 build: fix missing includes
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 10:57:42 +03:00
Ran Benita de1b6943d2 Move include files to include/ subdirectory
This way we don't specify `include_directorories('.')` which brings in
more than needed.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 10:10:26 +03:00
Ran Benita 8ff0232bda build: move the subproject variables to a common section at the end
As suggested in:
https://github.com/xkbcommon/libxkbcommon/pull/240#discussion_r620784021

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 10:02:54 +03:00
Adrian Perez de Castro 4238417ba0 Meson: Allow building as subproject
Specify where to find the headers for libxkbcommon_dep,
libxkbcommon_x11_dep, and libxkbregistry_dep,  which allows other
projects to correctly locate the headers when libxkbcommon is being
built as a Meson subproject.

The dep_libxkbregistry variable is renamed to libxkbregistry_dep,
to follow the usual convention for variables which hold declared
dependencies to be used from subproject builds.
2021-04-27 09:54:58 +03:00
Adrian Perez de Castro 5cd76a8d93 Windows: Pass list of symbols to export to MSVC
Arrange for passing .def files with the lists of symbols to export from
DLLs when building on Windows with MSVC. Without this no symbols were
being exported at all.

The .def files are generated from the .map files at build time using
scripts/map-to-def, which avoids needing to maintain two different sets
of files.
2021-04-27 09:54:00 +03:00
Peter Hutterer f434c690cc tools: change xkbcli list to output YAML
We have a lot of keyboard layouts and the current output format is virtually
useless at searching for a specific one to debug any issues with either the
layout list or the output from libxkbregistry.

Let's use YAML instead because that can easily be post-processed to extract the
specific layouts wanted, e.g. to get the list of all layouts:
  xkbcli-list | yq -r ".layouts[].layout"
to get the list of all variants of the "us" layout:
  xkbcli-list | yq -r '.layouts[] | select(.layout == "us") | .variant
and the number of option groups:
  xkbcli-list | yq -r '.option_groups[] | length'

Note that the top-level nodes have been de-capitalized, so where it was "Models"
before it is now "models" and the "Options" node is now "option_groups".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-27 09:53:32 +03:00
Peter Hutterer 693ffb073b tools: change the list separator handling
Slightly easier to read than the "bool first" approach.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-27 09:53:32 +03:00
Isaac Freund 68dddd4132 keysym: fix underflow in binary searches
This is hit when passing an empty string and XKB_KEYSYM_CASE_INSENSITIVE
to xkb_keysym_from_name currently if `(lo + hi) / 2` is 0 and `cmp < 0`,
causing mid to underflow and the the array access into name_to_keysym on
the next iteration of the loop to be out of bounds .

We *would* use ssize_t here as it is the appropriate type, but windows
unfortunately does not define it.
2021-04-25 12:25:58 +03:00
Peter Hutterer 1557668364 test: allow skipping errors in certain conditions
Add a skipError test function that can analyse rc, stdout, stderr to skip a test
even when we expect an error. We use that to skip if we couldn't find a keyboard
in the interactive-evdev test.

Fixes #235

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-22 10:02:46 +10:00
Peter Hutterer f60bdb1680 test: add extra info to the layout-tester --help output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Peter Hutterer be520ef91c test: print the layout-tester progress bar to stdout by default
tqdm prints to stderr by default but we're using that for failed keymap
compiles (which are the ones that really matter). Plus, whether we're using tqdm
is dependent on isatty(sys.stdout) anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Peter Hutterer efa5805032 test: add an LVO argument to the XKB layout tester
Slightly easier to debug if we can have it only parse one single layout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Peter Hutterer a955dca3d5 test: print the compiled keymaps to a given directory
With --keymap-output-dir, the given directory will contain a list of files named
after the layout + variant ('us', 'us(euro)', ...) that contain the keymaps for
each variant + option combination compiled.

This is still a lot, but better to sift through hundreds of keymaps than tens of
thousands.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Peter Hutterer 1cae250052 test: rework the output for the xkeyboard-config layout tester
The previous output is largely unusable. The result in the CI test runs is a 6GB
file with every compiled keymap in it and while we can grep for ERROR, it's not
particularly useful.

Let's change this and print out YAML instead - that can be machine-processed.
This patch adds a new parent class that prints itself in YAML format,
the tool invocations are child classes of that class. The result looks like this:

Example output:
- rmlvo: ["evdev", "pc105", "us", "haw", "grp:rwin_switch"]
  cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant haw --options grp:rwin_switch"
  status: 0
- rmlvo: ["evdev", "pc105", "us", "foo", ""]
  cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant foo"
  status: 1
  error: "failed to compile keymap"

Special status codes are: 99 for "unrecognized keysym" and 90 for "Cannot open
display" in the setxkbmap case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Peter Hutterer 44e8d4b044 test: add proper --verbose handling to the xkeyboard-config tester
Instead of defaulting to verbose on/off depending on isatty, make it an
argument instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20 10:30:17 +03:00
Evgeniy Khramtsov f04c7e93ce interactive-wayland: fallback to ftruncate() if needed
Fallback to ftruncate() if the underlying filesystem does not
support posix_fallocate().

Idea by: Jan Beich <jbeich@FreeBSD.org>, Niclas Zeising <zeising@FreeBSD.org>
Inspired by: Wayland cursor/os-compatibility.c
[ran: small adjustments]
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-14 13:44:57 +03:00
Jouke Witteveen 8b603dbe11 doc: fix user-configuration sample file
Support copy-pasting from the docs to get something functional.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
2021-04-11 10:25:56 +03:00
Ran Benita 5d297c5012 scripts: update license note in perfect_hash.py
Ref: https://github.com/ilanschnell/perfect-hash/issues/5

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-08 10:14:15 +03:00
Ran Benita 097a0ca7d6 Bump version to 1.2.1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-07 19:27:30 +03:00
Ran Benita 29af25eaa8 x11: fix xkb_x11_keymap_new_from_device failing when a level name is empty
The numpad:mac option doesn't specify a name for the first level:

    // On Mac keypads, level 1 and 2 are swapped.
    partial xkb_types "mac" {
        type "KEYPAD" {
            modifiers = None;
            map[None] = Level2;
            level_name[Level2] = "Number";
        };
        include "extra(keypad)"
    };

This means the atom for level name is XCB_ATOM_NONE. We tried to get its
name, which fails. This regressed in 40c00b4721.

Instead, translate it to XKB_ATOM_NONE, same as the previous behavior.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/229
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-07 19:21:10 +03:00