abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2
diff options
context:
space:
mode:
authorJules Aguillon2024-02-12 23:36:32 +0100
committerJules Aguillon2024-02-17 23:28:31 +0100
commite9f734b6ccef1e827930aba8e9bf42acb4da1be2 (patch)
treeb68b2d2bfb89807e707f9433b6adbf124b3ce538 /srcs/juloo.keyboard2
parent63e7ac2e94bf9adafd0af6bcc9b5a790428d1ad1 (diff)
downloadunexpected-keyboard-e9f734b6ccef1e827930aba8e9bf42acb4da1be2.tar.gz
unexpected-keyboard-e9f734b6ccef1e827930aba8e9bf42acb4da1be2.zip
compose: Don't remove keys not in sequence
Keys that are not part of any possible sequences are now dimmed and still usable instead of being removed, which felt weird.
Diffstat (limited to 'srcs/juloo.keyboard2')
-rw-r--r--srcs/juloo.keyboard2/ComposeKey.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/srcs/juloo.keyboard2/ComposeKey.java b/srcs/juloo.keyboard2/ComposeKey.java
index 173fcd7..4a8cff7 100644
--- a/srcs/juloo.keyboard2/ComposeKey.java
+++ b/srcs/juloo.keyboard2/ComposeKey.java
@@ -10,15 +10,22 @@ public final class ComposeKey
{
switch (kv.getKind())
{
- case Char: return apply(state, kv.getChar());
+ case Char:
+ KeyValue res = apply(state, kv.getChar());
+ // Dim characters not part of any sequence instead of removing them.
+ if (res == null)
+ return kv.withFlags(kv.getFlags() | KeyValue.FLAG_SECONDARY);
+ return res;
/* These keys must not be removed. */
- case Event: return kv;
- case Modifier: return kv;
+ case Event:
+ case Modifier:
+ return kv;
/* These keys cannot be part of sequences. */
- case String: return null;
- case Keyevent: return null;
- case Editing: return null;
- case Placeholder: return null;
+ case String:
+ case Keyevent:
+ case Editing:
+ case Placeholder:
+ return kv.withFlags(kv.getFlags() | KeyValue.FLAG_SECONDARY);
case Compose_pending: return null;
}
return null;