abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2024-09-10 22:50:39 +0200
committerJules Aguillon2024-09-10 22:50:39 +0200
commita8e331c3222dc7f84b823e1a53e3e6fe22839210 (patch)
treea9385e1ed56914b17c2f0264bb6f436ae807da28
parentb600332595cdf7cf36e48e2bf185ef4d96ae146e (diff)
downloadunexpected-keyboard-a8e331c3222dc7f84b823e1a53e3e6fe22839210.tar.gz
unexpected-keyboard-a8e331c3222dc7f84b823e1a53e3e6fe22839210.zip
Define the Shift modifier using the compose mechanism
-rw-r--r--srcs/compose/shift.json52
-rw-r--r--srcs/juloo.keyboard2/ComposeKeyData.java7
-rw-r--r--srcs/juloo.keyboard2/KeyModifier.java65
3 files changed, 61 insertions, 63 deletions
diff --git a/srcs/compose/shift.json b/srcs/compose/shift.json
new file mode 100644
index 0000000..3c52024
--- /dev/null
+++ b/srcs/compose/shift.json
@@ -0,0 +1,52 @@
+{
+ "↙": "⇙",
+ "↓": "⇓",
+ "↘": "⇘",
+ "←": "⇐",
+ "→": "⇒",
+ "↖": "⇖",
+ "↑": "⇑",
+ "↗": "⇗",
+ "└": "╚",
+ "┴": "╩",
+ "┘": "╝",
+ "├": "╠",
+ "┼": "╬",
+ "┤": "╣",
+ "┌": "╔",
+ "┬": "╦",
+ "┐": "╗",
+ "─": "═",
+ "│": "║",
+ "ß": "ẞ",
+ // In Turkish, upper case of 'iı' is 'İI' but Java's toUpperCase will
+ // return 'II'. To make 'İ' accessible, make it the shift of 'ı'. This
+ // has the inconvenient of swapping i and ı on the keyboard.
+ "ı": "İ",
+ "₹": "₨",
+ // Gujarati alternate characters
+ "અ": "આ",
+ "ઇ": "ઈ",
+ "િ": "ી",
+ "ઉ": "ઊ",
+ "ુ": "ૂ",
+ "એ": "ઐ",
+ "ે": "ૈ",
+ "ઓ": "ઔ",
+ "ો": "ૌ",
+ "ક": "ખ",
+ "ગ": "ઘ",
+ "ચ": "છ",
+ "જ": "ઝ",
+ "ટ": "ઠ",
+ "ડ": "ઢ",
+ "ન": "ણ",
+ "ત": "થ",
+ "દ": "ધ",
+ "પ": "ફ",
+ "બ": "ભ",
+ "મ": "ં",
+ "લ": "ળ",
+ "સ": "શ",
+ "હ": "ઃ"
+}
diff --git a/srcs/juloo.keyboard2/ComposeKeyData.java b/srcs/juloo.keyboard2/ComposeKeyData.java
index 9994e51..db78085 100644
--- a/srcs/juloo.keyboard2/ComposeKeyData.java
+++ b/srcs/juloo.keyboard2/ComposeKeyData.java
@@ -115,7 +115,8 @@ public final class ComposeKeyData
"\u0062\u0075\u0074\u0073\uFFFF\u0068\u0069\u0072\u0069\u0071\uFFFF\u0072\u0061\u0066\u0065\uFFFF\u0073\u0065\u0067\u006f\u006c\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0070\u0061\u0074\u0061\u0068\uFFFF\u0070\u0061\u0074\u0061\u0068\uFFFF\u0074\u0073\u0065\u0072\u0065\uFFFF\u0071\u0061\u006d\u0061\u0074\u0073\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0071\u0061\u006d\u0061\u0074\u0073\uFFFF\u0073\u0068\u0065\u0076\u0061\uFFFF" +
"\u0066\u0031\u0030\uFFFF\u0066\u0031\uFFFF\u0066\u0032\uFFFF\u0066\u0033\uFFFF\u0066\u0034\uFFFF\u0066\u0035\uFFFF\u0066\u0036\uFFFF\u0066\u0037\uFFFF\u0066\u0038\uFFFF\u0066\u0039\uFFFF\u0066\u0031\u0030\uFFFF\u0066\u0031\uFFFF\u0066\u0032\uFFFF\u0066\u0033\uFFFF\u0066\u0034\uFFFF\u0066\u0035\uFFFF\u0066\u0036\uFFFF\u0066\u0037\uFFFF\u0066\u0038\uFFFF\u0066\u0039\u0900\u0955\u0972\u0911\u0973\u0974\u0976\u0977\u0960\u0961\u090d" +
"\u090e\u0912\u0975\u0958\u0959\u095a\u097b\u097c\uFFFF\u0936\u094d\u091a\u095b\u0979\u0978\u095c\u095d\u097e\uFFFF\u0924\u094d\u0930\uFFFF\u0926\u094d\u0930\u0929\uFFFF\u092a\u094d\u0930\u095e\u097f\u095f\u0931\u0934\u097a\uFFFF\u0936\u094d\u0930\uFFFF\u0915\u094d\u0937\u094e\u097d\u0949\u093a\u093b\u0904\u0944\u0945\u0946\u094a\u094f\u0954\u0957\u0963\u0965\u0971\u2021\uFFFF\u0072\u0065\u006d\u006f\u0076\u0065\u0064\u20a8\u21d0" +
- "\u21d1\u21d2\u21d3\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u2204\u2209\u22c0\u22c1\u22c2\u22c3\u222e\u2286\u2287\u22b6").toCharArray();
+ "\u21d1\u21d2\u21d3\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u2204\u2209\u22c0\u22c1\u22c2\u22c3\u222e\u2286\u2287\u22b6\u0000\u00df\u0131\u0a85\u0a87\u0a89\u0a8f\u0a93\u0a95\u0a97\u0a9a\u0a9c\u0a9f\u0aa1\u0aa4\u0aa6\u0aa8\u0aaa\u0aac\u0aae\u0ab2\u0ab8\u0ab9\u0abf\u0ac1\u0ac7\u0acb\u20b9\u2190\u2191\u2192\u2193\u2196\u2197\u2198\u2199\u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c\u2534\u253c\u1e9e\u0130\u0a86\u0a88\u0a8a\u0a90" +
+ "\u0a94\u0a96\u0a98\u0a9b\u0a9d\u0aa0\u0aa2\u0aa5\u0aa7\u0aa3\u0aab\u0aad\u0a82\u0ab3\u0ab6\u0a83\u0ac0\u0ac2\u0ac8\u0acc\u20a8\u21d0\u21d1\u21d2\u21d3\u21d6\u21d7\u21d8\u21d9\u2550\u2551\u2554\u2557\u255a\u255d\u2560\u2563\u2566\u2569\u256c").toCharArray();
public static final char[] edges =
("\u0001\u0018\u0019\u001a\u001b\u001c\u001d\u0020\u0021\"\u0023\u0024\u0025\u0026\u0027\u0028\u0029\u002c\u002f\u0032\u0035\u0038\u003b\u003e\u0041\u0001\u0001\u0001\u0001\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u000c\u0050\u0051\u0052" +
@@ -228,7 +229,8 @@ public final class ComposeKeyData
"\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\r\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0004" +
"\u0000\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0004\u0000\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0001" +
- "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001").toCharArray();
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u002f\u1f32\u1f33\u1f34\u1f35\u1f36\u1f37\u1f38\u1f39\u1f3a\u1f3b\u1f3c\u1f3d\u1f3e\u1f3f\u1f40\u1f41\u1f42\u1f43\u1f44\u1f45\u1f46\u1f47\u1f48\u1f49\u1f4a\u1f4b\u1f4c\u1f4d\u1f4e\u1f4f\u1f50\u1f51\u1f52\u1f53\u1f54\u1f55\u1f56\u1f57\u1f58\u1f59\u1f5a\u1f5b\u1f5c\u1f5d\u1f5e\u1f5f\u0001\u0001\u0001\u0001\u0001\u0001" +
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001").toCharArray();
public static final int accent_aigu = 1;
public static final int accent_arrows = 68;
@@ -254,4 +256,5 @@ public final class ComposeKeyData
public static final int accent_trema = 658;
public static final int compose = 671;
public static final int fn = 7411;
+ public static final int shift = 7939;
}
diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java
index d8ea965..ba230dc 100644
--- a/srcs/juloo.keyboard2/KeyModifier.java
+++ b/srcs/juloo.keyboard2/KeyModifier.java
@@ -182,9 +182,10 @@ public final class KeyModifier
{
case Char:
char kc = k.getChar();
- char c = map_char_shift(kc);
- if (kc == c)
- c = Character.toUpperCase(kc);
+ KeyValue r = ComposeKey.apply(ComposeKeyData.shift, kc);
+ if (r != null)
+ return r;
+ char c = Character.toUpperCase(kc);
return (kc == c) ? k : k.withChar(c);
case String:
String s = Utils.capitalize_string(k.getString());
@@ -366,64 +367,6 @@ public final class KeyModifier
public String apply(char _c) { return null; }
};
- private static char map_char_shift(char c)
- {
- switch (c)
- {
- case '↙': return '⇙';
- case '↓': return '⇓';
- case '↘': return '⇘';
- case '←': return '⇐';
- case '→': return '⇒';
- case '↖': return '⇖';
- case '↑': return '⇑';
- case '↗': return '⇗';
- case '└': return '╚';
- case '┴': return '╩';
- case '┘': return '╝';
- case '├': return '╠';
- case '┼': return '╬';
- case '┤': return '╣';
- case '┌': return '╔';
- case '┬': return '╦';
- case '┐': return '╗';
- case '─': return '═';
- case '│': return '║';
- case 'ß': return 'ẞ';
- /* In Turkish, upper case of 'iı' is 'İI' but Java's toUpperCase will
- return 'II'. To make 'İ' accessible, make it the shift of 'ı'. This
- has the inconvenient of swapping i and ı on the keyboard. */
- case 'ı': return 'İ';
- case '₹': return '₨';
- // Gujarati alternate characters
- case 'અ': return 'આ';
- case 'ઇ': return 'ઈ';
- case 'િ': return 'ી';
- case 'ઉ': return 'ઊ';
- case 'ુ': return 'ૂ';
- case 'એ': return 'ઐ';
- case 'ે': return 'ૈ';
- case 'ઓ': return 'ઔ';
- case 'ો': return 'ૌ';
- case 'ક': return 'ખ';
- case 'ગ': return 'ઘ';
- case 'ચ': return 'છ';
- case 'જ': return 'ઝ';
- case 'ટ': return 'ઠ';
- case 'ડ': return 'ઢ';
- case 'ન': return 'ણ';
- case 'ત': return 'થ';
- case 'દ': return 'ધ';
- case 'પ': return 'ફ';
- case 'બ': return 'ભ';
- case 'મ': return 'ં';
- case 'લ': return 'ળ';
- case 'સ': return 'શ';
- case 'હ': return 'ઃ';
- default: return c;
- }
- }
-
private static final Map_char map_char_arrow_right =
new Map_char() {
public String apply(char c)