|
dc63e5f8
|
2025-07-07T12:28:24
|
|
Ensure config.h is always included first
While `config.h` may not be necessary in every file, it ensures
consistency and makes code refactoring safer.
|
|
d351abee
|
2025-06-19T11:24:44
|
|
test: Use explicit keymap format for test_compile_file()
|
|
ef6a550f
|
2025-06-16T15:48:25
|
|
Add xkb_keymap_new_from_rmlvo()
Use the new RMLVO builder API to compile keymaps.
|
|
7f39be25
|
2025-06-10T15:46:45
|
|
test: Use explicit keymap output format for test_compile_output()
|
|
f3386743
|
2025-06-09T16:44:54
|
|
test: Use explicit keymap format in test_compile_output()
|
|
2acf5eca
|
2025-06-09T16:26:56
|
|
test: Use explicit keymap format in test_compile_buffer()
|
|
6c5ea6fc
|
2025-06-09T16:15:20
|
|
test: Use explicit keymap format in test_compile_string()
|
|
79e95509
|
2025-06-09T11:07:36
|
|
test: Use explicit keymap format in test_compile_rules()
|
|
551cca2a
|
2024-12-03T10:12:03
|
|
state: Add server API for updating latched and locked mods & layout
Up to now, the “server state” `xkb_state` API only offered one entry
point to update the server state – `xkb_state_update_key`, which reflects
the direct keyboard keys state. But some updates come out-of-band from
keyboard input events stream, for example, a GUI layout switcher.
The X11 XKB protocol has a request which allows for such updates,
`XkbLatchLockState`[^1], but xkbcommon does not have similar
functionality. So server applications ended up using
`xkb_state_update_state` for this, but that’s a function intended for
client applications, not servers.
Add support for updating the latched & locked state of the mods and
layout. Note that the depressed states cannot be updated in this way --
XKB does not expect them to be updated out of band.
[^1]: https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html#Querying_and_Changing_Keyboard_State
Fixes: #310
Signed-off-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
|
|
21a341f2
|
2025-03-24T09:21:40
|
|
test: Enable 3rd party compilers
|
|
113ac304
|
2025-01-25T03:18:01
|
|
meson: link tests and benches against shared library, not static library
This makes the tests, and especially benches, more realistic, since
xkbcommon is almost always used as a shared library.
Also significantly reduces the build time with LTO enabled (for me, from
90s to 30s).
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
df2322d7
|
2025-02-05T14:41:21
|
|
Replace include guards by `#pragma once`
We currently have a mix of include headers, pragma once and some
missing.
pragma once is not standard but is widely supported, and we already use
it with no issues, so I'd say it's not a problem.
Let's convert all headers to pragma once to avoid the annoying include
guards.
The public headers are *not* converted.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
e120807b
|
2025-01-29T15:35:22
|
|
Update license notices to SDPX short identifiers + update LICENSE
Fix #628.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
7036e46c
|
2025-01-13T15:20:47
|
|
symbols: Add tests for key merge modes (keysyms/actions)
This commit adds tests for merging various key configurations:
- With/without keysyms/actions
- Single/multiple keysyms/actions per level
We test all the merge modes for including a map (global) as well as
directly on the keys (local):
- default (global: include, local: implicit)
- augment
- override
- replace
The tests data are generated with:
- A Python script `scripts/update-merge-modes-tests.py` for keycodes
and symbols data. Use `--debug` for extra comments to help debugging.
The script can optionally generate C headers for alternative key
sequence tests, that were used before implementing golden tests.
The latter tests are not used anymore (duplicate with golden tests)
but their generator is kept for now, as they can still be useful for
debugging or writing similar tests.
- The `merge-modes` test generates its own keymap files for golden
tests, using: `build/test-merge-modes update`. It can also replace
them with the obtained output rather than the expected one using
`build/test-merge-modes update-obtained`, which is very useful for
debugging.
|
|
6c6dbf32
|
2025-01-07T11:19:30
|
|
state: Fix LatchGroup action with latchToLock disabled
A `LatchGroup` action with the `latchToLock`` option disabled can apply
its latch effect multiple times.
|
|
0ed9390c
|
2024-03-14T09:08:55
|
|
test(x11): Do not skip test when setup fails
With the current setup, the tests passes even if there is an issue with
the setup. X11 tests are already guarded with `enable-x11=true`, so
there is no reason to skip these tests if we built the X11 support.
Meson supports the GNU convention for exit code in tests:
- 77: test skipped; already used in xkbcommon: `SKIP_TEST`.
- 99: hard error/setup failure; introduced in this commit:
`TEST_SETUP_FAILURE`.
Meson reports setup failure as `ERROR`, while a test failure is reported
as `FAIL`. In both cases it will make the CI fail, allowing us to
correctly detect any errors.
Fixed:
- Use `TEST_SETUP_FAILURE` instead of `SKIP_TEST` for X11 setup
failures.
- Xvfb wrapper: Add verbosity for debugging.
|
|
e325e65e
|
2024-02-20T08:13:37
|
|
Add test_unit to all tests
Currently it only ensure we do not buffer `stdout`.
|
|
0a577a09
|
2023-11-07T12:58:41
|
|
xkbcli-compile-compose: Fix string result escaping
Currently the result string is not escaped and may produce invalid
results.
Fixed by introducing an ad-hoc escape function and relative tests.
|
|
bd79a960
|
2023-04-11T23:24:47
|
|
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>
|
|
f9858bf5
|
2022-09-24T10:27:51
|
|
test: move mkdir & mkdtemp calls to common place and fix them on MSVC
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
314b6486
|
2020-06-24T08:30:50
|
|
test: drop some now-obsolete functions
These were moved to tools/tools-common.c and now that all tools are switched
over, they're no longer needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
c09bf363
|
2020-06-23T14:01:48
|
|
test: untangle interactive-evdev from the test headers
Move (sometimes duplicate) the required bits into new shared files
tools-common.(c|h) that are compiled into the internal tools library. Rename the
test_foo() functions to tools_foo() and in one case just copy the code of the
keymap compile function to the tool.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
f1186acf
|
2019-08-05T15:53:04
|
|
MSVC: Provide implementations of [un]setenv()
Reference:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s
|
|
a0a41332
|
2016-02-27T19:06:14
|
|
state: allow different modes for calculating consumed modifiers
The current functions dealing with consumed modifiers use the
traditional XKB definition of consumed modifiers (see description in the
added documentation). However, for several users of the library (e.g.
GTK) this definition is unsuitable or too eager. This is exacerbated by
some less-than-ideal xkeyboard-config type definitions (CTRL+ALT seems
to cause most grief...).
So, because we
- want to enable alternative interpretations, but
- don't want to expose too much internal details, and
- want to keep things simple for all library users,
we add a high-level "mode" parameter which selects the desired
interpretation. New ones can be added as long as they make some sense.
All of the old consumed-modifiers functions keep using the traditional
("XKB") mode. I mark xkb_state_mod_mask_remove_consumed() and as
deprecated without adding a *2 variant because I don't it is very useful
(or used) in practice.
Alternative modes are added in subsequent commits (this commit only adds
a mode for the existing behavior).
https://github.com/xkbcommon/libxkbcommon/issues/17
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fc41d3d6
|
2016-05-05T15:41:13
|
|
test: use termios instead of system() for disabling terminal echo
Takes care of GCC's annoyingly persistent warn_unused_result warnings.
But it's better to avoid system() I suppose.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5cefa5c5
|
2014-01-29T13:46:42
|
|
test/interactive-evdev: add compose support
To try, do e.g.:
sudo ./test/interactive-evdev -l us -v intl -o compose:ralt -d
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2f93c788
|
2013-07-30T15:06:40
|
|
x11: add a couple of tests
Add two tests:
./test/interactive-x11
which is like test/interactive-evdev, but should behave exactly like your
X keyboard and react to state and keymap changes - in other words, just
like typing in xterm. Press ESC to exit.
./test/x11
which currently should only print out the same keymap as
xkbcomp $DISPLAY out.xkb
(modulo some whitespace and some constructs we do not support.)
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d63e0ab8
|
2013-07-30T13:38:51
|
|
test: rename test/interactive to interactive-evdev
And share the key-printing functions. In preparation for adding more
interactive-* variants.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ec9a02a2
|
2013-07-24T10:05:02
|
|
Get rid of the usage of PATH_MAX
PATH_MAX is optional in POSIX, so avoid its unconditional usage
allocating and freeing buffers as needed.
To avoid too many malloc/free in the for loop in FindFileInXkbPath,
a buffer is grown according to the size needed at each iteration.
|
|
36f55c49
|
2013-03-11T12:53:39
|
|
keymap: add xkb_keymap_new_from_buffer()
The current API doesn't allow the caller to create keymaps from mmap()'ed
files. The problem is, xkb_keymap_new_from_string() requires a terminating
0 byte. However, there is no way to guarantee that when using mmap() so a
user currently has to copy the whole file just to get the terminating zero
byte (assuming they cannot use xkb_keymap_new_from_file()).
This adds a new entry xkb_keymap_new_from_buffer() which takes a memory
location and the buffer size in bytes.
Internally, we depend on yy_scan_{string,byte}() helpers. According to
flex documentation these already copy the input string because they are
wrappers around yy_scan_buffer().
yy_scan_buffer() on the other hand has some insane requirements. The
buffer must be writeable and the last two bytes must be ASCII-NUL. But the
buffer may contain other 0 bytes just fine.
Because we don't want these constraints in our public API,
xkb_keymap_new_from_buffer() needs to create a copy of the input memory.
But it then calls yy_scan_buffer() directly. Hence, we have the same
number of buffer-copies as with *_from_string() but without the
terminating 0 requirement.
The explicit yy_scan_buffer() call is preferred over yy_scan_byte() so the
buffer-copy operation is not hidden somewhere in flex.
Maybe some day we no longer depend on flex and can have a zero-copy API. A
user could mmap() a file and it would get parsed right from this buffer.
But until then, we shouldn't expose this limitation in the API but instead
provide an API that some day can work with zero-copy.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
[ran: rebased on top of my branch]
Conflicts:
Makefile.am
src/xkbcomp/xkbcomp.c
|
|
4d7600bd
|
2013-03-19T10:59:38
|
|
test: Add va_list variant of test_key_seq
For use when chaining tests.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
964b2a40
|
2013-03-19T10:29:49
|
|
test: Suppress RMLVO environment inheritance by default
But add a flag to allow it for later usage.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
54f95f49
|
2013-03-18T21:02:35
|
|
test: Add flags argument to test_get_context()
Allowing overriding of environment suppression, at first.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
a1f203c0
|
2013-03-18T20:55:18
|
|
test: Move test_key_seq to common.c
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
fcd20290
|
2012-09-21T14:44:17
|
|
Don't use xkbcommon-compat names in internal code
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b2110705
|
2012-09-16T14:45:32
|
|
Organize src/ and test/ headers
- Add context.h and move context-related functions from xkb-priv.h to
it.
- Move xkb_context definition back to context.c.
- Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it.
- Rename xkb-priv.h to map.h since it only contains keymap-related
definitions and declarations now.
- Remove unnecessary includes and some and some other small cleanups.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b4b40d73
|
2012-09-12T16:54:07
|
|
Copyright updates
With Dan Nicholson's permission (via email), update his copyright and
license statements to the standard X.Org boilerplate MIT license, as
both myself and Ran have been using.
Clean up my copyright declarations (in some cases to correct ownership),
and add copyright/license statements from myself and/or Ran where
appropriate.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
89723b7c
|
2012-07-24T19:54:14
|
|
utils: add/replace string equality macros
It's more tidy and less error prone, since we use strcasecmp == 0 a lot.
We replace strcmp == 0 by streq, strcasecmp == 0 by istreq,
uStrCasePrefix by istreq_prefix and uDupString by strdup_safe.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9308a460
|
2012-07-17T10:20:15
|
|
Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually
fix up a few things: it really likes justifying struct initialisers.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
3e86ebca
|
2012-07-12T14:15:08
|
|
Add a library of common test functions
Including creating a context (will come in useful soon), opening and
reading files, and compiling keymaps.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|