abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Pointers.java
diff options
context:
space:
mode:
authorJules Aguillon2023-03-05 23:08:35 +0100
committerJules Aguillon2023-03-05 23:08:35 +0100
commit18d3fd3c84db1903b3ea868e3a2fa0f5e837e236 (patch)
treea7d0b5e077c49b17228b01a7b0a27cfb81597cd1 /srcs/juloo.keyboard2/Pointers.java
parentc56ad425f671d07e505cf0e63985abf8499635cc (diff)
downloadunexpected-keyboard-18d3fd3c84db1903b3ea868e3a2fa0f5e837e236.tar.gz
unexpected-keyboard-18d3fd3c84db1903b3ea868e3a2fa0f5e837e236.zip
Refactor: Remove KeyboardData.Corner
The Corner class is removed. The "localized" flag for all the corners is held in a bitfield.
Diffstat (limited to 'srcs/juloo.keyboard2/Pointers.java')
-rw-r--r--srcs/juloo.keyboard2/Pointers.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java
index b9e4d07..6979d7b 100644
--- a/srcs/juloo.keyboard2/Pointers.java
+++ b/srcs/juloo.keyboard2/Pointers.java
@@ -167,7 +167,7 @@ public final class Pointers implements Handler.Callback
// Don't take latched modifiers into account if an other key is pressed.
// The other key already "own" the latched modifiers and will clear them.
Modifiers mods = getModifiers(isOtherPointerDown());
- KeyValue value = handleKV(key.keys[0], mods);
+ KeyValue value = _handler.modifyKey(key.keys[0], mods);
Pointer ptr = new Pointer(pointerId, key, value, x, y, mods);
_ptrs.add(ptr);
startKeyRepeat(ptr);
@@ -184,10 +184,7 @@ public final class Pointers implements Handler.Callback
*/
KeyValue getKeyAtDirection(KeyboardData.Key k, int direction)
{
- int i = DIRECTION_TO_INDEX[direction];
- if (k.keys[i] == null)
- return null;
- return k.keys[i].kv;
+ return k.keys[DIRECTION_TO_INDEX[direction]];
}
/*
@@ -201,7 +198,7 @@ public final class Pointers implements Handler.Callback
private KeyValue getNearestKeyAtDirection(Pointer ptr, Integer direction)
{
if (direction == null)
- return handleKV(ptr.key.keys[0], ptr.modifiers);
+ return _handler.modifyKey(ptr.key.keys[0], ptr.modifiers);
KeyValue k;
// [i] is [0, -1, 1, -2, 2, ...]
for (int i = 0; i > -4; i = (~i>>31) - i)
@@ -216,13 +213,6 @@ public final class Pointers implements Handler.Callback
return null;
}
- private KeyValue handleKV(KeyboardData.Corner c, Modifiers modifiers)
- {
- if (c == null)
- return null;
- return _handler.modifyKey(c.kv, modifiers);
- }
-
public void onTouchMove(float x, float y, int pointerId)
{
Pointer ptr = getPtr(pointerId);
@@ -265,7 +255,8 @@ public final class Pointers implements Handler.Callback
ptr.flags = newValue.getFlags();
// Sliding mode is entered when key5 or key6 is down on a slider key.
if (ptr.key.slider &&
- (ptr.key.hasValue(newValue, 5) || ptr.key.hasValue(newValue, 6)))
+ (newValue.equals(ptr.key.getKeyValue(5))
+ || newValue.equals(ptr.key.getKeyValue(6))))
{
startSliding(ptr, dy);
}
@@ -424,7 +415,7 @@ public final class Pointers implements Handler.Callback
if (count == ptr.sliding_count)
return;
int key_index = (count < ptr.sliding_count) ? 5 : 6;
- KeyValue newValue = handleKV(ptr.key.keys[key_index], ptr.modifiers);
+ KeyValue newValue = _handler.modifyKey(ptr.key.keys[key_index], ptr.modifiers);
ptr.sliding_count = count;
ptr.value = newValue;
if (newValue != null)