diff options
| author | alotbsol555 | 2024-05-02 12:09:39 +0200 |
|---|---|---|
| committer | GitHub | 2024-05-02 12:09:39 +0200 |
| commit | 82e0840568655c8d71f2ac0c0ac5b1c18ef17845 (patch) | |
| tree | 9f08650461c6b867f75358a70c7e184193fe0034 /srcs/juloo.keyboard2 | |
| parent | c7ed2bcae915886b9d35bd19934f40816ef86b81 (diff) | |
| download | unexpected-keyboard-82e0840568655c8d71f2ac0c0ac5b1c18ef17845.tar.gz unexpected-keyboard-82e0840568655c8d71f2ac0c0ac5b1c18ef17845.zip | |
allow for <fn ...> in <modmap> (#626)
Diffstat (limited to 'srcs/juloo.keyboard2')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyModifier.java | 6 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 25 |
2 files changed, 27 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index 79531b2..3dc50a9 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -165,6 +165,12 @@ public final class KeyModifier private static KeyValue apply_fn(KeyValue k) { + if (_modmap != null) + { + KeyValue mapped = _modmap.fn.get(k); + if (mapped != null) + return mapped; + } String name = null; switch (k.getKind()) { diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index c8dcd13..25110ef 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -515,18 +515,35 @@ public final class KeyboardData public static class Modmap { public final Map<KeyValue, KeyValue> shift; + public final Map<KeyValue, KeyValue> fn; - public Modmap(Map<KeyValue, KeyValue> s) + public Modmap(Map<KeyValue, KeyValue> s, Map<KeyValue, KeyValue> f) { shift = s; + fn = f; } public static Modmap parse(XmlPullParser parser) throws Exception { HashMap<KeyValue, KeyValue> shift = new HashMap<KeyValue, KeyValue>(); - while (expect_tag(parser, "shift")) - parse_mapping(parser, shift); - return new Modmap(shift); + HashMap<KeyValue, KeyValue> fn = new HashMap<KeyValue, KeyValue>(); + + while (next_tag(parser)) + { + switch (parser.getName()) + { + case "shift": + parse_mapping(parser, shift); + break; + case "fn": + parse_mapping(parser, fn); + break; + default: + throw error(parser, "Expecting tag <shift> or <fn>, got <" + parser.getName() + ">"); + } + } + + return new Modmap(shift, fn); } private static void parse_mapping(XmlPullParser parser, Map<KeyValue, KeyValue> dst) throws Exception |
