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

Support querying whether virtual modifiers are active (alternative 2) #512

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wismill
Copy link
Member

@wismill wismill commented Sep 23, 2024

This is a smaller version of #353, which is also an alternative to #36.

This is necessary to implement fully #450.

@wismill wismill added the state Indicates a need for improvements or additions to the xkb_state API label Sep 23, 2024
@wismill wismill added this to the 1.8.0 milestone Sep 23, 2024
@wismill
Copy link
Member Author

wismill commented Sep 23, 2024

TODO: more tests, with all modifiers. We want this to be 100% reliable, with no breaking changes in the known and foreseen uses.

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.
Changed the value of the following constant to match the actual
name of their corresponding modifier:
- `XKB_MOD_NAME_ALT`
- `XKB_MOD_NAME_LOGO`
- `XKB_MOD_NAME_NUM`

Added support for the following modifiers:
- `Meta`
- `Super` (alternative constant)
- `Hyper`
- `LevelThree`
- `LevelFive`
- `ScrollLock`
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state Indicates a need for improvements or additions to the xkb_state API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant