abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyValue.java
diff options
context:
space:
mode:
authorJules Aguillon2022-04-30 23:36:17 +0200
committerJules Aguillon2022-04-30 23:47:09 +0200
commitb72635b8875e25dd6da7f42d05aac77468db85a2 (patch)
tree259ac0c6ed963da40697892a40fd97ddd2d37088 /srcs/juloo.keyboard2/KeyValue.java
parent84af72c2229025a451c861ac128ea585cbb72954 (diff)
downloadunexpected-keyboard-b72635b8875e25dd6da7f42d05aac77468db85a2.tar.gz
unexpected-keyboard-b72635b8875e25dd6da7f42d05aac77468db85a2.zip
Fix modifiers not cleared when presses overlap
When typing fast, a second key might be pressed before the first is released. Clearing modifiers earlier would prevent this but would break modifiers placed in corners (especially the accent keys). Instead, don't take latched modifiers into account when registering the second press. A new flag is needed to not interfere with holding modifers, which is merged with the norepeat flag.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 92ec532..856f387 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -20,7 +20,8 @@ class KeyValue
// Behavior flags
public static final int FLAG_LATCH = 1;
public static final int FLAG_LOCK = (1 << 1);
- public static final int FLAG_NOREPEAT = (1 << 2);
+ // Special keys are not repeated and don't clear latched modifiers
+ public static final int FLAG_SPECIAL = (1 << 2);
public static final int FLAG_NOCHAR = (1 << 3);
public static final int FLAG_PRECISE_REPEAT = (1 << 4);
@@ -135,7 +136,7 @@ class KeyValue
private static void addModifierKey(String name, String symbol, int extra_flags)
{
addKey(name, symbol, CHAR_NONE, EVENT_NONE,
- FLAG_LATCH | FLAG_NOCHAR | FLAG_NOREPEAT | extra_flags);
+ FLAG_LATCH | FLAG_NOCHAR | FLAG_SPECIAL | extra_flags);
}
private static void addSpecialKey(String name, String symbol, int event)
@@ -145,7 +146,7 @@ class KeyValue
private static void addSpecialKey(String name, String symbol, int event, int flags)
{
- addKey(name, symbol, CHAR_NONE, event, flags | FLAG_NOREPEAT);
+ addKey(name, symbol, CHAR_NONE, event, flags | FLAG_SPECIAL);
}
private static void addEventKey(String name, String symbol, int event)