diff options
| author | Jules Aguillon | 2022-06-05 17:26:34 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2022-06-05 17:46:22 +0200 |
| commit | e10c587dc5286db64a6f55010637f0c3f9f62d59 (patch) | |
| tree | 2c39dd330f1915e3c1f8bb353c5db13c3a6c3bd4 /srcs/juloo.keyboard2/Pointers.java | |
| parent | d03e96da3e99e1e0edb78367499c22f574079583 (diff) | |
| download | unexpected-keyboard-e10c587dc5286db64a6f55010637f0c3f9f62d59.tar.gz unexpected-keyboard-e10c587dc5286db64a6f55010637f0c3f9f62d59.zip | |
Refactor: Abstract KeyValue fields
The meaning of the public fields of KeyValue was quite complicated and
not handled consistently accross the app.
Make these fields private and add a more abstract API on top.
The meaning of these fields changed recently and it wasn't an easy
change. I plan on making more changes in the future.
Diffstat (limited to 'srcs/juloo.keyboard2/Pointers.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Pointers.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index f6db9ac..6a9cef9 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -40,8 +40,9 @@ public final class Pointers implements Handler.Callback mods[i] = ((skip_latched && p.pointerId == -1 && (p.flags & KeyValue.FLAG_LOCKED) == 0) - || p.value == null) - ? 0 : p.value.code; + || p.value == null + || p.value.getKind() != KeyValue.Kind.Modifier) + ? 0 : p.value.getModifier(); } return Modifiers.ofArray(mods); } @@ -146,7 +147,7 @@ public final class Pointers implements Handler.Callback KeyValue value = _handler.modifyKey(key.key0, mods); Pointer ptr = new Pointer(pointerId, key, value, x, y, mods); _ptrs.add(ptr); - if (value != null && (value.flags & KeyValue.FLAG_SPECIAL) == 0) + if (value != null && !value.hasFlags(KeyValue.FLAG_SPECIAL)) startKeyRepeat(ptr); _handler.onPointerDown(false); } @@ -218,12 +219,12 @@ public final class Pointers implements Handler.Callback { int old_flags = ptr.flags; ptr.value = newValue; - ptr.flags = newValue.flags; + ptr.flags = newValue.getFlags(); // Keep the keyrepeat going between modulated keys. - if ((old_flags & newValue.flags & KeyValue.FLAG_PRECISE_REPEAT) == 0) + if ((old_flags & ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) == 0) { stopKeyRepeat(ptr); - if ((newValue.flags & KeyValue.FLAG_SPECIAL) == 0) + if ((ptr.flags & KeyValue.FLAG_SPECIAL) == 0) startKeyRepeat(ptr); } _handler.onPointerDown(true); @@ -375,7 +376,7 @@ public final class Pointers implements Handler.Callback downY = y; ptrDist = 0.f; modifiers = m; - flags = (v == null) ? 0 : v.flags; + flags = (v == null) ? 0 : v.getFlags(); timeoutWhat = -1; repeatingPtrDist = -1.f; } |
