Branch :
| Author | Commit | Date | CI | Message |
|---|---|---|---|---|
| 135b3204 | 2025-08-16 12:59:20 | compose: Add fallback for custom locales Before this commit, loading a Compose file based on the locale would fail if the locale is not in the X11 Compose locale registry. While there are workarounds (e.g. `~/.XCompose` file or `$XCOMPOSEFILE`), it does not work if the corresponding file has `include "%L"`. This commit adds the fallback `en_US.UTF-8` in case the locale is installed but not registered in the X11 Compose locale registry. The choice is motivated by the fact that most locales use `en_US.UTF-8` anyway. Ideally we should have a mechanism to extend the Compose locale registry at the *system* level. Mechanisms at the user level (e.g. custom Compose file, environment variable) are deemed sufficient. We could still improve it by first trying to fallback to the locale without the country bits, but there is no function to do such function in the stdlib and we do not want to mess with locales manually. Unfortunately is not possible to test it in our test suite. One can still check it works following these instructions: 1. Create a custom locale, e.g. `en_XX.UTF-8`. `glibc-i18ndata` or similar package may be required to get the required files in `/usr/share/i18n/`. `sudo localedef -i en_US -f UTF-8 en_XX.UTF-8` 2. `xkbcli compile-compose --verbose --locale en_XX.UTF-8` | ||
| b5d969dd | 2025-08-06 17:22:38 | compose: Move constants to dedicated header | ||
| dc63e5f8 | 2025-07-07 12: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. | ||
| 7a2aa9c9 | 2024-12-20 22:53:11 | Always retain later Compose sequence in case of conflict This ensures that it is always possible to override previous definitions, for example when `include`ing the system Compose file. Signed-off-by: Jules Bertholet <julesbertholet@quoi.xyz> | ||
| 3a8bb1a1 | 2025-05-16 13:13:55 | compose: Fix sequence not fully overriden Previously if a new sequence did not produce a keysym or a string, the corresponding property was not overriden, possibly leaking the previous entry. - Fixed by always writting all the properties. - Also try to reuse the previous string entry, if possible, so that we avoid allocating. | ||
| 61d8ec67 | 2025-05-12 18:20:47 | misc: Fix string format specifiers Ensure better portability. | ||
| 3031f6c3 | 2025-05-12 10:38:15 | misc: Always use `unsigned` with `int` Better semantics & facilitate search. | ||
| 4d605b70 | 2025-04-29 11:18:36 | tests: Ensure random generator use an explicit seed This enable debugging with the exact same seed. | ||
| e120807b | 2025-01-29 15:35:22 | Update license notices to SDPX short identifiers + update LICENSE Fix #628. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 307ce5a7 | 2025-01-29 00:25:23 | test/compose: reduce quickcheck iterations They're a *bit* too slow for interactive test runs when running in debug+sanitizers. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 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). | ||
| 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. | ||
| 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] | ||
| 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". | ||
| e325e65e | 2024-02-20 08:13:37 | Add test_unit to all tests Currently it only ensure we do not buffer `stdout`. | ||
| 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`. | ||
| 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. | ||
| 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`. | ||
| 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. | ||
| 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. | ||
| 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. | ||
| 0038c866 | 2023-09-26 17:05:14 | Prevent overflow of octal escape sequences The octal parser accepts the range `\1..\777`. The result is cast to `char` which will silently overflow. This commit prevents overlow and will treat `\400..\777` as invalid escape sequences. | ||
| ca7aa69c | 2023-09-26 17:05:05 | Disallow producing NULL character with escape sequences 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. | ||
| a1770132 | 2023-09-25 11:41:48 | 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> | ||
| fc25e0f0 | 2023-06-26 12:19:49 | 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. | ||
| b064b609 | 2022-05-14 01:11:32 | Do not clear sibling entries when override. lokid and hikid actually stores the sibling to current node, which should not be cleared when override. This would break the sequence with a common prefix when override another. Fix #286 Signed-off-by: Weng Xuetian <wengxt@gmail.com> | ||
| 98f07da8 | 2021-05-22 20:07:06 | test/compose: add tests for xkb_compose_table_new_from_locale lookup Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 5b1b2f75 | 2021-05-22 20:00:24 | test/compose: clean up after a setenv Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| e2465c2a | 2021-05-22 19:55:04 | tests/data: add files needed to fully test compose Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 41a7c975 | 2020-07-10 14:57:57 | Add asprintf_safe helper function We only ever care about whether we error out or not, so let's wrap this into something more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| da4a90c1 | 2019-12-28 13:49:40 | Open files in binary mode This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 40aab05e | 2019-12-27 13:03:20 | build: include config.h manually Previously we included it with an `-include` compiler directive. But that's not portable. And it's better to be explicit anyway. Every .c file should have `include "config.h"` first thing. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 8e1fed6c | 2015-03-24 16:40:29 | compose: correctly parse modifier syntax As described in: http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=ddf3b09bb262d01b56fbaade421ac85b0e60a69f Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| c42b8646 | 2014-10-14 11:47:25 | test/compose: test include statement Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 3f489730 | 2014-10-14 10:53:38 | test/compose: test modifier syntax Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 10a7a2bd | 2013-10-27 20:37:27 | test/compose: add new test Some results from the benchmark (compilation of en_US.UTF-8/Compose): $ grep 'model name' /proc/cpuinfo model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz $ uname -a Linux ran 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux $ ./test/compose bench compiled 1000 compose tables in 7.776488331s So according to the above benchmark and valgrind --tool=massif, an xkb_compose_table adds an overhead of about ~8ms time and ~130KB resident memory. For contrast, a plain US keymap adds an overhead of ~3ms time and 90KB resident memory. Signed-off-by: Ran Benita <ran234@gmail.com> |