Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbols: Skip interprets only for groups with explicit actions #519

Merged

Conversation

wismill
Copy link
Member

@wismill wismill commented Sep 30, 2024

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:

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:

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) ]
};

Fixes #511

@wismill wismill added the compile-keymap Indicates a need for improvements or additions to keymap compilation label Sep 30, 2024
@wismill wismill added this to the 1.8.0 milestone Sep 30, 2024
@wismill wismill force-pushed the actions/explicit-interprets-per-group branch from 92d1544 to f07da78 Compare October 2, 2024 06:16
@wismill wismill force-pushed the actions/explicit-interprets-per-group branch from f07da78 to 4abf266 Compare October 9, 2024 07:04
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).
@wismill wismill force-pushed the actions/explicit-interprets-per-group branch 2 times, most recently from e655109 to 82ef181 Compare October 9, 2024 15:07
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) ]
};
```
@wismill wismill force-pushed the actions/explicit-interprets-per-group branch from 82ef181 to 9d76b42 Compare October 11, 2024 13:38
@wismill wismill merged commit 948f7a5 into xkbcommon:master Oct 11, 2024
4 checks passed
@wismill wismill deleted the actions/explicit-interprets-per-group branch October 11, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile-keymap Indicates a need for improvements or additions to keymap compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map a key to a specific real mod ONLY for the currently active layout
1 participant