abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2023-08-06 17:11:29 +0200
committerJules Aguillon2023-08-06 17:15:36 +0200
commit4d10556d4904086664f14ac3b900e65505a19fe7 (patch)
tree9bd6434f9fc333933c38329bfd6295107d983d9e
parent1eea9e25d25afa04f0f98618df07820d27c8fe2e (diff)
downloadunexpected-keyboard-4d10556d4904086664f14ac3b900e65505a19fe7.tar.gz
unexpected-keyboard-4d10556d4904086664f14ac3b900e65505a19fe7.zip
Don't replace user selected dead keys
Don't replace dead-keys selected in the "Add keys to the keyboard" option by an alternative.
-rw-r--r--srcs/juloo.keyboard2/Config.java4
-rw-r--r--srcs/juloo.keyboard2/ExtraKeys.java9
2 files changed, 8 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 8a81556..24565ab 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -182,6 +182,8 @@ final class Config
// first iteration then automatically added.
final Set<KeyValue> extra_keys = new HashSet<KeyValue>();
final Set<KeyValue> remove_keys = new HashSet<KeyValue>();
+ extra_keys.addAll(extra_keys_param);
+ extra_keys.addAll(extra_keys_custom);
if (extra_keys_subtype != null)
{
Set<KeyValue> present = new HashSet<KeyValue>();
@@ -191,8 +193,6 @@ final class Config
extra_keys_subtype.compute(extra_keys,
new ExtraKeys.Query(kw.script, present));
}
- extra_keys.addAll(extra_keys_param);
- extra_keys.addAll(extra_keys_custom);
boolean number_row = this.number_row && !show_numpad;
if (number_row)
KeyboardData.number_row.getKeys(remove_keys);
diff --git a/srcs/juloo.keyboard2/ExtraKeys.java b/srcs/juloo.keyboard2/ExtraKeys.java
index fb1f3e2..cfac362 100644
--- a/srcs/juloo.keyboard2/ExtraKeys.java
+++ b/srcs/juloo.keyboard2/ExtraKeys.java
@@ -20,7 +20,8 @@ class ExtraKeys
_ks = ks;
}
- /** Add the keys that should be added to the keyboard into [dst]. */
+ /** Add the keys that should be added to the keyboard into [dst]. Keys
+ already added to [dst] might have an impact, see [ExtraKey.compute]. */
public void compute(Set<KeyValue> dst, Query q)
{
for (ExtraKey k : _ks)
@@ -77,11 +78,13 @@ class ExtraKeys
// enforced to be complete by the merging step. The same [kv] will not
// appear again in the list of extra keys with a different list of
// alternatives.
- KeyValue k = (alternatives.size() == 1) ? alternatives.get(0) : kv;
+ // Selecting the dead key in the "Add key to the keyboard" option would
+ // disable this behavior for a key.
+ boolean use_alternative = (alternatives.size() == 1 && !dst.contains(kv));
if
((q.script == null || script == null || q.script.equals(script))
&& (alternatives.size() == 0 || !q.present.containsAll(alternatives)))
- dst.add(k);
+ dst.add(use_alternative ? alternatives.get(0) : kv);
}
/** Return a new key from two. [kv] are expected to be equal. [script] is