-
Notifications
You must be signed in to change notification settings - Fork 125
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
Experiment: state: support pure virtual modifiers #450
base: master
Are you sure you want to change the base?
Conversation
Referencing #36 here too since there's significant overlap. |
Yeah, nice. I think this is definitely the right approach. |
Traditionally, virtual modifiers were merely name aliases for real modifiers, e.g. NumLock was usually mapped to Mod2 (see modifier_map statement). Virtual modifiers that were never mapped to a real one had no effect on the keymap state. This patch introduces the concept of pure virtual modifiers, i.e. virtual modifiers that are not mapped now show up as if the were true modifiers. Note that pure virtual modifiers cannot be used in an interpret action's AnyOf() and an interpret action for a pure virtual modifier must be AnyOfOrNone() to take effect: virtual_modifiers APureMod,...; interpret a+AnyOfOrNone(all) { virtualModifier= APureMod; action= SetMods(modifiers=APureMod); }; The above adds a pure virtual modifier for keysym `a`. Interestingly, this fixes one current issue with our tests: previously the de(neo) layout level5 didn't take effect correctly, with this patch in place it now behaves.
52ad82a
to
0c66d0a
Compare
Rebased and added first dedicated tests. Since this has the potential to breaks things, I would proceed with care. But honestly I feel it looks pretty solid for now. Maybe modify more tests much like |
This will require #512 for a full implementation. |
Traditionally, virtual modifiers were merely name aliases for real modifiers, e.g. NumLock was usually mapped to Mod2 (see modifier_map statement). Virtual modifiers that were never mapped to a real one had no effect on the keymap state.
This patch introduces the concept of pure virtual modifiers, i.e. virtual modifiers that are not mapped now show up as if the were true modifiers.
Note that pure virtual modifiers cannot be used in an interpret action's AnyOf() and an interpret action for a pure virtual modifier must be AnyOfOrNone() to take effect:
The above adds a pure virtual modifier for keysym
a
.Interestingly, this fixes one current issue with our tests: previously the de(neo) layout level5 didn't take effect correctly, with this patch in place it now behaves.
This took forever to wrap my head around it almost feels too simple now... The one test case failure was in the
de(neo)
layout but after staring at this - it actually fixes that particular issue.Related to #447
cc @wismill, @bluetech, @fooishbar