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.
This commit is contained in:
Jules Aguillon 2024-05-02 11:58:44 +02:00
parent 5386541db3
commit c7ed2bcae9

View File

@ -13,7 +13,14 @@ public final class KeyModifier
/** The optional modmap takes priority over modifiers usual behaviors. Set to /** The optional modmap takes priority over modifiers usual behaviors. Set to
[null] to disable. */ [null] to disable. */
private static KeyboardData.Modmap _modmap = null; 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. */ /** Modify a key according to modifiers. */
public static KeyValue modify(KeyValue k, Pointers.Modifiers mods) public static KeyValue modify(KeyValue k, Pointers.Modifiers mods)