|
7dbd2576
|
2025-04-01T19:20:10
|
|
keymap: Use constants for Lock and Control indexes
These indexes are fixed, so there is no need to lookup their name.
|
|
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>
|
|
5ef19bcf
|
2025-02-13T17:58:21
|
|
xkbcomp: Fix incorrect memory comparison
Spotted by clang-tidy:
```
../src/keymap-priv.c:146:16: warning: comparing object representation of
type 'union xkb_action' which does not have
a unique object representation; consider
comparing the members of the object manually
[bugprone-suspicious-memory-comparison]
````
Indeed, from “EXP42-C. Do not compare padding data”[^1]:
> unnamed members of objects of structure and union type do not participate
> in initialization. Unnamed members of structure objects have indeterminate
> representation even after initialization.
Fixed by using a dedicated comparison function for `union xkb_action`.
[^1]: https://wiki.sei.cmu.edu/confluence/display/c/EXP42-C.+Do+not+compare+padding+data
|
|
e3108182
|
2025-02-12T09:49:25
|
|
Fix int casts related to layout index
- XkbWrapGroupIntoRange
- State
|
|
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>
|
|
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.
|
|
842497d9
|
2025-01-22T16:46:11
|
|
clang-tidy: Fix implicit or incorrect integer casts
|
|
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.
|
|
d43bb955
|
2024-12-19T18:21:01
|
|
symbols: Fix key symbols/actions merge
- Fixed field for defined keysyms/actions
- Fixed regression introduced by fdf2c525977e7e8af4135d593110f5bc1454abd8
|
|
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.
|
|
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
|
|
772ac0c4
|
2024-09-23T11:02:35
|
|
keymap: Rename keysyms field in xkb_level
The current field `u` (short for “union”) is not very descriptive.
Next commit will add multiple actions per level, so let’s rename the
keysym field to `s` (short for “symmbols”).
|
|
40aab05e
|
2019-12-27T13: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>
|
|
5440aaa5
|
2017-06-26T21:52:27
|
|
Fix signed vs. unsigned confusion in name sanitisation
Don't try to divide through a signed char when indexing an array, lest
ye try to index off the start of it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
39082082
|
2016-02-28T00:33:19
|
|
keymap: share LevelsSameSyms()
The function is generic enough.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
787faf36
|
2014-04-22T12:23:36
|
|
keymap: don't use darray in xkb_mod_set
Instead just statically allocate the mods array (of size MAX_MOD_SIZE =
32). The limit is not going anywhere, and static allocations are nicer
(nicer code, no OOM, etc.). It's also small and dense enough.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
6b1cdee1
|
2014-04-22T11:47:23
|
|
keymap: add and use xkb_mods_{foreach,enumerate}()
To iterate over an xkb_mod_set. Slightly nicer interface and makes
transitioning from darray easier.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0f6bca2b
|
2014-04-22T11:33:47
|
|
keymap: rename xkb_foreach_key to xkb_keys_foreach
We'll use the format xkb_foos_foreach and xkb_foos_enumerate for the
various iterators.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
95aabeec
|
2013-02-09T19:10:56
|
|
symbols: use xkb_mod_set instead of entire keymap
The keymap is not removed entirely from the Info (just constified),
since it is still needed in AddKeySymbols() for looking up aliases. This
dependency will be removed in the future.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
edc0aef5
|
2013-02-08T13:21:27
|
|
text: take xkb_mod_set instead of the entire keymap
The modifier printing functions only need the modifier information, they
don't care about keys or leds, etc.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ca3170ad
|
2013-02-08T13:09:33
|
|
Add struct xkb_mod_set
The only thing that the compilation phase needs the keymap for currently
is for access to the modifier information (it also modifies it in
place!). We want to only pass along the neccessary information, to make
it more tractable and testable, so instead of passing the entire keymap
we add a new 'mod_set' object and pass a (const) reference to that.
The new object is just the old array of 'struct xkb_mod'.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
51a1df2f
|
2014-04-19T15:56:27
|
|
keymap: move ModNameToIndex from text.c and use it in keymap.c
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fa87cdb8
|
2014-02-07T19:39:42
|
|
darray: cleanup
We have quite diverged from the upstream file, so let's make it at least
easier to look at. Remove some unused macros and rename some for
consistency.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7210497c
|
2014-01-13T17:07:41
|
|
keymap: split private functions to keymap-priv.c
This makes it easier to share the private functions in other DSOs
without relying (too much) on dead code elimination, exported symbols,
etc.
Signed-off-by: Ran Benita <ran234@gmail.com>
|