abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyValue.java
diff options
context:
space:
mode:
authorJules Aguillon2024-02-17 19:31:52 +0100
committerJules Aguillon2024-02-17 23:28:31 +0100
commit146d5203254aff5fe19b502a922c60a84c31686a (patch)
treec42662fbb6cb0e849694ce44be448ef2b1e1cadf /srcs/juloo.keyboard2/KeyValue.java
parent065d9520e571eccca21e28d0e4003ebd4b7079f4 (diff)
downloadunexpected-keyboard-146d5203254aff5fe19b502a922c60a84c31686a.tar.gz
unexpected-keyboard-146d5203254aff5fe19b502a922c60a84c31686a.zip
compose: Grey out keys that are not in sequence
Keys that are not in the pending compose sequence are greyed out with the new 'FLAG_GREYED' flag.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 4ccb9d3..1a0ed73 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -101,7 +101,9 @@ public final class KeyValue
public static final int FLAG_LOCK = (1 << FLAGS_OFFSET << 1);
// Special keys are not repeated and don't clear latched modifiers.
public static final int FLAG_SPECIAL = (1 << FLAGS_OFFSET << 2);
- // Free flag: (1 << FLAGS_OFFSET << 3);
+ // Whether the symbol should be greyed out. For example, keys that are not
+ // part of the pending compose sequence.
+ public static final int FLAG_GREYED = (1 << FLAGS_OFFSET << 3);
// Rendering flags.
public static final int FLAG_KEY_FONT = (1 << FLAGS_OFFSET << 4); // special font file
public static final int FLAG_SMALLER_FONT = (1 << FLAGS_OFFSET << 5); // 25% smaller symbols
@@ -112,8 +114,8 @@ public final class KeyValue
// Ranges for the different components
private static final int FLAGS_BITS =
- FLAG_LATCH | FLAG_LOCK | FLAG_SPECIAL | FLAG_KEY_FONT | FLAG_SMALLER_FONT |
- FLAG_SECONDARY | FLAG_LOCKED | FLAG_FAKE_PTR;
+ FLAG_LATCH | FLAG_LOCK | FLAG_SPECIAL | FLAG_GREYED | FLAG_KEY_FONT |
+ FLAG_SMALLER_FONT | FLAG_SECONDARY | FLAG_LOCKED | FLAG_FAKE_PTR;
private static final int KIND_BITS = (0b1111 << KIND_OFFSET); // 4 bits wide
private static final int VALUE_BITS = ~(FLAGS_BITS | KIND_BITS); // 20 bits wide
@@ -140,9 +142,9 @@ public final class KeyValue
return (_code & FLAGS_BITS);
}
- public boolean hasFlags(int has)
+ public boolean hasFlagsAny(int has)
{
- return ((_code & has) == has);
+ return ((_code & has) != 0);
}
/** The string to render on the keyboard.