|
636b8b97
|
2025-03-19T14:11:52
|
|
test: Add merge mode tests for all the sections
The merge modes tests C file is now only generated locally, because it
is too large. The generator Python script requires Jinja2, so the test
is optional and depends on Jinja22 availability.
The test aim to be exhaustive with various combinations of a base and
an update:
- plain base + plain update, for every mode
- plain base + include (for every mode) update (every mode)
- single include (base +| update)
|
|
216352db
|
2025-04-10T14:58:25
|
|
test: Improve xkeyboard-config script
- Enable setting the XKB root directory. By far the most important
change.
- Enable to pass registry XML files relative to the target rules
directory (with or without the `.XML` extension).
- Enable to set the rules set to use.
- Better JSON/YAML escaping.
- Better error logging.
|
|
a1e595e7
|
2025-04-11T11:13:25
|
|
rules: Fix merging KcCGST values in layout order
When using layout index ranges (e.g. special indexes “any” or “later”),
the rules still match following the order in the rules file, so layout
indexes may match without following their natural order. So the resulting
KcCGST value should not be merged with the output until reaching the end
of the rule set.
Because the rule set may also involve options, it may match multiple
times for the *same* layout index. So these multiple matches should not
be merged together either, until reaching the end of the rule set.
When reaching the end of the rule set, for each KcCGST component the
pending values are then merged: for each layout, for each KcCGST value
in the corresponding sequence, merge with the output.
---
Example:
! model = symbols
* = pc
! layout[any] option = symbols
C 1 = +c1:%i
C 2 = +c2:%i
B 3 = skip
B 4 = +b:%i
The result of RMLVO
{layout: "A,B,C", options: "4,3,2,1"}
is:
symbols = pc+b:2+c1:3+c2:3
- `skip` was dropped because it has no explicit merge mode;
- although every rule was matched in order, the resulting order of the
symbols follows the order of the layouts, so `+b` appears before `+c1`
and `+c2`.
- the relative order of the options for layout C follows the order
within the rule set, not the order of RMLVO.
Before this commit, the result would have been:
symbols = pc+c1:3+c2:3+b:2
|
|
66f71890
|
2025-03-31T08:01:29
|
|
symbols: Enable writing keysyms list as UTF-8 strings
Each Unicode code point of the string will be translated to their
respective keysym, if possible. An empty string denotes `NoSymbol`.
When such conversion is not possible, this will raise a syntax error.
This introduces the following syntax:
```c
// Empty string = `NoSymbol`
key <1> {[""]}; // NoSymbol
// Single code point = single keysym
key <2> {["é"]}; // eacute
// String = translate each code point to their respective keysym
key <3> {["sßξك🎺"]}; // {s, ssharp, Greek_xi, Arabic_kaf, U1F3BA}
// Mix string and keysyms
key <4> {[{"ξ", Greek_kappa, "β"}]}; // { Greek_xi, Greek_kappa, Greek_beta}
```
It can also be used wherever a keysym is required, e.g. in `interpret`
and `modifier_map` statements. In these cases a single keysym is expected,
so the string should contain *exactly one* Unicode code point.
|
|
ead3ce77
|
2025-03-28T21:44:27
|
|
scanner: Enable LRM and RLM marks for BiDi text
Enable displaying bidirectional text in XKB files using:
- U+200E LEFT-TO-RIGHT MARK
- U+200F RIGHT-TO-LEFT MARK
We now parse these marks as white space. As such, they are dropped;
note that a later serialization may not display correctly without
the marks, although it will parse.
References:
- https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
- https://www.w3.org/International/questions/qa-bidi-unicode-controls
- https://www.unicode.org/reports/tr31/#Whitespace
- https://www.unicode.org/reports/tr55/
|
|
bc3e464b
|
2025-04-09T12:35:05
|
|
keysyms: Fix Unicode handling
- `xkb_utf32_to_keysym`: Allow [Unicode noncharacters]. There is no
requirement to drop them and this would be the only function of our
API doing so.
From the Unicode Standard 16.0, section 23.7 “Noncharacters”:
> Applications are free to use any of these noncharacter code points
> internally. They have no standard interpretation when exchanged
> outside the context of internal use. However, they are not illegal
> in interchange, nor does their presence cause Unicode text to be
> ill-formed.
> If a noncharacter is received in open interchange, an application is
> not required to interpret it in any way. It is good practice,
> however, to recognize it as a noncharacter and to take appropriate
> action, such as replacing it with `U+FFFD` REPLACEMENT CHARACTER,
> to indicate the problem in the text.
The key part is:
> an application is not required to interpret it in any way
Since we handle the reverse conversion with `xkb_keysym_to_utf32` just
fine, I do not see a good motivation to keep this asymmetry. This is
the only function with a special case for these code points.
- `xkb_keysym_from_name`:
- Unicode format `UNNNN`: allow control characters C0 and C1 and use
`xkb_utf32_to_keysym` for the conversion when `NNNN < 0x100`, for
backward compatibility.
- Numeric hexadecimal format `0xNNNN`: *unchanged*. Contrary to the
Unicode format, it does not normalize any keysym values in order to
enable roundtrip with `xkb_keysym_get_name`.
Also added tests to ensure various properties and consistency.
Note about *surrogates*: they are valid valid *code points* but invalid
Unicode *scalar values*, i.e. they cannot be encoded in any Unicode
encoding form (UTF-8, UTF-16, UTF-32). So their corresponding Unicode
keysyms are valid, but:
- cannot be used as input of `xkb_keysym_to_utf32` nor `xkb_keysym_to_utf8`
- cannot result as output of `xkb_utf32_to_keysym`.
Otherwise they are valid e.g. in the Unicode keysym notation.
[Unicode noncharacters]: https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Noncharacters
|
|
08d9a031
|
2025-04-08T06:31:33
|
|
Unicode: Make surrogate handling more explicit
|
|
5e557040
|
2025-04-09T11:17:00
|
|
xkbcomp: Fix Unicode escape sequence
While the previous code correctly rejected malformed sequences such as
`\u{` (incomplete) or `\u{123x}`, it should try to consume as much input
as possible until reaching the corresponding closing `}` within the
string. Else we can get leftovers and the error message does not
reference the whole malformed sequence.
Also added further tests with surrogates and noncharacters.
|
|
47c2c820
|
2025-04-08T18:09:41
|
|
Add internal API to get all explicit names of a keysym
|
|
ca798d21
|
2025-04-08T16:21:46
|
|
keysyms: Pad Unicode keysyms only up to 4 digits
Previously there was a distinction between keysyms with code points in
BMP and the others: the former used a 4-padding while the latter used
a 8-padding: e.g `U0001` vs `U00010000`. This is unnecessary and makes
the reading harder.
Let’s use the same padding for all: `U0001` and `U10000`.
Parsing remains unchanged and would parse both paddings.
Also added a test to check no explicit name can clash with Unicode
notation.
|
|
102f4ba1
|
2025-04-06T19:38:53
|
|
Fix integer conversion warnings
|
|
3370ead3
|
2025-04-06T06:39:31
|
|
test: Better handling of missing xkbcomp for X11 tests
- meson: Warn if missing xkbcomp for X11 tests;
- test: Better logging to spot missing Xorg executables.
|
|
36442baa
|
2025-04-03T15:01:46
|
|
xkbcomp: Support multiple actions in interpret
Before this commit we supported multiple actions per level, but not in
*interpret* statements. Let’s fix this asymmetry, so we can equivalently
assign all actions sets either implicitly or explicitly.
|
|
f348c6e9
|
2025-04-05T12:48:50
|
|
logging: Quote invalid escape sequence
|
|
6d4cc135
|
2025-04-05T13:39:30
|
|
xkbcomp: Escape ASCII control characters
|
|
3d79f459
|
2025-03-29T11:46:34
|
|
xkbcomp: Add Unicode code point escape sequence \u{NNNN}
Unicode code point escape sequences `\u{NNNN}` are replaced with the
UTF-8 encoding of their corresponding code point `U+NNNN`, if legal.
Supported Unicode code points are in the range `1‥0x10ffff`.
Note that we will reject the `U+0000` NULL code point, as we reject it
in the octal escape sequence `\0`.
This is intended mainly for the upcoming feature to write keysyms as
UTF-8 encoded strings. It can be used for various reasons:
- avoid encoding issues;
- avoid issue with font rendering (e.g. Asian scripts);
- make white space or zero-width characters more readable.
|
|
7d91a753
|
2025-03-29T12:24:39
|
|
xkbcomp: Enable xkbcomp-style octal escape sequences
Xorg xkbcomp only parses octal sequences with `\0`, while xkbcommon
does not force the `0` prefix of the numeric part. However, we only
parsed up to to 3 digits, which does not allow to parse e.g. `\0377`
while `\377` parses fine.
Fixed by parsing up to 4 octal digits, while checking the result fits
into a byte.
|
|
aa8b572e
|
2025-03-29T12:04:26
|
|
keymap serialization: Ensure escaping relevant chars
Previously we would write characters without any escaping in some
cases (e.g.: names of indicators, types and groups). E.g. the string
"new\nline"
would be serialized as:
"new
line"
which would raise a syntax error if parsed.
Fixed by escaping any string that was not escaped after parsing (e.g.
the section names are safe already).
|
|
d2f7b9cd
|
2025-04-04T17:29:35
|
|
rules: Do not use strto* parsers
|
|
d5a91fa9
|
2025-04-04T16:38:16
|
|
xkbcomp: Use custom parsers instead of strtol*
The use of `strtol*` functions was already restricted due to its
slowness and its capacity to parse other stuff than digits (e.g.
signs and spaces).
There is also another *big* limitation: it requires a NULL-terminated
string. This is incompatible with our functions that work on buffers,
because we cannot guarantee this. This may lead to a memory violation
if the last token is a number.
We now roll out our own parsers, which are more efficients and
compatible with buffers.
|
|
44480f7c
|
2025-04-01T08:28:02
|
|
xkbcomp: Enable lists of keysyms and actions {} and {a}
Motivations:
- Follow the principle of least astonishment;
- Ensure consistency;
- Enhance the use of custom defaults;
- Facilitate the tests.
There is some ambiguity because we use `{}` to denote both an empty list of
keysyms and an empty list of actions. But as soon as we get a keysym or an
action, we know whether it is a `MultiKeySymList` or a `MultiActionList`.
So we just count the `{}` at the *beginning* using `NoSymbolOrActionList`,
then replace it by the relevant count of `NoSymbol` or `NoAction()` once the
ambiguity is solved. If not, this is a list of empties of *some* type: we
drop those empties and delegate the type resolution using `ExprEmptyList()`.
|
|
e09cbe66
|
2025-04-02T10:46:06
|
|
symbols: Fix handling of empty keys
Before this commit, the following symbols:
```c
xkb_symbols {
virtual_modifiers M1, M2;
key <A> {};
key <B> { [] };
key.vmods = M1;
key <C> {};
key <D> { vmods = M2 };
};
```
would be equivalent to:
```c
xkb_symbols {
virtual_modifiers M1,M2;
key <B> { [ NoSymbol ] };
};
```
`<B>` entry could be skipped but is harmless. However, `<C>` and `<D>`
are missing, which would lead to the mapping resolution of `M1` and
`M2` failing.
After this commit, it is equivalent to:
```c
virtual_modifiers M1,M2;
key <C> { vmods = M1 };
key <D> { vmods = M2 };
```
Empty keys are skipped entirely, but any explicit field:
- is taken into account: previously they would be skipped if there
were no group;
- forces the key to be printed at serialization.
|
|
2e0245f8
|
2025-04-02T10:45:44
|
|
xkbcomp: Enable more empty lists
- Empty `interpret`
- Empty key `type`
- Empty `indicator`
Motivations:
- Follow the principle of least astonishment;
- Ensure consistency;
- Enhance the use of custom defaults;
- Facilitate the tests.
|
|
6881fb32
|
2025-04-01T08:28:02
|
|
xkbcomp: Drop trailing NoSymbol and NoAction()
This brings us closer to what `xkbcomp` outputs. One should use
the explicit `VoidSymbol` instead of `NoSymbol`, in order to avoid
dropping empty levels.
This may affect keys that rely on an *implicit* key type. Example:
- Input:
```c
key <> { [a, A, NoSymbol] };
```
- Compilation with xkbcommon \< 1.9.0:
```c
key <> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
[a, A, NoSymbol, NoSymbol]
};
```
- Compilation with xkbcommon ≥ 1.9.0:
```c
key <> {
type= "ALPHABETIC",
[a, A]
};
```
|
|
fbacdd98
|
2025-03-31T07:58:04
|
|
test: Refactor test_multi_keysyms_actions
- Use less macros
- Add golden tests to check the compilation *result*
|
|
b254cc2e
|
2025-03-30T12:27:15
|
|
test: Remove empty components boilerplate
|
|
8ba5c453
|
2025-03-30T10:07:10
|
|
xkbcomp: Use section reference as default section name
Before this commit the following keymap:
```c
xkb_keymap {
xkb_keycode {};
};
```
would result in (boilerplate removed):
```c
xkb_keymap {
xkb_keycode "(unnamed)" {};
};
```
This is both useless and wasting allocation: section names are optional,
so we should just remove this default name altogether and keep it
undefined, as in the original keymap.
The situation is a bit different if there is an include, as for keymaps
created from RMLVO names. Before this commit, the following keymap:
```c
xkb_keymap {
xkb_keycode { include "evdev+aliases(qwerty)" };
};
```
would result in (boilerplate removed):
```c
xkb_keymap {
xkb_keycode "(unnamed)" { … };
};
```
With this commit we now follow the Xorg xkbcomp style by using the
section reference (the include string) as the *default* section name. So
the previous example would now result in:
```c
xkb_keymap {
xkb_keycode "evdev_aliases(qwerty)" { … };
};
```
which is useful to give a hint of the original include.
Note that if the original section had a name, it would preserve it:
```c
xkb_keymap {
xkb_keycode "test" { include "evdev+aliases(qwerty)" };
};
```
would compile to:
```c
xkb_keymap {
xkb_keycode "test" { … };
};
```
|
|
3150bca8
|
2025-03-30T09:54:02
|
|
xkbcomp: Make all components optional
We already accept *empty* components, such as: `xkb_compat {};`. Let’s
accept missing components as well, so that we can reduce the boilerplate
in our tests.
Note that we will still explicitly serialize empty components for
compatibility with previous xkbcommon versions and Xorg xkbcomp.
|
|
23598fa1
|
2025-03-25T22:52:06
|
|
Enable merge mode “replace” in include statements
Previously only the merge modes “override” and “augment” were available
in include statements, using the prefix ‘+’ and ‘|’ respectively. While
on one hand `replace` include statement can be used in keymap files, on
the other hand *rules* files have no way to express the *replace* mode.
This commit enables the merge mode “replace” using the prefix `^`. This
prefix was chosen due to its similarity with the `XOR` bit operator,
which convey *mutual exclusion*.
Other candidates:
- `!` conveys some kind of higher precedence, akin to CSS `!important`.
But it conflicts with the section header `!`, which is a token in the
current parser. It would require special handling, not worth it. It
also convey the meaning of negation, which is confusing.
- `&` has the advantage of not corresponding to a token in the rules
parser. `^` seems however to stand out more and it is less likely to
trigger erroneous comparison with `|` and `&` bit operators.
|
|
6fc6e64b
|
2025-03-26T10:35:22
|
|
rules: Added extended wild cards <none>, <some> and <any>
Added the following wild cards to the rules file syntax, in addition
to the current `*` legacy wild card:
- `<none>`: Match *empty* value.
- `<some>`: Match *non-empty* value.
- `<any>`: Match *any* (optionally empty) value. Its behavior does not
depend on the context, contrary to the legacy wild card `*`.
This will enable writing much simpler rules, see [!764] for an example
of tricky rules in the `xkeyboard-config` project, that would benefit
from the new wild cards.
[!764]: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/764
The verbose wild cards are preferred to single characters:
- More intuitive: self-explanatory.
- Does not steal syntax from other token.
- Extensible syntax, should we need it.
A previous proposal used the characters (`!`, `+`, `?`) for their
similarity with the corresponding syntax of regular expressions
(negative assertion & quantifiers), in line with `*`. But `!` is not
that intuitive after all and conflict with its role as section header.
Furthermore, `+` is also used as a merge mode. Finally, nothing beats
whole short words for readability.
|
|
500b260b
|
2025-03-28T09:38:58
|
|
xkbcomp: Fix parser failure on floating-point numbers
Before this commit we used `strtold`, which depends on the locale. But
the XKB syntax is fixed and uses a period as decimal separator. So ensure
the syntax is correct without relying on `strtold` and truncate the
result, as the parser does not use floating-point numbers.
|
|
d3188d33
|
2025-03-28T07:11:09
|
|
test: Enable using the user locale
This enable to test different locales easily. Note that the logging
tests requires resetting the locale back to `C`.
|
|
daee709d
|
2025-03-14T13:45:58
|
|
test: Add xkbcli compile-keymap --kccgst tests
|
|
47f7f93c
|
2025-03-14T13:52:02
|
|
test: Check mutually exclusive tools options
|
|
f01f0d63
|
2025-03-14T16:48:56
|
|
test: Check more tools options combinations
|
|
140e2cdd
|
2025-03-14T13:10:52
|
|
test: Make tools options parsing checks faster
|
|
8e92f25e
|
2025-03-13T21:26:59
|
|
rules: Added xkb_components_names_from_rules()
This is mainly for debugging purposes and to enable displaying KcCGST
values from RMLVO resolution in `xkbcli compile-keymap --kccgst`.
|
|
e5401b07
|
2025-03-26T16:02:58
|
|
symbols: Improve Modmap parsing
Parse, dont’t validate: ensure *at parsing* that `modifier_map`
definitions use a list of keys and keysyms.
This enables to remove the redundant `ExprResolveKeySym` and have keysym
parsing exclusively in handled in `parser.y`.
|
|
f3a4eeaa
|
2025-03-26T16:04:39
|
|
symbols: Improve keysym parsing
|
|
70d11abd
|
2025-03-26T07:38:05
|
|
messages: Add file encoding and invalid syntax entries
Added:
- `XKB_ERROR_INVALID_FILE_ENCODING`
- `XKB_ERROR_INVALID_RULES_SYNTAX`
- `XKB_ERROR_INVALID_COMPOSE_SYNTAX`
Changed:
- `XKB_ERROR_INVALID_SYNTAX` renamed to `XKB_ERROR_INVALID_XKB_SYNTAX`.
|
|
e8561909
|
2025-03-18T14:34:10
|
|
xkbcomp: Fix keycodes bounds
- Refactor to check conflicts first for the key names and then for the
keycodes. This seems more useful for the user and enable further
memory optimizations.
- Do not allocate until we are sure to add the keycode. The bounds are
only updated afterwards, so the call to `FindKeyByName` should be
more efficient.
- Fixed keycodes bounds not shrunk correctly when an existing keycode
is overridden.
- Do not prepare keyname strings for logging if we are not going to
use them.
|
|
cb3565b1
|
2025-03-07T17:59:33
|
|
keymap: Fix segfault due to invalid group wrapping
The modular arithmetic is incorrect for negative values, e.g. for
num_groups = 1. It triggers a segfault for the following settings:
- layouts count (per key or total) N: `N > 0`, and
- layout index n: `n = - k * N` (`k > 0`)
% returns the *remainder* of the division, not the modulus (see C11
standard 6.5.5 “Multiplicative operators”: a % b = a - (a/b)*b. While
both operators return the same result for positive operands, they do
not for e.g. a negative dividend: remainder may be negative (in the
open interval ]-num_groups, num_groups[) while the modulus is always
positive. So if the remainder is negative, we must add `num_groups` to
get the modulus.
Fixes: 67b03cea ("state: correctly wrap state->locked_group and ->group")
Signed-off-by: Julian Orth <ju.orth@gmail.com>
Co-authored-by: Julian Orth <ju.orth@gmail.com>
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
|
|
548fc355
|
2025-02-06T09:46:31
|
|
test: Fix inversion of expected/got in log test
|
|
e1892266
|
2025-02-13T16:57:46
|
|
clang-tidy: Miscellaneous fixes
|
|
5cfd36ab
|
2025-02-14T10:35:49
|
|
tools: Do not load names from the environment by default
Our tools are debugging tools and as such we need to have complete
control to be able to reproduce setups. This is not currently the case,
as we do not use `XKB_CONTEXT_NO_ENVIRONMENT_NAMES` by default nor can
we set it.
So it is very easy to forget about the various `XKB_DEFAULT_*`
environement variables for the default RMLVO values, then to get puzzled
by unexpected results.
Added to that, these environment variables do not work correctly in
`xkbcli-compile-xeymap`: calling the tool without RMLVO values will
use these variables only if the RMLVO values are set explicitly empty or
if the various *constants* `DEFAULT_XKB_*` are empty. This is unexpected,
as the environment variables should *always* be used unless:
- `XKB_CONTEXT_NO_ENVIRONMENT_NAMES` is used (not the case here);
- the variable is empty; in this case the constants `DEFAULT_XKB_*` are
used.
Fixed by the following *breaking change*: make the tools use
`XKB_CONTEXT_NO_ENVIRONMENT_NAMES` *by default*, unless the new
`--enable-environment-names` option is used.
We also make `rmlvo` incompatible with `--enable-environment-names` for
now in the public tool, as else it requires a private API.
|
|
a4038a47
|
2025-02-12T09:50:36
|
|
Miscellaneous int types fixes
|
|
befa0cdd
|
2025-02-12T15:38:58
|
|
test: Check integers syntax
|
|
4cef822a
|
2025-02-12T07:44:34
|
|
test: Check masks syntax
|
|
ce9bcbe0
|
2025-02-07T16:31:37
|
|
scripts: Rename keysyms-related files
Previous names were too generic. Fixed by using explicit names and add
the `.py` file extension.
|
|
a5c2c746
|
2025-02-06T12:27:25
|
|
Fix a few direct modifications to generated files
Accidentally modified generated files in a couple of recent changes.
Sync the templates.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
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>
|
|
a380ba52
|
2025-01-25T07:00:43
|
|
Move XKB_EXPORT to headers
The Windows dllexport annotation wants to be on the declarations, not
the definitions.
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>
|
|
80233f96
|
2025-01-30T15:21:28
|
|
tests: Fix env variables messing tools arguments checks
|
|
3249223f
|
2025-01-30T07:58:20
|
|
test: Add check for keymap and compose compilation logs
|
|
502e9e5b
|
2025-01-29T12:19:10
|
|
xkbcomp: Add stricter bounds for keycodes and levels
Our current implementation uses continuous arrays indexed by keycodes
and levels. This is simple and good enough for realistic keymaps.
However, they are allowed to have big values that will lead to either
memory exhaustion or a waste of memory (sparse arrays).
Added the much stricter upper bounds `0xfff` for keycodes[^1] and 2048
for levels[^2], which should still be plenty enough and provides stronger
memory security.
[^1]: Current max keycode is 0x2ff in Linux.
[^2]: Should be big enough to satisfy automatically generated keymaps.
|
|
307ce5a7
|
2025-01-29T00: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>
|
|
ff2ac493
|
2025-01-29T06:59:48
|
|
tests: Fix deprecated keysyms in Compose data
The data set is big enough so we can just drop most sequences with
deprecated keysyms and fix most keysyms an alternative non-deprecated
name.
We keep a handful of them for testing purpose.
|
|
c85c9bdc
|
2025-01-27T17:15:06
|
|
symbols: Allow levels with different keysyms and actions counts
Contrary to groups, there is no reason for levels to restrict the same
count of keysyms and actions.
|
|
af5704dc
|
2025-01-25T11:01:03
|
|
state: Fix empty level not breaking latches
In essence empty levels are levels with just a `NoSymbol` keysym and
a `NoAction()`, which breaks latches.
Fixed regression introduced in fdf2c525977e7e8af4135d593110f5bc1454abd8.
Added tests also for the case where the keycode is unknown.
|
|
7a08b145
|
2025-01-24T11:10:17
|
|
tests: Modifier and group latch
- Added a big bunch of tests for modifier latch. No yet exhaustive,
but should cover the most usual use cases.
- Added missing test cases for breaking the group latch. Ideally, more
tests should be added to match the coverage of modifiers latches.
WARNING: it is ambiguous what prevents a latch when multiple keys are
*simultenously* operated together. We currently assuming that
any action that is not identical to the considered latch
prevents it.
|
|
357ab0cb
|
2025-01-23T16:42:30
|
|
clang-tidy: Fix missing default case in switch statement
|
|
842497d9
|
2025-01-22T16:46:11
|
|
clang-tidy: Fix implicit or incorrect integer casts
|
|
5389a31e
|
2025-01-22T17:33:03
|
|
clang-tidy: Use memcpy instead of the insecure strcpy
|
|
b76617e6
|
2025-01-22T16:42:47
|
|
clang-tidy: Various fixes related to IO
|
|
53b3f446
|
2025-01-22T17:43:53
|
|
clang-tidy: Fix headers includes
|
|
0c940827
|
2025-01-22T16:39:35
|
|
clang-tidy: Macro arguments should be enclosed in parentheses
|
|
88a3d3c2
|
2025-01-23T16:03:51
|
|
tests: Refactor buffercomp
Move tests into proper functions and log tests names.
|
|
b1e1aae6
|
2025-01-23T15:20:44
|
|
xkbcomp: Fix memory leak when extra content after keymap
It triggers with e.g.:
```
xkb_keymap { xkb_keycodes { }; };
}; // erroneous
```
|
|
709027ec
|
2025-01-23T09: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-22T17: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.
|
|
8c071403
|
2025-01-21T10: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-21T10:38:35
|
|
test/registry: remove unused function
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
2a60432e
|
2025-01-21T10:25:55
|
|
test/xvfb-wrapper: remove unused code
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
b0d9a790
|
2025-01-15T12:03:10
|
|
vmods: Fix explicit vmods not dumped
|
|
11140ded
|
2025-01-10T13: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.
|
|
c7fdf506
|
2025-01-16T20:23:28
|
|
Use portable integer literal suffixes
|
|
e3e44998
|
2025-01-16T20: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.
|
|
3fdd822d
|
2025-01-16T02: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-15T13:56:36
|
|
compat: Fix Interp & LED merge modes
|
|
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.
|
|
325ba10e
|
2025-01-07T16: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-07T18:33:21
|
|
state: Add test for LEDs driven by the group state
|
|
93b75c63
|
2024-12-22T17: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-11T08: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-02T18:45:15
|
|
test: Declare virtual modifiers explicitly
This is required in order to use the sections in isolation.
|
|
b6acdc30
|
2025-01-10T20:31:04
|
|
xkbcli list: Fix duplicate variants
|
|
b9b4ab47
|
2024-12-09T09: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-18T20:08:56
|
|
state: Add vmod support for xkb_state_mod_mask_remove_consumed
|
|
5fbc0ec7
|
2024-10-14T16: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-14T16: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-23T16: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-23T16: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-14T19: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-30T14: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-12T16: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-08T18:45:18
|
|
symbols: Add tests for multiple actions per level
|
|
fdf2c525
|
2024-10-08T19: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
|