Commit Graph

2211 Commits (0db1dc1c4a283d13c826108b20871ab5e02b800f)

Author SHA1 Message Date
Pierre Le Marre 266427723a Test: Catch SIGUSR1 from Xvfb for X11 tests
Based on the work done by Peter Hutterer. Original commit message:

If SIGUSR1 is set to SIG_IGN, X servers (all of them, including Xvfb)
will send that signal to the parent process when they're ready to accept
connections. We can use that instead of a hardcoded sleep which brings
the wait down to ~37ms on my box.
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
Ran Benita c1b6c79aba doc: fix some Doxygen warnings
```
libxkbcommon/doc/introduction-to-xkb.md:67: warning: unable to resolve reference to 'rule-file-format' for \ref command
libxkbcommon/doc/introduction-to-xkb.md:181: warning: unable to resolve reference to 'keymap-text-format-v1' for \ref command
libxkbcommon/doc/rules-format.md:10: warning: unable to resolve reference to 'xkb-intro' for \ref command
```

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-08-05 22:29:56 +03:00
M Kelly e7f02d322a
parser: change deprecated `%pure-parser` to `%define api.pure` (#370)
This is now supported by byacc since version 2.0 20230516
2023-08-05 22:29:36 +03:00
Pierre Le Marre a4c0852687 Improved tests related to keysyms
- Add a keymap test with decimal and hexadecimal keysyms.
- Reorganize code in `test/keysym.c` by parsing type: name, Unicode and
  hexadecimal.
- Add more tests for edge cases. In particular:
  - test decimal format (currently not supported);
  - test the Unicode and hexadecimal ranges more thoroughly;
  - test with wrong case without the XKB_KEYSYM_CASE_INSENSITIVE flag;
  - test surrounding spaces.
- Document the tests.
2023-07-14 09:22:24 +02:00
Pierre Le Marre 7a815ad307 Fix parsing of numeric keysyms in ExprResolveKeySym
`ExprResolveKeySym` in `expr.c` does not parse non-digit numeric
keysyms.

Fixed by checking upper bound; also add warning messages.
2023-07-14 09:22:24 +02:00
Pierre Le Marre 0da68bc648 Simplify parsing of numeric keysyms in parser.y
In `parser.y`, a numeric keysym is parsed by formatting it in its
hexadecimal form then parsed as a keysym name. This is convoluted.

Fixed by checking directly the upper bound.
2023-07-14 09:22:24 +02:00
Pierre Le Marre 397e7e013d Fix xkb_keysym_from_name for numeric keysyms
When parsing hexadecimal keysym using `xkb_keysym_from_name`,
the result is limited by `parse_keysym_hex` to 0xffffffff, but the
maximum keysym is XKB_MAX_KEYSYM, i.e. 0x1fffffff.

Fixed by adding an upper bound.
2023-07-14 09:22:24 +02:00
Pierre Le Marre 4823838fa3 Move STRINGIFY to utils.h and add STRINGIFY2 2023-07-14 09:22:24 +02:00
Pierre Le Marre 8c7076a0b5 Improve the documentation of keysyms in xkbcommon.h 2023-07-14 09:22:24 +02:00
Pierre Le Marre e811743ff2 Add XKB_KEYSYM_MIN and XKB_KEYSYM_MAX
Keysyms are 32-bit integers with the 3 most significant bits always set
to zero. See: Appendix A “KEYSYM Encoding” of the X Window System
Protocol at https://www.x.org/releases/current/doc/xproto/x11protocol.html#keysym_encoding.

Add a new constants XKB_KEYSYM_MIN and XKB_KEYSYM_MAX to make the
interval of valid keysyms more obvious in the code.
2023-07-14 09:22:24 +02:00
Pierre Le Marre 0d01a933bb Replace keycode numeric offset with EVDEV_OFFSET
Add a constant `EVDEV_OFFSET` to make the semantic of the offset clearer.
2023-07-04 10:59:19 +02:00
Peter Hutterer 0624d8ff49 Check the doxygen version
Doxygen 1.9.7 breaks our urls, see issue #347. Let's put a check for the
doxygen version into our CI build so that if our base distro updates beyond
that, the CI fails and we know we have to build doxygen from scratch or
update to some other version that's supported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-04 14:56:32 +10:00
Peter Hutterer 134c6bb28e Configure github pages
Upload the doxygen output as artifact from the linux build and use that from
the pages job where we combine the static website with our newly build HTML
docs.  The GitHub actions/download-artefact doesn't work across workflows so
we use the other popular one that can do this. The rest of the job is
basically copy/paste from the "Static HTML" example GitHub provides.

To make this useful as drop-in replacement, replace the one fixed link to the
API docs a relative one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-04 14:56:32 +10:00
Ran Benita f75c0a2de6 xkbcli: allow compile-keymap without args
All of the arguments have defaults, but still an argument is required.
Make it work.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-07-03 13:53:26 +10: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
Pierre Le Marre fc25e0f0f7 Test(compose): fix assumption on environment variables
The test `test_from_locale` fails when there is a user-defined compose
file, e.g. ~/.XCompose.

Indeed, the function `xkb_compose_table_new_from_locale` use various
environment variables to determine the location of the compose file.

Ensure no environment variables but the required ones are set, in order
to have robust tests.
2023-06-28 07:52:04 +02:00
Pierre Le Marre de9d82077c interactive-evdev: includes options
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".
2023-06-26 09:52:38 +02:00
Pierre Le Marre 2c86216b5b CI: Fix documentation generation for macOS
- Force Doxygen version 1.9.6, because 1.9.7 breaks our doc cool URIs,
  i.e. our system that maintain stable doc pages via redirection.

  Associated issue in Doxygen:
  https://github.com/doxygen/doxygen/issues/10146

- Install graphviz to build the .dot files.
2023-06-26 09:50:01 +02:00
Pierre Le Marre eec389037e Fix typo in ensure-stable-doc-urls.py 2023-06-26 09:50:01 +02:00
alois31 f3210cbf27
compose: drop the 65535 node limit (#343)
In commit 1638409b22, the number of
compose nodes was limited to 65535 to enable "future optimizations",
which apparently means slightly reduced memory usage due to fitting in
a uint16_t. At this time, it was mentioned that the author was not
aware of "any compose files which come close".

However, I'm one of the users that actually do require a larger number
of nodes for their compose file. Thus, use a uint32_t again and raise
the limit significantly.
2023-05-15 15:23:16 +03: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
Pierre Le Marre 183761ac24 Do not interpret nor emit invalid Unicode encoding forms
Surrogates are invalid in both UTF-32 and UTF-8.
See https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G28875
and https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G31703
2023-05-13 22:02:46 +03:00
Pierre Le Marre 5fbffaf035 Add warning when RMLVO with no layout but variant set
There is no feedback that they are both replaced with default values.
Fix it by adding a warning informing about missing layout and show the
defaults for both.
2023-05-13 21:59:37 +03:00
Ran Benita c8efb70406 ci: bump runs-on versions
Mostly to bump to macos one which will hopefully fix CI issues there.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-12 22:27:17 +03:00
Ran Benita 5a5ab3e880 utils: fix printf format warnings on mingw
See:
https://github.com/mesonbuild/wrapdb/pull/819
c86ae6acf5/src/image_int.hpp (L15)
https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-06 17:29:45 +03:00
Ran Benita 45ba936bf0 ci/windows: use the vs backend instead of ninja backend
So we have some coverage of that.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-05 11:17:07 +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
Peter Hutterer b06aedb8ba scanner: allow for a zero terminated string as keymap
As the documentation for xkb_keymap_new_from_buffer() states, the "input string
does not have to be zero-terminated". The actual implementation however failed
with "unrecognized token/syntax error" when it encountered a null byte.

Fix this by allowing a null byte at the last position of the buffer. Anything
else is likely a client error anyway.

Fixes #307
2023-05-05 09:57:23 +10:00
Peter Hutterer 98b3314278 README: use meson compile/test over ninja
This is backend-agnostic and the recommended way to invoke compilation.

This requires meson 0.55 (July 2020) and we only require 0.51 but at this point
I'm expecting most users who require the README instructions will have a
recent-enough meson anyway.
2023-05-05 09:44:56 +10:00
Pierre Le Marre 536cf42704 .editorconfig: add .md config
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-04 11:58:48 +03:00
Ran Benita e422601121 Use consistent indentation for map and CSS files
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-04 11:58:48 +03:00
Peter Hutterer 8b7c1850e1 registry: remove a few asprintf/free() calls with snprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-04 18:46:16 +10:00
Peter Hutterer a50890b155 registry: simplify strdup() error handling
strdup() is the least likely call to fail here, let's move it to the bottom so
we don't need to worry about the allocated string.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-04 18:46:16 +10: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
Ran Benita 003fdee137 keysyms: add new keysyms XF86EmojiPicker, XF86Dictate
Ref: 914d8f5e0f
Ref: a839f0c7fc
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-04-12 10:29:42 +03:00
Ran Benita bd79a960f5 Possible fix for non-MSVC windows compilers
`_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>
2023-04-11 23:29:25 +03:00
Peter Hutterer 13d4b7f641 keysym: replace deprecated Serbian_DZE with Cyrillic_DZHE
Same numeric value for both and the Serbian one has been listed as deprecated
for decades.

See https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/69#note_1843415

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-31 10:11:59 +10: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 c6ff79d5c1 NEWS: add "New API" section for last release
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-01-02 21:36:03 +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 5ba075abe0 doc: clarify "server state" and "client state" distinction
Add a common page for the concept and link to there from the relevant
functions.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-12-17 13:53:29 +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 7428eb6e8b ci: don't run linux on push to non-master branches
It's redundant with the pull request run.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-12-16 21:36:13 +02:00