-
Notifications
You must be signed in to change notification settings - Fork 124
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
base: master
Are you sure you want to change the base?
Various fixes and improvements to latching behavior #569
Conversation
d48426c
to
7c82bb5
Compare
7c82bb5
to
801c873
Compare
03ef230
to
cf08189
Compare
dc4277e
to
eac392e
Compare
f6923f9
to
6670fe3
Compare
Sorry for the noise. Every time I think this is ready, I sleep on it and then notice a new edge case… I have been using this locally for several weeks now, and it makes the latching experience much more pleasant. The intuition is that each sequence of latches builds up to some lasting effect intended by the user. That effect can either be a change in the application state, or a long-term change in the keyboard state. Once the effect has been achieved, the latches used to accomplish it have served their purpose are no longer desired. Setting or releasing a lock is one such lasting effect, therefore changes in the lock state should always break all latches. A user may also latch a modifier only to enable the latching of a different one. In such cases, the first latch has served its purpose as soon as the second one is formed. The “non- One change this PR does not make is that new latches continue to not break existing group latches. Because there is no equivalent of |
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]>
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]>
Signed-off-by: Jules Bertholet <[email protected]>
924eee4
to
eafd161
Compare
Rebased. Also squashed a few commits, hopefully making it easier to review. |
Signed-off-by: Jules Bertholet <[email protected]>
Signed-off-by: Jules Bertholet <[email protected]>
eafd161
to
be4976a
Compare
Any new lock breaks all existing latches
For example, if
Caps_Lock
is on the second level of some key, andShift
is latched, pressing the key will enableCaps
while also breaking theShift
latch, ensuring that the next character is properly uppercase. (Prior to this commit, bothShift
andCaps
would be active, so the next character would be lowercase.) (Setting a lock vialatchToLock
or clearing it viaclearLocks
also breaks all latches.)New latches break existing latches for non-
preserve
d modifiers in the modifier list of the type of the key that triggered the new latchFor example, if a new latch is triggered by pressing a key of type
ALPHABETIC
, existingShift
andLock
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
andAltGr
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.