From b9072daaf62d5decb3377beeb281790a7512ae02 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 31 Jan 2026 15:36:22 +0100 Subject: Avoid loops in modmaps (#1167) It was possible to define a loop that would crash the app with the following modmap: With this change, modmap are not taken into account while evaluating macros. The modmap above modifies ctrl+left into ctrl+left.--- srcs/juloo.keyboard2/KeyModifier.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'srcs/juloo.keyboard2/KeyModifier.java') diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index 2ef5445..cf9af3b 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -29,6 +29,17 @@ public final class KeyModifier return r; } + /** Like [modify] but do not apply user modmaps. Used when evaluating macros + to avoid loops. */ + public static KeyValue modify_no_modmap(KeyValue k, Pointers.Modifiers mods) + { + Modmap saved = _modmap; + _modmap = null; + KeyValue r = modify(k, mods); + _modmap = saved; + return r; + } + public static KeyValue modify(KeyValue k, KeyValue mod) { switch (mod.getKind()) -- cgit v1.2.3