diff options
| author | Jules Aguillon | 2024-02-11 20:46:36 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-02-17 23:28:31 +0100 |
| commit | 8c290732607692cd94247f7e3e9c80fad1dfe516 (patch) | |
| tree | 1903ef13cc72626d0b12c712f9d15aede6fc67b4 /srcs/juloo.keyboard2/KeyValue.java | |
| parent | 38deb810f94d0e2fea91add4cd53fdd615d19d64 (diff) | |
| download | unexpected-keyboard-8c290732607692cd94247f7e3e9c80fad1dfe516.tar.gz unexpected-keyboard-8c290732607692cd94247f7e3e9c80fad1dfe516.zip | |
Compose key
The COMPOSE_PENDING modifier indicate whether a compose sequence is in
progress. The new key of kind Compose_pending sets the current state of
the sequence.
The compose sequences are compiled into a state machine by a python
script into a compact encoding.
The state of the pending compose is determined by the index of a state.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index dbd9e3e..e60e554 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -26,6 +26,7 @@ public final class KeyValue // Must be evaluated in the reverse order of their values. public static enum Modifier { + COMPOSE_PENDING, SHIFT, CTRL, ALT, @@ -88,7 +89,8 @@ public final class KeyValue public static enum Kind { - Char, String, Keyevent, Event, Modifier, Editing, Placeholder + Char, String, Keyevent, Event, Modifier, Editing, Placeholder, + Compose_pending } // Behavior flags. @@ -172,11 +174,18 @@ public final class KeyValue return Editing.values()[(_code & VALUE_BITS)]; } + /** Defined only when [getKind() == Kind.Placeholder]. */ public Placeholder getPlaceholder() { return Placeholder.values()[(_code & VALUE_BITS)]; } + /** Defined only when [getKind() == Kind.Compose_pending]. */ + public int getPendingCompose() + { + return (_code & VALUE_BITS); + } + /* Update the char and the symbol. */ public KeyValue withChar(char c) { @@ -303,6 +312,17 @@ public final class KeyValue return makeStringKey(str, 0); } + public static KeyValue makeCharKey(char c) + { + return new KeyValue(String.valueOf(c), Kind.Char, c, 0); + } + + public static KeyValue makeComposePending(String symbol, int state, int flags) + { + return new KeyValue(symbol, Kind.Compose_pending, state, + flags | FLAG_SPECIAL); + } + /** Make a key that types a string. A char key is returned for a string of length 1. */ public static KeyValue makeStringKey(String str, int flags) @@ -464,6 +484,9 @@ public final class KeyValue case "textAssist": return editingKey(0xE038, Editing.ASSIST); case "autofill": return editingKey("auto", Editing.AUTOFILL); + /* The compose key */ + case "compose": return modifierKey("comp", Modifier.COMPOSE_PENDING, FLAG_SECONDARY); + /* Placeholder keys */ case "removed": return placeholderKey(Placeholder.REMOVED); case "f11_placeholder": return placeholderKey(Placeholder.F11); |
