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/Config.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'srcs/juloo.keyboard2/Config.java') diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 2c68c92..e02868a 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -160,15 +160,12 @@ final class Config // first iteration then automatically added. final Set extra_keys = new HashSet(this.extra_keys); KeyboardData kw = original_kw.mapKeys(new KeyboardData.MapKeyValues() { - public KeyValue apply(KeyValue key) + public KeyValue apply(KeyValue key, boolean localized) { - if (key == null) - return null; boolean is_extra_key = extra_keys.contains(key); if (is_extra_key) extra_keys.remove(key); - int flags = key.getFlags(); - if ((flags & KeyValue.FLAG_LOCALIZED) != 0 && !is_extra_key) + if (localized && !is_extra_key) return null; switch (key.getKind()) { @@ -193,7 +190,7 @@ final class Config break; case Modifier: if (lockable_modifiers.contains(key.getModifier())) - return key.withFlags(flags | KeyValue.FLAG_LOCK); + return key.withFlags(key.getFlags() | KeyValue.FLAG_LOCK); break; } return key; -- cgit v1.2.3