abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2022-05-01 00:11:52 +0200
committerJules Aguillon2022-05-01 00:11:52 +0200
commit04a7ec4bb80b6e33e59a36705d28a3ebd8f8017c (patch)
tree803337fb0a2e5969aecc49620c8221275931e292 /srcs
parent8e0d38c257d96b3a73482bd65df36824c30ed7aa (diff)
downloadunexpected-keyboard-04a7ec4bb80b6e33e59a36705d28a3ebd8f8017c.tar.gz
unexpected-keyboard-04a7ec4bb80b6e33e59a36705d28a3ebd8f8017c.zip
Fix latched pointers accumulating on the same key
It was possible to latch and lock the same modifier several time at the same time independently. Remove that.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Pointers.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java
index 0d0e0fc..cdc254d 100644
--- a/srcs/juloo.keyboard2/Pointers.java
+++ b/srcs/juloo.keyboard2/Pointers.java
@@ -61,7 +61,8 @@ public final class Pointers implements Handler.Callback
*/
public int getKeyFlags(KeyValue kv)
{
- // Use physical equality because the key might have been modified.
+ // Comparing names because the keys might have been modified.
+ // Physical equality works because names are never computed or shared.
String name = kv.name;
for (Pointer p : _ptrs)
if (p.value != null && p.value.name == name)
@@ -207,9 +208,11 @@ public final class Pointers implements Handler.Callback
private Pointer getLatched(Pointer target)
{
KeyboardData.Key k = target.key;
- int vi = target.value_index;
+ KeyValue v = target.value;
+ if (v == null)
+ return null;
for (Pointer p : _ptrs)
- if (p.key == k && p.value_index == vi && p.pointerId == -1)
+ if (p.key == k && p.pointerId == -1 && p.value != null && p.value.name == v.name)
return p;
return null;
}