abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2024-05-02 11:58:44 +0200
committerJules Aguillon2024-05-02 12:06:15 +0200
commitc7ed2bcae915886b9d35bd19934f40816ef86b81 (patch)
tree606273c353f9ea1162694e84da698e177041cfb4
parent5386541db3d088351df70064337dfaf1ce42eac5 (diff)
downloadunexpected-keyboard-c7ed2bcae915886b9d35bd19934f40816ef86b81.tar.gz
unexpected-keyboard-c7ed2bcae915886b9d35bd19934f40816ef86b81.zip
Clear cache when changing layout
Due to the modmap, the cache must be cleared when switching layout to or from a layout that contain a modmap. This is broken since 3f6b6fd23, which moves the modmap handling into KeyModifier.
-rw-r--r--srcs/juloo.keyboard2/KeyModifier.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java
index 377f54f..79531b2 100644
--- a/srcs/juloo.keyboard2/KeyModifier.java
+++ b/srcs/juloo.keyboard2/KeyModifier.java
@@ -13,7 +13,14 @@ public final class KeyModifier
/** The optional modmap takes priority over modifiers usual behaviors. Set to
[null] to disable. */
private static KeyboardData.Modmap _modmap = null;
- public static void set_modmap(KeyboardData.Modmap mm) { _modmap = mm; }
+ public static void set_modmap(KeyboardData.Modmap mm)
+ {
+ // Clear the cache when switching to or from a layout that contain a modmap
+ // as the cache would otherwise override the modmap.
+ if (_modmap != null || mm != null)
+ _cache.clear();
+ _modmap = mm;
+ }
/** Modify a key according to modifiers. */
public static KeyValue modify(KeyValue k, Pointers.Modifiers mods)