diff options
| author | Jules Aguillon | 2021-05-08 02:00:47 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2021-05-08 02:00:47 +0200 |
| commit | 8fb89c5c715edbfc8aa5acd92444cadb17412efb (patch) | |
| tree | 728725f8a689430ff46327ff6000ca13e3ecff6b /srcs/juloo.keyboard2/KeyValue.java | |
| parent | 3fbc35135e924e67264b393875fe653c62d5aa31 (diff) | |
| download | unexpected-keyboard-8fb89c5c715edbfc8aa5acd92444cadb17412efb.tar.gz unexpected-keyboard-8fb89c5c715edbfc8aa5acd92444cadb17412efb.zip | |
Improve the numeric keyboard
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index b35021e..adf096f 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -39,9 +39,12 @@ class KeyValue public static final int FLAG_ACCENT4 = (1 << 19); // Tilde public static final int FLAG_ACCENT5 = (1 << 20); // Cédille public static final int FLAG_ACCENT6 = (1 << 21); // Tréma + public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22); + public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23); public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 | - FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6; + FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 | + FLAG_ACCENT_SUPERSCRIPT | FLAG_ACCENT_SUBSCRIPT; public final String name; public final String symbol; @@ -49,6 +52,12 @@ class KeyValue public final int eventCode; public final int flags; + /* Update the char and the symbol. */ + public KeyValue withCharAndSymbol(char c) + { + return withCharAndSymbol(String.valueOf(c), c); + } + public KeyValue withCharAndSymbol(String s, char c) { return new KeyValue(name, s, c, eventCode, flags); @@ -67,7 +76,12 @@ class KeyValue public static KeyValue getKeyByName(String name) { - return (KeyValue.keys.get(name)); + if (name == null) + return null; + KeyValue kv = KeyValue.keys.get(name); + if (kv != null) + return kv; + return new KeyValue(name, name, CHAR_NONE, EVENT_NONE, 0); } private static void addKey(String name, String symbol, char c, int event, int flags) @@ -117,6 +131,8 @@ class KeyValue addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4); addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5); addModifierKey("accent_trema", "◌̈", FLAG_ACCENT6); + addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT); + addModifierKey("subscript", "◌̺", FLAG_ACCENT_SUBSCRIPT); addModifierKey("fn", "Fn", FLAG_FN); addCharKey('a', KeyEvent.KEYCODE_A); |
