From 8c290732607692cd94247f7e3e9c80fad1dfe516 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 11 Feb 2024 20:46:36 +0100 Subject: 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. --- srcs/juloo.keyboard2/KeyModifier.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'srcs/juloo.keyboard2/KeyModifier.java') diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index 51e7051..94f096b 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -10,6 +10,10 @@ public final class KeyModifier private static HashMap> _cache = new HashMap>(); + /** The current compose state. Whether a compose is pending is signaled by + the [COMPOSE_PENDING] modifier. */ + static int _compose_pending = -1; + /** Modify a key according to modifiers. */ public static KeyValue modify(KeyValue k, Pointers.Modifiers mods) { @@ -27,7 +31,11 @@ public final class KeyModifier ks.put(mods, r); } /* Keys with an empty string are placeholder keys. */ - return (r.getString().length() == 0) ? null : r; + if (r.getString().length() == 0) + return null; + if (mods.has(KeyValue.Modifier.COMPOSE_PENDING)) + r = ComposeKey.apply(_compose_pending, r); + return r; } public static KeyValue modify(KeyValue k, KeyValue.Modifier mod) @@ -99,6 +107,11 @@ public final class KeyModifier } } + public static void set_compose_pending(int state) + { + _compose_pending = state; + } + private static KeyValue apply_map_char(KeyValue k, Map_char map) { switch (k.getKind()) -- cgit v1.2.3