abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Pointers.java
diff options
context:
space:
mode:
authorJules Aguillon2022-10-23 21:34:05 +0200
committerJules Aguillon2022-10-23 21:37:04 +0200
commit36e10a792ffd034ffb56e48e2e2282f6ae16cc8d (patch)
treeaf8b28705250fd8a1a685d0bc79c759cd5b66059 /srcs/juloo.keyboard2/Pointers.java
parent55cece796588ad58646d9ea877912510af06e24e (diff)
downloadunexpected-keyboard-36e10a792ffd034ffb56e48e2e2282f6ae16cc8d.tar.gz
unexpected-keyboard-36e10a792ffd034ffb56e48e2e2282f6ae16cc8d.zip
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.
Diffstat (limited to 'srcs/juloo.keyboard2/Pointers.java')
-rw-r--r--srcs/juloo.keyboard2/Pointers.java11
1 files changed, 6 insertions, 5 deletions
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);
}