Apply Shift then fallback to Fn

This changes both the round trip and the clockwise circle gestures to
first apply Shift and if that didn't change the key, fallback to Fn.

This allows to have letters in the corner of keys while being able to
shift them. Clockwise circle modify keys the same way as round trip for
the center key.

The anti-clockwise gesture now do nothing. It's intended to make it
configurable per-layout.
This commit is contained in:
Jules Aguillon 2024-05-25 01:20:15 +02:00
parent 8021a626c5
commit d03afb6e8f
2 changed files with 9 additions and 12 deletions

View File

@ -43,13 +43,14 @@ public final class Gesture
case Ended_swipe: case Ended_swipe:
return selected_val; return selected_val;
case Ended_center: case Ended_center:
return KeyModifier.modify_round_trip(selected_val); return KeyModifier.modify_gesture(selected_val);
case Rotating_clockwise: case Rotating_clockwise:
case Ended_clockwise: case Ended_clockwise:
return KeyModifier.modify_circle(key.keys[0], true); return KeyModifier.modify_gesture(key.keys[0]);
case Rotating_anticlockwise: case Rotating_anticlockwise:
case Ended_anticlockwise: case Ended_anticlockwise:
return KeyModifier.modify_circle(key.keys[0], false); // Unimplemented for now.
return key.keys[0];
} }
return null; // Unreachable return null; // Unreachable
} }

View File

@ -117,17 +117,13 @@ public final class KeyModifier
return k; 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); KeyValue shifted = apply_shift(k);
} if (shifted == null || shifted.equals(k))
public static KeyValue modify_circle(KeyValue k, boolean clockwise)
{
if (clockwise)
return apply_shift(k);
else
return apply_fn(k); return apply_fn(k);
return shifted;
} }
public static Map_char modify_numpad_script(String numpad_script) public static Map_char modify_numpad_script(String numpad_script)