diff --git a/srcs/juloo.keyboard2/Gesture.java b/srcs/juloo.keyboard2/Gesture.java index 1fbbb5f..073a6b5 100644 --- a/srcs/juloo.keyboard2/Gesture.java +++ b/srcs/juloo.keyboard2/Gesture.java @@ -43,13 +43,14 @@ public final class Gesture case Ended_swipe: return selected_val; case Ended_center: - return KeyModifier.modify_round_trip(selected_val); + return KeyModifier.modify_gesture(selected_val); case Rotating_clockwise: case Ended_clockwise: - return KeyModifier.modify_circle(key.keys[0], true); + return KeyModifier.modify_gesture(key.keys[0]); case Rotating_anticlockwise: case Ended_anticlockwise: - return KeyModifier.modify_circle(key.keys[0], false); + // Unimplemented for now. + return key.keys[0]; } return null; // Unreachable } diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index 8e6a983..e869e9f 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -117,17 +117,13 @@ public final class KeyModifier return k; } - public static KeyValue modify_round_trip(KeyValue k) + /** Modify a key affected by a round-trip or a clockwise circle gesture. */ + public static KeyValue modify_gesture(KeyValue k) { - return apply_fn(k); - } - - public static KeyValue modify_circle(KeyValue k, boolean clockwise) - { - if (clockwise) - return apply_shift(k); - else + KeyValue shifted = apply_shift(k); + if (shifted == null || shifted.equals(k)) return apply_fn(k); + return shifted; } public static Map_char modify_numpad_script(String numpad_script)