From ab987c776c7ddc0fab594f20f4ddf49d98848ccd Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 24 Jun 2022 20:26:27 +0200 Subject: 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. --- srcs/juloo.keyboard2/KeyValue.java | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'srcs/juloo.keyboard2/KeyValue.java') 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 -- cgit v1.2.3