- Add check for recursive includes of keymap components. It relies on
limiting the include depth. The threshold is currently to 15, which
seems reasonable with plenty of margin for keymaps in the wild.
- Add corresponding new log message `recursive-include`.
- Add tests for recursive includes.
The string `buf` was not freed after each call to `asprintf_safe`.
Avoid allocating and introduce the new message: `XKB_ERROR_INSUFFICIENT_BUFFER_SIZE`.
- Add bash completion script. It parses the commands help messages to
provide the completions, thus any new subcommand or option will be
supported, as long as it has its entry in the help messages. This
should result in low maintenancei effort.
- Add installation entry in Meson. The path can be configured using
the following options:
- `enable-bash-completion` to enable the installation;
- `bash-completion-path` to control the installation path. It will
default to: `share/bash-completion/completions`.
TODO: completion for other shells, such as zsh?
NULL usually terminates the strings; allowing to produce it via escape
sequences may lead to undefined behaviour.
- Make NULL escape sequences (e.g. `\0` and `\x0`) invalid.
- Add corresponding test.
- Introduce the new message: XKB_WARNING_INVALID_ESCAPE_SEQUENCE.
Allow users to iterate the entries in a compose table. This is useful
for other projects which want programmable access to the sequences,
without having to write their own parser.
- New API:
- `xkb_compose_table_entry_sequence`;
- `xkb_compose_table_entry_keysym`;
- `xkb_compose_table_entry_utf8`;
- `xkb_compose_table_iterator_new`;
- `xkb_compose_table_iterator_free`;
- `xkb_compose_table_iterator_next`.
- Add tests in `test/compose.c`.
- Add benchmark for compose traversal.
- `tools/compose.c`:
- Print entries instead of just validating them.
- Add `--file` option.
- TODO: make this tool part of the xkbcli commands.
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Signed-off-by: Ran Benita <ran@unusedvar.com>
Usually it is better to use the corresponding human-friendly keysym
names. If there is none, then the keysym is most probably not
supported in the ecosystem. The only use case I see is similar to the
PUA in Unicode (see: https://en.wikipedia.org/wiki/Private_Use_Areas).
I am not aware of examples of this kind of use.
This tool checks whether messages codes are supported.
This is useful e.g. for CI, where one may want to grep for some XKB
error codes and ensure that these are still supported.
Add an option to print modmap and vmodmap of relevant keys, as well as
virtual modifiers mapping to real modifier. This is useful for debugging.
It uses private API, so we compile it separately in the fashion of
`xkbcli-compile-keymap/compile-keymap`.
Currently the interactive tools print the string result of key strokes
as it is, without any escape. This is especially annoying for trivial
keysyms such as: Return, BackSpace and Escape.
Fix this by displaying the Unicode code point notation (e.g U+000D for
Return) for single control characters from the C0 set and DEL.
This is a hack: ideally we would like to escape any non-printable
character in the utf-8 string.
Currently there is no interactive tool allowing to set the include
paths of the context, such as in "compile-keymap". Note that only
"interactive-evdev" makes sense, because it does not rely on a
compositor.
Add --include and --include-defaults to "interactive-evdev" tool.
The code is adapted from "compile-keymap".
`_MSC_VER` is specific to MSVC, but there can be other compilers targeting
windows. Hopefully they do define `_WIN32`, so let's use that.
Refs: https://github.com/xkbcommon/libxkbcommon/issues/305
Signed-off-by: Ran Benita <ran@unusedvar.com>
We need to request the lower version of the interface versions we
support and the server supports, not the higher version.
Using the higher version caused crashes due to unbound callbacks on
GNOME, which supports a higher version of `xdg_wm_base`.
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
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>
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>
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>
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>
Turns out FreeBSD supports evdev, so this toll can work on it; however
it does not support epoll, so switch to poll, which is portable.
Reported-by: Evgeniy Khramtsov <evgeniy@khramtsov.org>
Signed-off-by: Ran Benita <ran@unusedvar.com>
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
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>
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>
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>
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>
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>