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

Various fixes and improvements to latching behavior #569

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Jules-Bertholet
Copy link

@Jules-Bertholet Jules-Bertholet commented Dec 21, 2024

Any new lock breaks all existing latches

For example, if Caps_Lock is on the second level of some key, and Shift is latched, pressing the key will enable Caps while also breaking the Shift latch, ensuring that the next character is properly uppercase. (Prior to this commit, both Shift and Caps would be active, so the next character would be lowercase.) (Setting a lock via latchToLock or clearing it via clearLocks also breaks all latches.)

New latches break existing latches for non-preserved modifiers in the modifier list of the type of the key that triggered the new latch

For example, if a new latch is triggered by pressing a key of type ALPHABETIC, existing Shift and Lock latches will now be broken, but other latches will be preserved as before.

This ensures the correct behavior when combining sticky keys with ISO_Level5_Latch or latched-group additional symbols layers.

The rules for what does and does not break a latch are also applied before the latch is formed

Notably, pressing two latching keys simultaneously now applies both latches. For example, if I set up sticky keys, and then press Shift and AltGr together, both modifiers now end up latched.


An alternative to #51 that resolves its motivating issue without incurring the problems discussed in the comments there.

For example, if `Caps_Lock` is on the second level of some key,
and `Shift` is latched, pressing the key will lock `Caps`
while also breaking the `Shift` latch, ensuring that the next character
is properly uppercase. (Prior to this commit, both `Shift` and
`Caps` would be active, so the next character would be lowercase.)

Signed-off-by: Jules Bertholet <[email protected]>
@Jules-Bertholet Jules-Bertholet changed the title Make any lock break all latches, and group latches break mod latches Make all locks break all latches, and group latches break mod latches Dec 21, 2024
@Jules-Bertholet Jules-Bertholet marked this pull request as draft December 21, 2024 19:45
@Jules-Bertholet Jules-Bertholet changed the title Make all locks break all latches, and group latches break mod latches Make new locks break all latches, and new latches break some latches Dec 21, 2024
@Jules-Bertholet Jules-Bertholet marked this pull request as ready for review December 21, 2024 21:31
@Jules-Bertholet Jules-Bertholet force-pushed the locks-break-latches branch 3 times, most recently from 0e7cb15 to 03ef230 Compare December 21, 2024 21:37
Changed latching behavior so that latching a modifier or group now breaks existing modifier latches,
but only if the type of the key responsible for the latter latch
has the modifier of the pre-existing latch in its modifiers list.

For example, if a new latch is triggered by pressing a key of type `ALPHABETIC`,
existing `Shift` and `Lock` latches will now be broken, but other latches
will be preserved as before.

This ensures the correct behavior when combining sticky keys with
`ISO_Level5_Latch` or latched-group additional symbols layers.

Signed-off-by: Jules Bertholet <[email protected]>
Prior to this commit, "latch A down" → "latch B down" →
"latch A up" → "latch B up" would result in only B being latched.
After this commit, both A and B end up latched.

Signed-off-by: Jules Bertholet <[email protected]>
@Jules-Bertholet Jules-Bertholet changed the title Make new locks break all latches, and new latches break some latches Various fixes and improvements to latching behavior Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant