From 36e10a792ffd034ffb56e48e2e2282f6ae16cc8d Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 23 Oct 2022 21:34:05 +0200 Subject: Add the capslock key The key enable caps lock immediately. It does nothing if caps lock is already enabled. It is not present on the keyboard by default but a place is defined on every layout, top-right of the shift key. It can be enabled in the settings. The icon is from materialdesignicons.com. --- srcs/juloo.keyboard2/Pointers.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'srcs/juloo.keyboard2/Pointers.java') diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index 2ac55bb..35299ab 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -75,13 +75,14 @@ public final class Pointers implements Handler.Callback } /** Fake pointers are latched and not lockable. */ - public void add_fake_pointer(KeyValue kv, KeyboardData.Key key) + public void add_fake_pointer(KeyValue kv, KeyboardData.Key key, boolean locked) { - // Avoid adding a fake pointer to a key that is already down. - if (isKeyDown(key)) - return; + remove_fake_pointer(kv, key); Pointer ptr = new Pointer(-1, key, kv, 0.f, 0.f, Modifiers.EMPTY); - ptr.flags = ptr.flags & ~(KeyValue.FLAG_LATCH | KeyValue.FLAG_LOCK | KeyValue.FLAG_FAKE_PTR); + ptr.flags &= ~KeyValue.FLAG_LATCH; + ptr.flags |= KeyValue.FLAG_LOCK | KeyValue.FLAG_FAKE_PTR; + if (locked) + ptr.flags = (ptr.flags & ~KeyValue.FLAG_LOCK) | KeyValue.FLAG_LOCKED; _ptrs.add(ptr); } -- cgit v1.2.3