From 1f9e92ed60127baca11cd222a2851d01550bb71c Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 2 Mar 2023 11:40:22 +0100 Subject: Fix caps lock stopped by auto-capitalisation Auto-capitalisation triggers when the backspace key is used. Make sure to not remove a locked shift pointer. --- srcs/juloo.keyboard2/Pointers.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/Pointers.java') diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index acad456..51319ca 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -76,12 +76,20 @@ public final class Pointers implements Handler.Callback return -1; } + public int getKeyFlags(KeyboardData.Key key, KeyValue kv) + { + Pointer ptr = getLatched(key, kv); + if (ptr == null) return -1; + return ptr.flags; + } + /** Fake pointers are latched and not lockable. */ public void add_fake_pointer(KeyValue kv, KeyboardData.Key key, boolean locked) { - if (getLatched(key, kv) != null) - return; // Already latched, don't add an other pointer. - Pointer ptr = new Pointer(-1, key, kv, 0.f, 0.f, Modifiers.EMPTY); + Pointer ptr = getLatched(key, kv); + if (ptr != null) + removePtr(ptr); // Already latched, replace pointer. + ptr = new Pointer(-1, key, kv, 0.f, 0.f, Modifiers.EMPTY); ptr.flags &= ~(KeyValue.FLAG_LATCH | KeyValue.FLAG_LOCK); ptr.flags |= KeyValue.FLAG_FAKE_PTR; if (locked) -- cgit v1.2.3