From a8e331c3222dc7f84b823e1a53e3e6fe22839210 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 10 Sep 2024 22:50:39 +0200 Subject: [PATCH] Define the Shift modifier using the compose mechanism --- srcs/compose/shift.json | 52 ++++++++++++++++++ srcs/juloo.keyboard2/ComposeKeyData.java | Bin 87713 -> 88887 bytes srcs/juloo.keyboard2/KeyModifier.java | 65 ++--------------------- 3 files changed, 56 insertions(+), 61 deletions(-) create mode 100644 srcs/compose/shift.json 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 9994e512ed2edc06dac16d569e3fe6c49fc2cf22..db78085220bab3f24f943a0ed0fe0887c4b440e6 100644 GIT binary patch delta 843 zcmXAmu}U3L5QY&H!mUzRh&GE!BR2Q!Idk1ZkoXK1R+ogc=eopBP)pg;!g7UMr;dR@ zAXYv?9>T}4^PAr-z8z*}|9@uo=kKkje_Ma-VO-wKd7P^Oh8SS!Ogs{^=+%;=sA^U< z7iFrbo+5>kJX028C#tikvz&XTZHGc8Xg+Rh z^HxNzwV+JEk{C6pe5*{WI4X|B;XJ#2h`x5|G-9V2y7y(~`_193;o0|wtWC1oaX2559AqEJ zXAo(~Ob`i(4P-;;cO4>@kn2MJWEc|mkP)Hulk}7Hlk}78k3*6{l0lL|l0lL|l0lL| zl0lMz-yjTr11JNNf!~9S3``67ZOBO9r0;hkBmHfYfgg>O3~ZQQ)}N=#$JZxLb-lU% Xbhfek@#@FLaNQg?M>*y%v)kDl=I9By delta 23 fcmdnKjdkH#)(xgpHs?(Hws-r?Fvb!Vrdloli#-ZY 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)