diff options
| author | Jules Aguillon | 2024-12-31 12:10:02 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-12-31 12:17:22 +0100 |
| commit | 42c23d386432df0b79b4835bc711e27724a91cbc (patch) | |
| tree | 1aa040c8ec3c007197886768952618523eafd382 /srcs/juloo.keyboard2/KeyValue.java | |
| parent | f64a0be6fa90958ceacd01d91ef4fcd193c815bc (diff) | |
| download | unexpected-keyboard-42c23d386432df0b79b4835bc711e27724a91cbc.tar.gz unexpected-keyboard-42c23d386432df0b79b4835bc711e27724a91cbc.zip | |
Refactor: Simplify double tap for capslock
This doesn't fix a bug but remove some tricky code. The shift key is no
longer different when the "double tap for capslock" option is on.
The handling of the option is moved to Pointer instead and becomes
simpler.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 57fe88d..c6778c9 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -101,8 +101,8 @@ public final class KeyValue implements Comparable<KeyValue> // Behavior flags. public static final int FLAG_LATCH = (1 << FLAGS_OFFSET << 0); - // Key can be locked by typing twice - public static final int FLAG_LOCK = (1 << FLAGS_OFFSET << 1); + // Key can be locked by typing twice when enabled in settings + public static final int FLAG_DOUBLE_TAP_LOCK = (1 << FLAGS_OFFSET << 1); // Special keys are not repeated and don't clear latched modifiers. public static final int FLAG_SPECIAL = (1 << FLAGS_OFFSET << 2); // Whether the symbol should be greyed out. For example, keys that are not @@ -118,8 +118,8 @@ public final class KeyValue implements Comparable<KeyValue> // Ranges for the different components private static final int FLAGS_BITS = - FLAG_LATCH | FLAG_LOCK | FLAG_SPECIAL | FLAG_GREYED | FLAG_KEY_FONT | - FLAG_SMALLER_FONT | FLAG_SECONDARY; + FLAG_LATCH | FLAG_DOUBLE_TAP_LOCK | FLAG_SPECIAL | FLAG_GREYED | + FLAG_KEY_FONT | FLAG_SMALLER_FONT | FLAG_SECONDARY; private static final int KIND_BITS = (0b1111 << KIND_OFFSET); // 4 bits wide private static final int VALUE_BITS = ~(FLAGS_BITS | KIND_BITS); // 20 bits wide @@ -500,7 +500,7 @@ public final class KeyValue implements Comparable<KeyValue> case "\\\\": return makeStringKey("\\"); /* Modifiers and dead-keys */ - case "shift": return modifierKey(0xE00A, Modifier.SHIFT, 0); + case "shift": return modifierKey(0xE00A, Modifier.SHIFT, FLAG_DOUBLE_TAP_LOCK); case "ctrl": return modifierKey("Ctrl", Modifier.CTRL, 0); case "alt": return modifierKey("Alt", Modifier.ALT, 0); case "accent_aigu": return diacritic(0xE050, Modifier.AIGU); |
