From b72635b8875e25dd6da7f42d05aac77468db85a2 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 30 Apr 2022 23:36:17 +0200 Subject: 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. --- srcs/juloo.keyboard2/KeyValue.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/KeyValue.java') 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) -- cgit v1.2.3