diff options
| author | Jules Aguillon | 2026-01-31 15:36:22 +0100 |
|---|---|---|
| committer | GitHub | 2026-01-31 15:36:22 +0100 |
| commit | b9072daaf62d5decb3377beeb281790a7512ae02 (patch) | |
| tree | 35f3f6d3b7ef5ab10e4ae340634880c06193e5b8 /srcs | |
| parent | 1b8506876a1d8cff876220a7b6610b7bbe9e8841 (diff) | |
| download | unexpected-keyboard-b9072daaf62d5decb3377beeb281790a7512ae02.tar.gz unexpected-keyboard-b9072daaf62d5decb3377beeb281790a7512ae02.zip | |
Avoid loops in modmaps (#1167)
It was possible to define a loop that would crash the app with the
following modmap:
<ctrl a="left" b="left:ctrl,left"/>
With this change, modmap are not taken into account while evaluating
macros. The modmap above modifies ctrl+left into ctrl+left.
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyEventHandler.java | 2 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyModifier.java | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java index 17c7d7b..a0487d7 100644 --- a/srcs/juloo.keyboard2/KeyEventHandler.java +++ b/srcs/juloo.keyboard2/KeyEventHandler.java @@ -420,7 +420,7 @@ public final class KeyEventHandler void evaluate_macro_loop(final KeyValue[] keys, int i, Pointers.Modifiers mods, final boolean autocap_paused) { boolean should_delay = false; - KeyValue kv = KeyModifier.modify(keys[i], mods); + KeyValue kv = KeyModifier.modify_no_modmap(keys[i], mods); if (kv != null) { if (kv.hasFlagsAny(KeyValue.FLAG_LATCH)) 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()) |
