Commit Graph

142 Commits (82305adb51371b5426f22c4c924b221c65abe642)

Author SHA1 Message Date
Pierre Le Marre 4f52d6068e keysyms: Add xkb_keysym_is_assigned
Add internal API `xkb_keysym_is_assigned` for tests, guarded by
`ENABLE_PRIVATE_APIS` in order to avoid increasing the size of the installed library.
2024-01-10 14:18:43 +01:00
Brendan Le Foll 244128aa79
Update meson.build error message when enable-wayland enabled (#419)
Let's drop the explicit versions, meson prints a message anyway that 
specifies the version we have vs the one we need.
2023-12-14 10:44:00 +10:00
Pierre Le Marre 20329baf4d xkbcomp: Use `steal` for better memory handling 2023-12-04 10:44:52 +10:00
Pierre Le Marre 20c6fa62a7 registry: Use `steal` for better memory handling 2023-12-04 10:44:52 +10:00
Pierre Le Marre bc330c00e6 xkbcli: Promote compose to xkbcli-compile-compose
Previously this tool was only used for internal testing and thus
not installed. But it is useful for debugging, much like
xkbcli-compile-keymap.
2023-11-19 09:57:24 +01:00
Ran Benita d2a08f761c Bump version to 1.6.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-10-08 23:46:48 +03:00
Pierre Le Marre 1c1542d64f Tools: Add bash completions for xkbcli
- 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?
2023-10-05 06:24:02 +02:00
Ran Benita a17701327e Compose: add iterator API
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>
2023-09-26 09:02:45 +02:00
Pierre Le Marre 417d0747b6 Add xkb-check-messages tool
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.
2023-09-19 08:49:52 +02:00
Pierre Le Marre ef81d04eef Structured log messages with a message registry
Currently there is little structure in the log messages, making
difficult to use them for the following use cases:

- A user looking for help about a log message: the user probably
  uses a search engine, thus the results will depend on the proper
  indexing of our documentation and the various forums. It relies
  only on the wording of the message, which may change with time.
- A user wants to filter the logs resulting of the use of one of the
  components of xkbcommon. A typical example would be testing
  xkeyboard-config against libxkbcommon. It requires the use of a
  pattern (simple words detection or regex). The issue is that the
  pattern may become silently out-of-sync with xkbcommon.

A common practice (e.g. in compilers) is to assign unique error codes
to reference theses messages, along with an error index for
documentation.

Thus this commit implements the following features:

- Create a message registry (message-registry.yaml) that defines the
  log messages produced by xkbcommon. This is a simple YAML file that
  provides, for each message:

  - A unique numeric code as a short identifier. It is used in the
    output message and thus can be easily be filtered to spot errors
    or searched in the internet. It must not change: if the
    semantics of message changes, it is better to introduce a new
    message for clarity.
  - A unique text identifier, meant for two uses:

    1. Generate constants dealing with log information in our code
       base.
    2. Generate human-friendly names for the documentation.

  - A type: currently warning or error. Used to prefix the constants
    (see hereinabove) and for basic classification in documentation.
  - A short description, used as concise and mandatory documentation.
  - An optionnal detailed description.
  - Optional examples, intended to help the user to fix issues
    themself.
  - Version of xkbcommon it was added. For old entries this often
    unknown, so they will default to 1.0.0.
  - Version of xkbcommon it was removed (optional)

  No entry should ever be deleted from this index, even if the message
  is not used anymore: it ensures we have unique identifiers along the
  history of xkbcommon, and that users can refer to the documentation
  even for older versions.

- Add the script update-message-registry.py to generate the following
  files:

  - messages.h: message code enumeration for the messages currently
    used in the code base. Currently a private API.
  - message.registry.md: the error index documentation page.

- Modify the logging functions to use structured messages. This is a
  work in progress.
2023-09-19 08:49:52 +02:00
Pierre Le Marre 0e3e2d1730 interactive-evdev: add option to print modmaps
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`.
2023-09-18 16:14:12 +02:00
Pierre Le Marre fe9cd66fca Test: Enable x11comp and use the xvfb wrapper
This test was previously disabled in 914e84e018.

Note that it requires a recent version of xkeyboard-config to succeed.
2023-09-18 16:07:09 +02:00
Pierre Le Marre 26b1a07659 Test: Use a xvfb wrapper for x11 test
The x11 test is currently silently skipped in CI, because it requires a
running X server.

Create a xvfb wrapper to run the test. We do not use `xvfb-run`, because
it is a shell script and it causes valgrind to detect unrelated memory
issues in the shell (dash, bash).

Improve wrapper using a special ELF section

TODO: The wrapper is intended to be used with the x11comp test as well.
2023-09-18 16:07:09 +02:00
Pierre Le Marre 37fdd87c82 Add a meson flag to make cool URIs optional
The script `ensure-stable-doc-urls.py` relies on the Doxygen output files
names. These may change between Doxygen versions, although the Doxygen
developers intend stability.

Since the script is useful mainly for the online documentation of
xkbcommon, make the target `doc-cool-uris` optional.
2023-06-30 17:14:59 +02:00
Wismill 64aaa7cda2
Add support for stable doc URLs (#342)
Doc URLs may change with time because they depend on Doxygen machinery.
This is unfortunate because it is good practice to keep valid URLs
(see: https://www.w3.org/Provider/Style/URI.html).

I could not find a built-in solution in Doxygen, so the solution proposed
here is to maintain a registry of all URLs and manage legacy URLs as
redirections to their canonical page.

This commit adds a registry of URLs that has three functions:
- Check no previous URL is now invalid.
- Add aliases for moved pages.
- Generate redirection pages for aliases. The redirection works with
  a simple <meta http-equiv="refresh"> HTML tag. See:
  https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#http-equiv

This commit also initialize the URLs registry with current pages and some
redirections needed after recent documentation refactoring.

Finally, the CI is updated to catch any change that invalidate previous
URLs.
2023-05-14 15:11:15 +02:00
Pierre Le Marre fc664cf1cc Improve documentation
- Add introduction to XKB
- Embrace Doxygen features
- More cross links
2023-05-13 22:05:23 +03:00
Ran Benita e020174ac6 build: show a summary
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-05 11:17:07 +03:00
Ran Benita 80be81e5ce build: require bison >= 2.3a
At least 2.3 (released 2006) which is the version shipped with macos
doesn't work. Reading the changelog I think 2.3a *should* work, so
require that.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-05 11:17:07 +03:00
Ran Benita 60d38b0c05 build: bump required meson to 0.52.0
Support for version checks in `find_program()`.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-05 11:17:07 +03:00
Ken Cunningham 46b7753fb8 meson.build: register libxkbcommon.dylib link
meson needs to know that the executable tools
link against libxkbcommon.dylib so that the
@rpath references used during the build/test phases
can be rewritten to full path names on install
2023-05-04 10:17:22 +10:00
Wismill 5b5b67f28c
Add support for modmap None (#291)
Unlike current xkbcommon, X11’s xkbcomp allows to remove entries in
the modifiers’ map using “modifier_map None { … }”.

“None” is translated to the special value “XkbNoModifier” defined in
“X11/extensions/XKB.h”. Then it relies on the fact that in "CopyModMapDef",
the following code:

    1U << entry->modifier

ends up being zero when “entry->modifier” is “XkbNoModifier” (i.e. 0xFF).
Indeed, it relies on the overflow behaviour of the left shift, which in
practice resolves to use only the 5 low bits of the shift amount, i.e.
0x1F here. Then the result of “1U << 0xFF” is cast to “char”, i.e. 0.

This is a good trick but too magical, so in libxkbcommon we will use
an explicit test against our new constant XKB_MOD_NONE.
2023-05-01 23:30:41 +03:00
Wismill 0e9c2ec97e
Improve the doc of the XKB keymap text format, V1 (#321)
- Add table of contents
- Add terminology section
- (WIP) Add Introduction to the format
- Improve the keycode section
- Improve the interpret section
- Add guide to create and use modifiers
- (WIP) Add actions documentation
- Add cross-references
- Add keysyms header to documentation
2023-04-30 22:30:36 +03:00
Simon Ser 5b5ec0ee27 build: override dependency for use as subproject
This allows xkbcommon to be used as a subproject.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-19 13:00:38 +02:00
Ran Benita cecaa01df1 Bump version to 1.5.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-01-02 21:23:30 +02:00
Ran Benita 233617d086 build: fix wayland-scanner deprecation code -> private-code
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-01-02 21:10:45 +02:00
Ran Benita e5444f4195 build: require meson >= 0.51, fix meson deprecations
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-12-16 21:37:06 +02:00
Ran Benita 9d1043dcb5 build: remove -fsanitize-undefined-trap-on-error
Meson complains; it's probably not that important anymore when using the
`-Db_sanitize` options.

meson.build:36: WARNING: Consider using the built-in option for sanitizers instead of using "-fsanitize-undefined-trap-on-error".

Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-12-14 18:58:11 +02:00
Ran Benita 2530f6444b build: reenable test-context in MSVC
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-09-24 12:31:53 +03:00
Ran Benita f9858bf5b9 test: move mkdir & mkdtemp calls to common place and fix them on MSVC
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-09-24 12:31:53 +03:00
Ran Benita 57af9cb71f Bump version to 1.4.1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-05-21 22:55:22 +03:00
Ran Benita ea6580cc39 Bump version to 1.4.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-02-04 12:41:50 +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
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 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 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 baf5522649 bench: add atom benchmark
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-27 16:41:32 +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
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 086353b380 Bump version to 1.2.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-04-03 14:11:38 +03:00
Ran Benita 90e2d5ee76 build: require C11
I'd really like to use anonymous unions/structs. Supposedly even MSVC
supports it now. Let's try and see.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-03-30 20:42:31 +03:00
Ran Benita 82a5bdc43c Bump version to 1.1.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-02-27 22:48:35 +02:00
Ran Benita 83e3a53ddc doc: add keymap-format-text-v1.md to the HTML documentation
It's incomplete but might be helpful for someone.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-02-27 22:38:21 +02:00
Peter Hutterer d1ba81c4dd meson.build: replace the remaining join_paths() with the nicer / syntax
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-22 13:43:16 +02:00
Peter Hutterer 0abd430e85 test: add a keysym tester
A simple script that creates a new layout with the given keysym replacing TLDE.
Then we compile a keymap and search for the keysym being assigned to TLDE and
bail if that fails.

The list of keysyms is manually maintained but we only need to add one or two to
spot-check whenever the xorgproto is updated.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-22 13:43:16 +02:00
Ran Benita c60b77ea51 Bump version to 1.0.3
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-23 20:30:13 +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