From e025fddf2f0512a156399c886b61bb9160f9ee79 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 28 Jun 2023 18:02:01 +0200 Subject: [PATCH] Accept some escaped keys in custom layouts These symbols have special meaning when in `res/xml` and are escaped in standard layouts. The backslash is not stripped when parsed from the custom layout option. Treat these backslashed keys specifically to allow standard layouts to be passed back to the custom layout option. --- srcs/juloo.keyboard2/KeyValue.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 0904f2f..ed80f86 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -302,6 +302,14 @@ final class KeyValue { switch (name) { + /* These symbols have special meaning when in `res/xml` and are escaped in + standard layouts. The backslash is not stripped when parsed from the + custom layout option. */ + case "\\?": return fallbackMakeKey("?"); + case "\\#": return fallbackMakeKey("#"); + case "\\@": return fallbackMakeKey("@"); + case "\\\\": return fallbackMakeKey("\\"); + case "shift": return modifierKey(0x0A, Modifier.SHIFT, 0); case "ctrl": return modifierKey("Ctrl", Modifier.CTRL, 0); case "alt": return modifierKey("Alt", Modifier.ALT, 0);