abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyValue.java
diff options
context:
space:
mode:
authorJules Aguillon2022-06-24 20:26:27 +0200
committerJules Aguillon2022-06-24 20:26:27 +0200
commitab987c776c7ddc0fab594f20f4ddf49d98848ccd (patch)
treeabf1c5cbeaecbb30bb67e57db6044117a7260a4a /srcs/juloo.keyboard2/KeyValue.java
parent6e5be63e25bf2ff2de5c9de5ccd4bc581c639155 (diff)
downloadunexpected-keyboard-ab987c776c7ddc0fab594f20f4ddf49d98848ccd.tar.gz
unexpected-keyboard-ab987c776c7ddc0fab594f20f4ddf49d98848ccd.zip
Fix localized key not in predefined position
The "loc " prefix for predefining a place for an "extra key" was broken since 31d6a70. The FLAG_LOCALIZED flag cannot be used anymore, as adding it to any key would turn it into a different key that wouldn't be recognized by parts of the code comparing the keys (placing the extra keys). Add an other layer in KeyboardData to store such informations.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java20
1 files changed, 1 insertions, 19 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 4009525..d786959 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -58,8 +58,6 @@ final class KeyValue
public static final int FLAG_SMALLER_FONT = (1 << 25);
// Used by [Pointers].
public static final int FLAG_LOCKED = (1 << 26);
- // Language specific keys that are removed from the keyboard by default.
- public static final int FLAG_LOCALIZED = (1 << 27);
// Kinds
public static final int KIND_CHAR = (0 << 29);
@@ -196,27 +194,11 @@ final class KeyValue
_code = kind | flags | value;
}
- private static String stripPrefix(String s, String prefix)
- {
- if (s.startsWith(prefix))
- return s.substring(prefix.length());
- else
- return null;
- }
-
public static KeyValue getKeyByName(String name)
{
- if (name == null)
- return null;
- KeyValue kv = KeyValue.keys.get(name);
+ KeyValue kv = keys.get(name);
if (kv != null)
return kv;
- String localized = stripPrefix(name, "loc ");
- if (localized != null)
- {
- kv = getKeyByName(localized);
- return kv.withFlags(kv.getFlags() | FLAG_LOCALIZED);
- }
if (name.length() == 1)
return new KeyValue(name, KIND_CHAR, name.charAt(0), 0);
else