kc3-lang/libxkbcommon/test

Branch :


Log

Author Commit Date CI Message
842497d9 2025-01-22 16:46:11 clang-tidy: Fix implicit or incorrect integer casts
5389a31e 2025-01-22 17:33:03 clang-tidy: Use memcpy instead of the insecure strcpy
53b3f446 2025-01-22 17:43:53 clang-tidy: Fix headers includes
0c940827 2025-01-22 16:39:35 clang-tidy: Macro arguments should be enclosed in parentheses
b76617e6 2025-01-22 16:42:47 clang-tidy: Various fixes related to IO
b1e1aae6 2025-01-23 15:20:44 xkbcomp: Fix memory leak when extra content after keymap It triggers with e.g.: ``` xkb_keymap { xkb_keycodes { }; }; }; // erroneous ```
709027ec 2025-01-23 09:12:15 symbols: Fix inconsistent error handling Currently the following keymap triggers a critical error (invalid `vmods`) only for the second key statement, while it should handle both equally. ``` xkb_keymap { xkb_keycodes { <> = 9; }; xkb_types { }; xkb_compat { }; xkb_symbols { key <> { vmods = [], repeats = false }; key <> { repeats = false, vmods = [] }; }; }; ``` Fixed by parsing the whole symbols body and failing if any error was found.
ec2915fe 2025-01-22 17:18:21 symbols: Fix a possible null pointer deference Introduce a new Expression type, `EXPR_EMPTY_LIST`, to avoid the ambiguity between action and keysym empty lists. Two alternatives were rejected to keep the semantics clear: - Using `EXPR_KEYSYM_LIST`: because we would end up accepting an empty keysym list while processing actions. - Using NULL: convey no info and is hazardous.
88a3d3c2 2025-01-23 16:03:51 tests: Refactor buffercomp Move tests into proper functions and log tests names.
8c071403 2025-01-21 10:40:03 test/keysym: fix comparison of integers of different signs ``` ../test/keysym.c:320:9: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] 320 | U16_APPEND(cp_string, offset, ARRAY_SIZE(cp_string), cp, isError); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/unicode/utf16.h:396:47: note: expanded from macro 'U16_APPEND' 396 | } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \ | ~~~~~^ ~~~~~~~~ ``` Signed-off-by: Ran Benita <ran@unusedvar.com>
91e58f0e 2025-01-21 10:38:35 test/registry: remove unused function Signed-off-by: Ran Benita <ran@unusedvar.com>
2a60432e 2025-01-21 10:25:55 test/xvfb-wrapper: remove unused code Signed-off-by: Ran Benita <ran@unusedvar.com>
b0d9a790 2025-01-15 12:03:10 vmods: Fix explicit vmods not dumped
11140ded 2025-01-10 13:58:39 Use test map for checking --version-script, instead of full map Various problems can occur when using the full `xkbcommon.map` file when checking whether the `--version-script` linker option works in `meson.build`. For instance, newer linkers typically complain about non-existing symbols, so in commit ebe4157 `--undefined-version` was added to work around that. But then in commit 1d8a25d6 another workaround needed to be added for older linkers. It is better to use a minimalistic linker script for testing instead. The other workarounds can then be removed.
e3e44998 2025-01-16 20:23:47 Fix missing or incorrect integer literal suffixes The correct suffix is required in order to have the expected value in a portable way.
c7fdf506 2025-01-16 20:23:28 Use portable integer literal suffixes
3fdd822d 2025-01-16 02:21:29 state: Fix mods not being independently cleared (#584) The modifiers filters should ensure minimal interaction between them, but currently the Latch mod filters are overzealous and mess with the mods from other filters set to be cleared, resulting in some modifiers permanently set. Fixed by clearing mods properly with `OR` rather than direct setting of `state::clear_mods`. While we are at it, `state::set_mods` should be `OR`ed as well. This should not have any impact for now, but this is more future-proof. Fixes #583 Co-authored-by: Jules Bertholet <julesbertholet@quoi.xyz> Co-authored-by: Pierre Le Marre <dev@wismill.eu>
dfa286b2 2025-01-15 13:56:36 compat: Fix Interp & LED merge modes
7036e46c 2025-01-13 15: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-07 11:19:30 state: Fix LatchGroup action with latchToLock disabled A `LatchGroup` action with the `latchToLock`` option disabled can apply its latch effect multiple times.
325ba10e 2025-01-07 16:27:50 state: Fix LEDs driven by the group state When the indicator field `whichGroupState` is set to `Base` or `Latched`, the group masks should be considered only as boolean values as per the XKB specification.
7d08bf43 2025-01-07 18:33:21 state: Add test for LEDs driven by the group state
93b75c63 2024-12-22 17:49:24 x11: Keep level when the keysym is undefined but not the action When getting the keymap from X11, the following: ``` key <AD01> { actions=[SetGroup(2)] }; ``` is currently converted to: ``` key <AD01> { }; ``` This commit fixes dropping a defined action when the keysym is undefined
d523fd56 2025-01-11 08:53:22 test: Do not include extra numpad in the base one This allow to load only the minimal key types required by the protocol: `basic+numpad`.
0dc39650 2025-01-02 18:45:15 test: Declare virtual modifiers explicitly This is required in order to use the sections in isolation.
b6acdc30 2025-01-10 20:31:04 xkbcli list: Fix duplicate variants
b9b4ab47 2024-12-09 09:21:01 keysyms: Add sharp S upper case mapping exception The case mapping `ssharp` ß ↔ `U1E9E` ẞ was added in 13b30f4f0dccc08dfea426d73570b913596ed602 but was broken: - For the lower case mapping it returned the keysym `0x10000df`, which is an invalid Unicode keysym. - For the upper case mapping it returned the upper Unicode code point rather than the corresponding keysym. It did accidentally enable the detection of alphabetic key type for the pair (ß, ẞ) though. However this detection was accidentally removed in 5c7c79970a2800b6248e829464676e1f09c5f43d (v1.7) with an attempt to fix the wrong keysym case mapping. Finally both the *lower* case mapping and the key type detection were fixed for good when we implemented the complete Unicode simple case mappings and corresponding tests in e83d08ddbc9851944c662c18e86d4eb0eff23e68. However, the *upper* case mapping `ssharp` → `U1E9E` remained disabled. Indeed, ẞ is a relatively recent addition to Unicode (2008) and had no official recommendation, until recently. So while the lower mapping ẞ→ß exists in Unicode, its converse upper mapping does not. Yet since 2017 the Council for German Orthography (Rat für deutsche Rechtschreibung) recommends[^1] ẞ as the capitalization of ß. Due to its stability policies, the Unicode Character Database (UCD) that we use to generate our keysym case mappings (via ICU) cannot update the simple case mapping of ß. Discussions are currently ongoing in the Unicode mailing list[^2] and CLDR[^3] about how to deal with the new recommended case mapping. However, the discussions are oriented on text-processing and compatibility mappings, while libxkbcommon is on a rather lower level. It seems that the slow adoption of ẞ is partly due to the difficulty to type it. Since ẞ is used only for ALL CAPS casing, the expectation is to type it using CapsLock. While our detection of alphabetic key types works well[^4] for the pair (ß,ẞ), the *internal capitalization* currently does not work and is fixed by this commit. Added the ß → ẞ upper mapping: - Added an exception in the generation script - Fixed tests - Added documentation of the exceptions in `xkbcommon.h` - Added/updated log entries [^1]: https://www.rechtschreibrat.com/regeln-und-woerterverzeichnis/ [^2]: https://corp.unicode.org/pipermail/unicode/2024-November/011162.html [^3]: https://unicode-org.atlassian.net/browse/CLDR-17624 [^4]: Except libxkbcommon 1.7, see the second paragraph.
e0130e30 2024-11-18 20:08:56 state: Add vmod support for xkb_state_mod_mask_remove_consumed
5fbc0ec7 2024-10-14 16:05:52 state: Support querying whether virtual mods are consumed Previously it was not possible to query the status of virtual modifiers with the following functions: - `xkb_state_mod_index_is_consumed` - `xkb_state_mod_index_is_consumed2` Note that it may *overmatch* if some modifier mappings overlap. For example, the default “us” PC layout maps both “Alt” and “Meta” to the real modifier “Mod1”; thus “Mod1”, “Alt” and “Meta” modifiers will return the same result with these functions.
31a841ae 2024-10-14 16:05:35 state: support querying whether virtual modifiers are active Previously it was not possible to query the status of virtual modifiers with the following functions: - `xkb_state_mod_index_is_active` - `xkb_state_mod_indices_are_active` - `xkb_state_mod_name_is_active` - `xkb_state_mod_names_are_active` Note that it may *overmatch* if some modifier mappings overlap. For example, the default “us” PC layout maps both “Alt” and “Meta” to the real modifier “Mod1”; thus “Mod1”, “Alt” and “Meta” modifiers will return the same result with these functions.
2ba9daf1 2024-09-23 16:20:37 mods: Add more built-in names Added support for the following virtual modifiers: - `Alt` - `Meta` - `NumLock` - `Super` - `Hyper` - `LevelThree` - `LevelFive` - `ScrollLock`
086a286a 2024-09-23 16:20:17 mods: Always use constants from xkbcommon-names.h Respect the claim that real modifiers names are built-in: - Add `XKB_MOD_NAME_MOD[1-5]` constants. - Replace modifiers names with their corresponding constants.
15da5ee8 2024-11-14 19:27:22 Improve xkeyboard-config test script - Refactored to write files within the workers, else we have only one worker writing, slowly consuming the result queue. In some scenarios it may even result in out-of-memory as the resulting keymaps piles up. - Added the option `--compress` to allow compressing keymaps files with gunzip. - Use the recently added `--test` option for `xkbcli-compile-keymap` when we only want to test compilation, not the resulting keymap file. This speeds up the test suite of `xkeyboard-config`.
a8afe6fc 2024-10-30 14:01:12 tests: Improve xkeyboard-config script - Refactor to more modern Python - Allow iterating over models too - Add filter for models and options - Add “short output” option - Fix layout variant - Use models subfolders for keymaps - Allow to load multiple registries simultaneously
a47961b1 2024-10-12 16:43:46 registry: Restore default libxml2 error handler after parsing Leaving the custom error handler could have resulted in a crash after the context has been freed. Closes: https://github.com/xkbcommon/libxkbcommon/issues/529
71d64df3 2024-10-08 18:45:18 symbols: Add tests for multiple actions per level
fdf2c525 2024-10-08 19:43:30 actions: Add support for multiple actions per level This makes 1 keysym == 1 action holds also for multiple keysyms per level. The motivation of this new feature are: - Make multiple keysyms per level more intuitive. - Explore how to fix the issue with shortcuts in multi-layout settings (see the xkeyboard-config issue[^1]). The idea is to use e.g.: ```c key <LCTL> { symbols[1] = [ {Control_L, ISO_First_Group } ], actions[1] = [ {SetMods(modifiers=Control), SetGroup(group=-4) } ] }; ``` in order to switch temporarily to a reference layout in order to get the same shortcuts on every layout. When no action is specified, `interpret` statements are used to find an action corresponding for *each* keysym, as expected. For an interpretation matching Any keysym, we may get the same interpretation for multiple keysyms. This may result in unwanted duplicate actions. So set this interpretation only if no previous keysym was matched with this interpret at this level, else set the default interpretation. For now, at most one action of each following categories is allowed per level: - modifier actions: `SetMods`, `LatchMods`, `LockMods`; - group actions: `SetGroup`, `LatchGroup`, `LockGroup`. Some examples: - `SetMods` + `SetGroup`: ok - `SetMods` + `SetMods`: error - `SetMods` + `LockMods`: error - `SetMods` + `LockGroup`: ok [^1]: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/416
31c6d866 2024-10-08 18:39:00 symbols: Min. 2 keysyms in level list Do not allow `{ a }` when a single `a` suffices.
7c4c718b 2024-09-30 06:13:38 Allow only the first group in symbols sections when using RMLVO Currently `xkb_keymap_num_layouts` may return a greater number than the number of layouts configured using RMLVO, because we allow symbols sections to define various groups per key. This is unintuitive and kind of buggy: groups should be added via rules by setting an explicit `:n` modifier. Fix: when parsing a keymap using RMLVO resolution: - Get the expected layouts count from the resulting KcCGST. - Drop the groups after the first one in included symbols sections. This will ensure that a symbol section can only define one group per key. Notes: - Compiling a keymap string directly is unaffected. - RMLVO resolution may still produce more groups than the input layouts. Indeed, some legacy rules in xkeyboard-config rely on this to insert automatically a US layout before the given non-Latin one, resulting in two layouts while only one was given.
948f7a59 2024-10-09 08:34:27 symbols: Skip interprets only for groups with explicit actions Previously setting explicit actions for a group in symbols files made the parser skip compatibility interpretations for the corresponding *whole* key, so the other groups with *no* explicit actions could result broken on some levels. In the following example, `<RALT>` would have an action on group 2, because it is explicit, but none on group 1 because interpretation are also skipped there as a side effect: ```c key <RALT> { symbols[1]= [ ISO_Level3_Shift ], symbols[2]= [ ISO_Level3_Shift ], actions[2]= [ SetMods(modifiers=LevelThree) ] }; ``` Fixed by skipping interpretations *only* for groups with explicit actions. We still set `key->explicit |= EXPLICIT_INTERP` if at least one group has explicit actions. In such case, when dumping a keymap, we will write explicit actions for *all* groups, in order to ensure that X11 and previous versions of libxkbcommon can parse the keymap as intended. One side effect is that no interpretation will be run on this key anymore, so we may have to set some extra fields explicitly: repeat, virtualMods. Thus the previous example would be bumped as: ```c key <RALT> { repeat= No, symbols[1]= [ ISO_Level3_Shift ], actions[1]= [ SetMods(modifiers=LevelThree,clearLocks) ], symbols[2]= [ ISO_Level3_Shift ], actions[2]= [ SetMods(modifiers=LevelThree) ] }; ```
3ed763c3 2024-10-09 07:11:13 test: Add strip_lines and uncomment to text utils These allow us to store comments in files (especially keymaps), that can then be removed (e.g. to compare with output) or uncommented (e.g. to activate an optional line).
929a485f 2024-10-08 12:52:53 symbols: Fix too liberal parsing of keysyms lists Currently we are too liberal when parsing symbols lists: e.g. `[{a,{b}}]` is parsed as `[{a,b}]` but it should be rejected.
4ea9d431 2023-11-16 17:12:03 rules: Add support for :all qualifier Some layout options require to be applied to every group to maintain consistency (e.g. a group switcher). Currently this must be done manually for all layout indexes. This is error prone and prevents the increase of the maximum group count. This commit introduces the `:all` qualifier for KcCGST values. When a rule with this qualifier is matched, it will expands the qualified value (and its optional merge mode) for every layout, e.g. `+group(toggle):all` (respectively `|group(toggle)`) would expand to `+group(toggle):1+group(toggle):2` (respectively `|group(toggle):1|group(toggle):2`) if there are 2 layouts, etc. If there is no merge mode, it defaults to *override* `+`, e.g. `x:all` expands to `x:1+x:2+x:3` for 3 layouts. Note that only the qualified *value* is expanded, e.g. `x+y:all` expands to `x+y:1+y:2` for 2 layouts. `:all` can be used in combination with special layout indexes. Since this can lead to an unexpected behaviour, a warning will be raised.
cdafba4f 2024-09-24 15:23:16 rules: Add support for index ranges There is a lot of repetition in the current rules files provided by xkeyboard-config, because the MLVO mappings need to match on the exact layout/variant index. This also prevents to increase the number of maximum groups, because it does not scale. We introduces the following new special layout/variant indexes: - “single”: matches a single layout; same as with no index. - “first”: matches the first layout/variant, no matter how many layouts are in the RMLVO configuration. It allows to merge `layout` and `layout[1]` patterns. - “later”: matches all but the first layout. This is an index range. - “any”: matches layout at any position. This is an index range. We also introduces the new `%i` expansion, which correspond to the index of the matched layout in a mapping with an index range. Example: layout[later] = symbols my_layout = +my_symbols:%i * = +%l[%i]:%i Let’s have a look at concrete examples from xkeyboard-config: ! model layout = symbols * * = pc+%l%(v) ! model layout[1] = symbols * * = pc+%l[1]%(v[1]) ! model layout[2] = symbols * * = +%l[2]%(v[2]) ! model layout[3] = symbols * * = +%l[3]%(v[3]) ! model layout[4] = symbols * * = +%l[4]%(v[4]) ! layout option = symbols * grp:toggle = +group(toggle) ! layout[1] option = symbols * grp:toggle = +group(toggle):1 ! layout[2] option = symbols * grp:toggle = +group(toggle):2 ! layout[3] option = symbols * grp:toggle = +group(toggle):3 ! layout[4] option = symbols * grp:toggle = +group(toggle):4 With this commit we can now simplify it into: ! model layout[first] = symbols * * = pc+%l[%i]%(v[%i]) ! model layout[later] = symbols * * = +%l[%i]%(v[%i]):%i ! layout[any] option = symbols * grp:toggle = +group(toggle):%i The latter rule will work even if we increase XKB_MAX_GROUPS, whereas the former would require to add the missing entries for the new groups. In order to maintain consistent rules, we now disallow layout and variant to have different indexes. For example, the following mapping are now invalid: - layout variant[1] - layout[1] variant[2] - layout[1] variant - layout[first] variant[1] - layout[first] variant - layout variant[any] - etc.
7697c712 2024-09-16 16:09:11 rules: Resolve relative include statements using XKB paths Contrary to keymap files, the `! include` statement in rules does not lookup include paths added to `xkb_context`. So it is not possible e.g. to import another file in the same folder without using an absolute path. - Added path utils: `is_absolute(path)`. - Added XKB paths lookup to enable e.g. `! include evdev` to work. - Added test.
98dee225 2024-09-12 16:52:40 Add UTF-8 to UTF-32 decoding Add internal functions to convert UTF-32 to UTF-8, with corresponding tests.
378badab 2024-09-19 17:30:55 Add function xkb_keysym_is_deprecated This function allow to check whether a keysym is deprecated, based on the keysym and optionally its name. The generation of the table of deprecated keysyms relies on the rules described in `xkbcommon-keysyms.h`. The `ks_table.h` is now generated deterministically by setting explicitly the random seed to a constant. This will avoid noisy diffs in the future.
e4269202 2024-09-20 10:41:00 keysyms: Fix off-by-one XKB_KEYSYM_NAME_MAX_SIZE The constant did not account for the terminating `NULL` byte and this was sadly not caught by the tests. Fixed the invalid value, the corresponding script and the tests.
05ba96db 2024-08-20 16:41:38 rules: Fix wild card handling The handling of wild card `*` is different in libxkbfile and X server: wild card matches empty strings for model and option but not for layout nor variant, while in libxkbcommon wild cards always match empty strings. See: - https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/blob/bf985c68acb1244f51ec91414532a2347fbc1c4c/src/maprules.c#L687 - https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/blob/bf985c68acb1244f51ec91414532a2347fbc1c4c/src/maprules.c#L712 The difference of handling between the components is unfortunately not documented, but we should follow the behavior of the original implementations for consistency. - Fixed by implementing the same behavior than libxkbfile. - Added tests and fixed failing tests. - Improve the documentation of rules to highlight the special behavior.
4100bdd2 2024-09-01 10:57:40 compose: Add roundtrip test parse/dump
d4deb755 2024-09-01 09:07:00 compose: Add quickcheck test for traversal Test against the `foreach` reference implementation: - Suffle compose file lines randomly; - Compare traversal entry by entry. The `foreach` Compose traversal implementation is based on Ran’s work: https://github.com/bluetech/libxkbcommon/commit/f7f3c3c385fdc9ae91135f95e4b10f072603b812
652b03cc 2024-09-01 08:32:21 compose: Add Compose table dump internal API - Move `print_compose_table_entry` to own file and add a `file` argument to select output. - Add `xkb_compose_table_dump` to dump a Compose table. This change is needed in order to share the feature “dump a Compose table” between tests and tools.
e9bd7de4 2024-07-04 16:22:13 state: Add support for group latch action Surprisingly, the latch group action was not yet implemented. Added tests to ensure we get the tricky bits right.
573583e3 2024-07-16 10:52:49 test/registry: fix array overrun test/registry.c:532:9: overrun-local: Overrunning array "tl->iso639" of 3 8-byte elements at element index 23 (byte offset 191) using index "i" (which evaluates to 23).
4b69cd9c 2024-07-16 10:48:32 test/keysym: remove dead assignment ../../../test/keysym.c:394:5: warning: Value stored to 'iter' is never read [deadcode.DeadStores] 394 | iter = xkb_keysym_iterator_unref(iter);
c15ca444 2024-07-16 10:44:55 test/compose: reset the utf8 buffer to a "random" sequence This ensures that our string termination is handled by utf32_to_utf8() as opposed to false positives due to previously set null terminators. Fixes: ../../../test/compose.c:912:34: warning: The left operand of '==' is a garbage value [core.UndefinedBinaryOperatorResult] 912 | assert_printf(buf[c] == '\0', "NULL-terminated string\n");
f129b21b 2024-07-16 10:26:19 test/compose: only setenv if our top_srcdir is not NULL ../../../test/compose.c:968:5: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
d85fc24d 2024-07-16 10:22:23 test: initialize two return values ../../../test/xvfb-wrapper.c:166:5: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] 166 | return rc; ../../../tools/interactive-wayland.c:820:14: warning: The left operand of '>=' is a garbage value [core.UndefinedBinaryOperatorResult] 820 | exit(ret >= 0 ? EXIT_SUCCESS : EXIT_FAILURE);
89d318da 2024-07-16 10:17:02 test: explicitly cast time() to int for the seed (hopefully) silences an analyzer warning: test/compose.c:955:16: store_truncates_time_t: A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "time(NULL)" is cast to "int".
e83d08dd 2024-02-23 17:10:15 keysyms: Fast and complete case mappings (Unicode 15.1) The current code to handle keysym case mappings is quite complex and slow. It is also incomplete, as it does not cover recent Unicode database. Finally, it does not handle title case correctly. It would be easier if we were to use only a lookup table, but a trivial implementation would lead to a huge array: the cased characters range from `U+0041` to `U+`1F189, i.e. a span of 127 304 elements. Thus we need some tricks to compress the lookup table. We based our work on the post: https://github.com/apankrat/notes/blob/3c551cb028595fd34046c5761fd12d1692576003/fast-case-conversion/README.md The compression algorithm is roughly: 1. Compute the delta between the characters and their mappings. 2. Split the delta array in chunk of a given size. 3. Rearrange the order of the chunks in order to optimize consecutive chunks overlap. 4. Create a data table with the reordered chunks and an index table that maps the original chunk index to its offset in the data table. The compression algorithm is then applied a second time to the previous index table. The complete algorithm optimizes the two chunk sizes in order to get the lowest total data size. The mappings were generated using CPython 3.12.4, PyICU 2.13, PyYaml 6.0.1 and ICU 75.1. Also: - Added explicit list of named keysyms and their case mappings. - Added benchmark for case mappings. - Rework ICU tests. Note: 13b30f4f0dccc08dfea426d73570b913596ed602 introduced a fix for sharp S `U+00DF`. With the new implementation, the *conversion* functions `xkb_keysym_to_{lower,upper}` leave it *unchanged*, while the *predicate* functions `xkb_keysym_is_{lower,upper_or_title}` produce the expected results: ```c xkb_keysym_to_upper(XKB_KEY_ssharp) == XKB_KEY_ssharp; xkb_keysym_to_lower(XKB_KEY_ssharp) == XKB_KEY_ssharp; xkb_keysym_to_lower(XKB_KEY_Ssharp) == XKB_KEY_ssharp; xkb_keysym_is_lower (XKB_KEY_ssharp) == true; xkb_keysym_is_upper_or_title(XKB_KEY_Ssharp) == true; ```
addf73c5 2024-07-12 09:17:34 keysyms: Require only 5 bytes for UTF-8 encoding Require only 5 bytes for the buffer of `xkb_keysym_to_utf8`, as UTF-8 encodes code points on up to 4 bytes + 1 byte for the NULL-terminating byte. Previous standard [RFC 2279] (1998) required up to 6 bytes per code point, but has been superseded by [RFC 3629] (2003). [RFC 2279]: https://datatracker.ietf.org/doc/html/rfc2279 [RFC 3629]: https://datatracker.ietf.org/doc/html/rfc3629
b5d3fa9e 2024-07-12 10:36:33 ci: Add ruff-format check - Add CI step - Fix errors
11f7ef2e 2024-03-25 15:01:19 test(x11): Warn for missing Xvfb program Xvfb is required for *running* X11 tests. We do not make it mandatory in the meson setup though, because we did not find a way to require a *run* time dependency.
4975598c 2024-03-14 09:09:15 test(X11): Fix macOS build Xvfb wrapper: adapt ELF custom section to macOS.
0ed9390c 2024-03-14 09: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.
53d9881e 2024-03-05 10:28:11 keysyms: Fix inconsistent case-insensitive name lookup `xkb_keysym_from_name` has inconsistent behavior when used with the flag `XKB_KEYSYM_CASE_INSENSITIVE`: ```c xkb_keysym_from_name("a", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_a; xkb_keysym_from_name("A", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_a; xkb_keysym_from_name("dead_a", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_dead_A; xkb_keysym_from_name("dead_A", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_dead_A; xkb_keysym_from_name("dead_o", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_dead_o; xkb_keysym_from_name("dead_O", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_dead_o; xkb_keysym_from_name("KANA_tsu", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_kana_tsu; xkb_keysym_from_name("KANA_TSU", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_kana_tsu; xkb_keysym_from_name("KANA_ya", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_kana_YA; xkb_keysym_from_name("KANA_YA", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_kana_YA; xkb_keysym_from_name("XF86Screensaver", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_XF86ScreenSaver; xkb_keysym_from_name("XF86ScreenSaver", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_XF86ScreenSaver; ``` So currently, if two keysym names differ only by case, then the lower-case *keysym* is returned, not the keysym corresponding to the lower-case keysym *name*. Indeed, `xkb_keysym_from_name` uses `xkb_keysym_is_lower` to test if a keysym is a lower-case keysym. Let’s look at the example for keysyms `a` and `A`: we get the keysym `a` not because its name is lower case, but because `xkb_keysym_is_lower(XKB_KEY_a)` returns true and `xkb_keysym_is_lower(XKB_KEY_A)` returns false. So the results are correct according to the doc: - Katakana is not a bicameral script, so e.g. `kana_ya` is *not* the lower case of `kana_YA`. - As for the `dead_*` keysyms, they are not cased either because they do not correspond to characters. - `XF86ScreenSaver` and `XF86Screensaver` are two different keysyms. But this is also very counter-intuitive: `xkb_keysym_is_lower` is not the right function to use in this case, because one would expect to check only the name, not the corresponding character case: ```c xkb_keysym_from_name("KANA_YA", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_kana_ya; xkb_keysym_from_name("XF86ScreenSaver", XKB_KEYSYM_CASE_INSENSITIVE) == XKB_KEY_XF86Screensaver; ``` Fixed by making the order of the keysyms names consistent in `src/ks_tables.h`: 1. Sort by the casefolded name: e.g. `kana_ya` < `kana_YO`. 2. If same casefolded name, then sort by cased name, i.e for ASCII: upper before lower: e.g `kana_YA` < `kana_ya`. Thus we now have e.g. `kana_YA` < `kana_ya` < `kana_YO` < `kana_yo`. The lookup logic has also been simplified. Added exhaustive test for ambiguous case-insensitive names.
ba76ec16 2024-03-01 15:02:42 Global default statement: Fix types Do not accept statements like garbage.level_name in types files Fix parser accepting clearly nonsensical type definitions like type "ONE_LEVEL" { garbage.modifiers = None; garbage.map[None] = Level1; garbage.level_name[Level1] = "Any"; }; and ignoring the garbage part. Co-authored-by: Mikhail Gusarov <dottedmag@dottedmag.net> Co-authored-by: Pierre Le Marre <dev@wismill.eu>
24f69645 2024-03-01 15:02:42 Global default statement: Fix symbols
e325e65e 2024-02-20 08:13:37 Add test_unit to all tests Currently it only ensure we do not buffer `stdout`.
e7570bcb 2024-02-19 15:07:52 test: disable stdout output buffering for our tests Hook this into test_create_context() so all the test immediately use it.
5270a553 2024-02-14 11:41:12 test: print the keyboard state as part of test_key_seq_va Makes it easier to debug modifier bugs.
be1c2f27 2024-02-14 11:15:35 test: improve debugging output for test_key_seq Print the op too to make it easier to find which part in a long test_key_seq triggered an assertion and add some whitespace for nicer debugging output.
51e08472 2024-02-14 11:29:19 Fix a typo
d21645be 2024-02-18 13:57:15 xkbcomp: Require newline after !include line in rules files Rules file parser allows constructs like !include "foo" !include "bar" !layout = symbols This is most likely an oversight in original code. Closes #452
1731c6b3 2024-02-05 11:55:39 compose: Ensure we mmap only regular files Currently we do not check that the Compose files we try successively are *regular* files. This may result in an error, while we should just really just skip the corresponding path. Fixed by adding the new utily function `open_file`.
382f6d2d 2024-02-05 08:57:35 Keysyms: Update using latest xorgproto For the sake of compatibility, this reintroduce some deleted keysyms and postpone the effective deprecation of others. xorgproto commit: fe12c5102762afcbf852e50dcbbdea2ef625570c Also added tests for some canonical names.
efdb05d1 2024-01-27 23:00:28 parser: Do now allow the empty symbol declaration An empty element is allowed in SymbolsBody definition, so the following keymap is gramatically correct. ``` xkb_keymap { ... xkb_symbols "sym" { key <SPC> {, [Space] }; }; }; ``` However, the current parser crashes with the keymap due to null pointer access. This change fixes it by changing the parser not to allow it.
43c9752d 2024-01-16 11:04:59 compose: Fix iterator for empty tables The current `xkb_compose_table_iterator_next` segfaults when used with an empty table. Indeed, in this case we initialize cursors in `xkb_compose_table_iterator_new` with the dummy node and the direction `NODE_LEFT`, but the dummy node is a leaf! Fixed by initializing with no cursors when the table is has no non-dummy nodes.
8cca3a7b 2023-12-05 17:39:59 compose: Add XKB_COMPOSE_MAX_STRING_SIZE Define the maximum size of a compose sequence result string explicit as a constant and use it everywhere to improve the code readability.
c88fe4b6 2023-12-07 12:21:53 keysyms: Add tests with ICU Added tests of the simple case mappings when the ICU library is available. A warning is raised for missing mappings. Note: `xkb_keysym_is_upper` is interpreted as matching the disjunction of the Unicode character properties “Uppercase” or “Titlecase”.
82305adb 2023-12-05 18:23:02 keysyms: Test keypad
b5a14083 2023-12-05 17:51:46 keysyms: Fix xkb_keysym_is_modifier Currently `xkb_keysym_is_modifier` does not detect the following keysyms: - `XKB_KEY_ISO_Level5_Shift` - `XKB_KEY_ISO_Level5_Latch` - `XKB_KEY_ISO_Level5_Lock` Indeed, there is a mistake in the keysym interval that the code checks. The reason seems a confusing order of the keysyms in `xkbcommon-keysyms.h`: the current code has a comment “libX11 only goes up to XKB_KEY_ISO_Level5_Lock”, but in fact the modifiers keysyms are listed in a _semantic_ order in `xkbcommon-keysyms.h`, not in the increasing keysym _value_ order. Fixed by using the same (correct) code as libX11 and added some tests.
0074baf4 2023-12-19 07:28:52 keysyms: Add XKB_KEYSYM_NAME_MAX_SIZE for internal use Currently there is no indication of the maximum length of keysym names. This is statically known, so add the new *internal* following API: `XKB_KEYSYM_NAME_MAX_SIZE`.
f77c97bd 2023-12-14 08:19:31 keysyms: Test xkb_keysym_to_utf8 length
817179d8 2023-12-14 08:19:28 keysyms: Add xkb_keysym_iterator Add an efficient way to iterate over the assigned keysyms. Currently only provided for testing, so we guard it by `ENABLE_PRIVATE_APIS` in order to reduce the installed library.
4f52d606 2023-12-14 09:16:55 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.
82f138c6 2023-12-14 09:13:35 keysyms: Add min and max assigned keysyms internal API Currently there is no direct way to know the minimum and maximum keysym values that are assigned, i.e. that have an explicit name or are Unicode keysyms. Introduce the new following internal API: - XKB_KEYSYM_MIN_ASSIGNED - XKB_KEYSYM_MAX_ASSIGNED - XKB_KEYSYM_MIN_EXPLICIT - XKB_KEYSYM_MAX_EXPLICIT - XKB_KEYSYM_COUNT_EXPLICIT Also add a bunch of tests to ensure consistant keysyms bounds.
4a92f61b 2023-12-14 08:19:16 keysyms: Add Unicode constants Add the following constants in order to improve the code readability: - XKB_KEYSYM_UNICODE_OFFSET - XKB_KEYSYM_UNICODE_MIN - XKB_KEYSYM_UNICODE_MAX
31ebe003 2023-12-19 09:15:14 test: add a test for multiple keysyms (and some minimal docs) I couldn't find any reference to *how* the keymap format actually needs to look like if you want multiple keysyms per level. So let's add a test for it and a minimal documentation entry.
0db1dc1c 2023-11-26 10:51:18 fix error with "-Wl,--gc-sections"
7caf57f0 2023-11-16 09:29:31 registry: Parse “popularity” attribute Previously the attribute “popularity” was completely ignored. It also did not respect the modified DTD, because its default value depends if we are currently parsing an “extras” rules file. Fixed: - Always parse the popularity attribute. - Change the DTD to reflect that the default value is implied.
0a577a09 2023-11-07 12: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.
bc330c00 2023-11-07 12:58:20 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.
00e3058e 2023-11-06 21:53:51 Prevent recursive includes of keymap components - 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.
3aaa4e2a 2023-10-30 15:51:34 rules: early detection of invalid encoding
82e9293e 2023-10-30 15:28:10 xkbcomp: early detection of invalid encoding
a2da57ab 2023-10-30 14:50:00 Compose: early detection of invalid encoding Also move “unrecognized token” error message before skiping the line, in order to fix token position.
9e887180 2023-10-29 07:44:39 rules: skip heading UTF-8 encoded BOM (U+FEFF) Leading BOM is legal and is used as a signature — an indication that an otherwise unmarked text file is in UTF-8. See: https://www.unicode.org/faq/utf_bom.html#bom5 for further details.
f937c308 2023-10-29 07:31:34 xkbcomp: skip heading UTF-8 encoded BOM (U+FEFF) Leading BOM is legal and is used as a signature — an indication that an otherwise unmarked text file is in UTF-8. See: https://www.unicode.org/faq/utf_bom.html#bom5 for further details.
59886e41 2023-10-29 07:20:29 Compose: skip heading UTF-8 encoded BOM (U+FEFF) Leading BOM is legal and is used as a signature — an indication that an otherwise unmarked text file is in UTF-8. See: https://www.unicode.org/faq/utf_bom.html#bom5 for further details.