Skip to content

Commit e4a49d5

Browse files
committed
Move numpad script maps to the compose system
This removes the Map_char interface, which required a lot of boilerplate to use.
1 parent fe7906a commit e4a49d5

File tree

11 files changed

+121
-190
lines changed

11 files changed

+121
-190
lines changed

srcs/compose/numpad_bengali.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"0": "",
3+
"1": "",
4+
"2": "",
5+
"3": "",
6+
"4": "",
7+
"5": "",
8+
"6": "",
9+
"7": "",
10+
"8": "",
11+
"9": ""
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"0": "",
3+
"1": "",
4+
"2": "",
5+
"3": "",
6+
"4": "",
7+
"5": "",
8+
"6": "",
9+
"7": "",
10+
"8": "",
11+
"9": ""
12+
}

srcs/compose/numpad_gujarati.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"0": "",
3+
"1": "",
4+
"2": "",
5+
"3": "",
6+
"4": "",
7+
"5": "",
8+
"6": "",
9+
"7": "",
10+
"8": "",
11+
"9": ""
12+
}

srcs/compose/numpad_hindu.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Used with Arabic despite the name; called "Hindi numerals" in Arabic
2+
// numpad_devanagari is used in Hindi
3+
{
4+
"0": "٠",
5+
"1": "١",
6+
"2": "٢",
7+
"3": "٣",
8+
"4": "٤",
9+
"5": "٥",
10+
"6": "٦",
11+
"7": "٧",
12+
"8": "٨",
13+
"9": "٩"
14+
}

srcs/compose/numpad_kannada.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"0": "",
3+
"1": "",
4+
"2": "",
5+
"3": "",
6+
"4": "",
7+
"5": "",
8+
"6": "",
9+
"7": "",
10+
"8": "",
11+
"9": ""
12+
}

srcs/compose/numpad_persian.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"0": "۰",
3+
"1": "۱",
4+
"2": "۲",
5+
"3": "۳",
6+
"4": "۴",
7+
"5": "۵",
8+
"6": "۶",
9+
"7": "۷",
10+
"8": "۸",
11+
"9": "۹"
12+
}

srcs/juloo.keyboard2/ComposeKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static KeyValue apply(int state, KeyValue kv)
2727
}
2828

2929
/** Apply the pending compose sequence to char [c]. */
30-
static KeyValue apply(int prev, char c)
30+
public static KeyValue apply(int prev, char c)
3131
{
3232
char[] states = ComposeKeyData.states;
3333
char[] edges = ComposeKeyData.edges;

srcs/juloo.keyboard2/ComposeKeyData.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ public final class ComposeKeyData
112112
"\u203a\uFFFF\u0072\u0065\u006d\u006f\u0076\u0065\u0064\u2213\u2219\u03f4\u220f\u2211\u03d0\u0263\u03f5\u03d1\u03f0\u03d6\u03f1\u03c2\u03d2\u03d5\u0465\uFFFF\ua641\u0456\u0458\u046b\u0467\u047b\u0455\uFFFF\ua64b\u044c\uFFFF\ua651\u044a\u0454\u0438\uFFFF\ua66f\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0073\u0065\u0067\u006f\u006c\uFFFF\u0064\u0061\u0067\u0065\u0073\u0068\uFFFF\u0068\u006f\u006c\u0061\u006d\uFFFF\u0071\u0075\u0062" +
113113
"\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\u066e\u067e" +
114114
"\u06c1\u0698\u0640\u0636\u0638\u0621\u06a4\u063a\u06a9\u06ba\u06be\u06cc\u0643\u064a\u0900\u0955\u0972\u0911\u0973\u0974\u0976\u0977\u0960\u0961\u090d\u090e\u0912\u0975\u097b\u097c\uFFFF\u0936\u094d\u091a\u0979\u0978\u097e\uFFFF\u0924\u094d\u0930\uFFFF\u0926\u094d\u0930\uFFFF\u092a\u094d\u0930\u097f\u097a\uFFFF\u0936\u094d\u0930\uFFFF\u0915\u094d\u0937\u094e\u097d\u0949\u093a\u093b\u0904\u0944\u0945\u0946\u094a\u094f\u0954\u0957" +
115-
"\u0963\u0965\u0971\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u22c0\u22c1\u22c2\u22c3\u222e\u22b6\u044b\u0483\u0000\u00df\u0131\u01f0\u0237\u02b0\u02b2\u02b3\u02b7\u02e1\u0a85\u0a87\u0a89\u0a8f\u0a93\u0a95\u0a97\u0a9a\u0a9c\u0a9f\u0aa1\u0aa4\u0aa6\u0aa8\u0aaa\u0aac\u0aae\u0ab2\u0ab8\u0ab9\u0abf\u0ac1\u0ac7\u0acb\u1d43\u1d47\u1d48\u1d49\u1d4d\u1d4f\u1d50\u1d52\u1d56\u1d57\u1d58\u1d5b\u1d60\u1d9c\u1da0\u1dbe\u1e97\u1e98\u1e99\u2071\u207f" +
116-
"\u20b9\u2190\u2191\u2192\u2193\u2196\u2197\u2198\u2199\u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c\u2534\u253c\uFFFF\u004a\u030c\uFFFF\u004a\u0307\u1d34\u1d36\u1d3f\u1d42\u1d38\u0a86\u0a88\u0a8a\u0a90\u0a94\u0a96\u0a98\u0a9b\u0a9d\u0aa0\u0aa2\u0aa5\u0aa7\u0aa3\u0aab\u0aad\u0a82\u0ab3\u0ab6\u0a83\u0ac0\u0ac2\u0ac8\u0acc\u1d2c\u1d2e\u1d30\u1d31\u1d33\u1d37\u1d39\u1d3c\u1d3e\u1d40\u1d41\u2c7d\u1db2\uFFFF\ua7f2\uFFFF\ua7f3" +
117-
"\u1d23\uFFFF\u0054\u0308\uFFFF\u0057\u030a\uFFFF\u0059\u030a\u1d35\u1d3a\u2550\u2551\u2554\u2557\u255a\u255d\u2560\u2563\u2566\u2569\u256c").toCharArray();
115+
"\u0963\u0965\u0971\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u22c0\u22c1\u22c2\u22c3\u222e\u22b6\u044b\u0483\u00000123456789\u09e6\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u00000123456789\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u00000123456789\u0ae6\u0ae7" +
116+
"\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef\u00000123456789\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u00000123456789\u0ce6\u0ce7\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u00000123456789\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u0000" +
117+
"\u00df\u0131\u01f0\u0237\u02b0\u02b2\u02b3\u02b7\u02e1\u0a85\u0a87\u0a89\u0a8f\u0a93\u0a95\u0a97\u0a9a\u0a9c\u0a9f\u0aa1\u0aa4\u0aa6\u0aa8\u0aaa\u0aac\u0aae\u0ab2\u0ab8\u0ab9\u0abf\u0ac1\u0ac7\u0acb\u1d43\u1d47\u1d48\u1d49\u1d4d\u1d4f\u1d50\u1d52\u1d56\u1d57\u1d58\u1d5b\u1d60\u1d9c\u1da0\u1dbe\u1e97\u1e98\u1e99\u2071\u207f\u20b9\u2190\u2191\u2192\u2193\u2196\u2197\u2198\u2199\u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c" +
118+
"\u2534\u253c\uFFFF\u004a\u030c\uFFFF\u004a\u0307\u1d34\u1d36\u1d3f\u1d42\u1d38\u0a86\u0a88\u0a8a\u0a90\u0a94\u0a96\u0a98\u0a9b\u0a9d\u0aa0\u0aa2\u0aa5\u0aa7\u0aa3\u0aab\u0aad\u0a82\u0ab3\u0ab6\u0a83\u0ac0\u0ac2\u0ac8\u0acc\u1d2c\u1d2e\u1d30\u1d31\u1d33\u1d37\u1d39\u1d3c\u1d3e\u1d40\u1d41\u2c7d\u1db2\uFFFF\ua7f2\uFFFF\ua7f3\u1d23\uFFFF\u0054\u0308\uFFFF\u0057\u030a\uFFFF\u0059\u030a\u1d35\u1d3a\u2550\u2551\u2554\u2557\u255a\u255d" +
119+
"\u2560\u2563\u2566\u2569\u256c").toCharArray();
118120

119121
public static final char[] edges =
120122
("\u0001\u0036\u0037\u0038\u0039\u003a\u003b\u003c\u003f\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004a\u004b\u004c\u004d\u004e\u004f\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0059\u005a\u005b\\\u005d\u005e\u005f\u0060\u0061\u0062\u0063\u0064\u0067\u0068\u006b\u006e\u006f\u0072\u0075\u0078\u007b\u007e\u0081\u0001\u0001\u0001\u0001\u0001\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
@@ -224,9 +226,11 @@ public final class ComposeKeyData
224226
"\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\u0002\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0001\u0002\u0000\u0001\u0001\u0001\u0002\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
225227
"\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\u0001\u0001" +
226228
"\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\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
227-
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u004b\u0e75\u0e03\u1e74\u1e77\u1e7a\u1e7b\u1e7c\u1e7d\u1e7e\u1e7f\u1e80\u1e81\u1e82\u1e83\u1e84\u1e85\u1e86\u1e87\u1e88\u1e89\u1e8a\u1e8b\u1e8c\u1e8d\u1e8e\u1e8f\u1e90\u1e91\u1e92\u1e93\u1e94\u1e95\u1e96\u1e97\u1e98\u1e99\u1e9a\u1e9b\u1e9c\u1e9d\u1e9e\u1e9f\u1ea0\u1ea1\u1ea2\u1ea3\u1ea4\u1ea6\u1ea8\u1ea9\u1eac\u1eaf\u1eb2\u1eb3" +
228-
"\u0e66\u0d15\u0d21\u0d16\u0d24\u1e1d\u1e1e\u1e1f\u1e20\u1eb4\u1eb5\u1eb6\u1eb7\u1eb8\u1eb9\u1eba\u1ebb\u1ebc\u1ebd\u1ebe\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\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0002\u0000" +
229-
"\u0001\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001").toCharArray();
229+
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e34\u1e35\u1e36\u1e37\u1e38\u1e39\u1e3a\u1e3b\u1e3c\u1e3d\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e49\u1e4a\u1e4b\u1e4c\u1e4d\u1e4e\u1e4f\u1e50\u1e51\u1e52\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e5e\u1e5f\u1e60\u1e61\u1e62\u1e63\u1e64\u1e65\u1e66\u1e67\u0001\u0001" +
230+
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e73\u1e74\u1e75\u1e76\u1e77\u1e78\u1e79\u1e7a\u1e7b\u1e7c\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e88\u1e89\u1e8a\u1e8b\u1e8c\u1e8d\u1e8e\u1e8f\u1e90\u1e91\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1e9d\u1e9e\u1e9f\u1ea0\u1ea1\u1ea2\u1ea3\u1ea4\u1ea5\u1ea6\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u004b" +
231+
"\u0e75\u0e03\u1ef2\u1ef5\u1ef8\u1ef9\u1efa\u1efb\u1efc\u1efd\u1efe\u1eff\u1f00\u1f01\u1f02\u1f03\u1f04\u1f05\u1f06\u1f07\u1f08\u1f09\u1f0a\u1f0b\u1f0c\u1f0d\u1f0e\u1f0f\u1f10\u1f11\u1f12\u1f13\u1f14\u1f15\u1f16\u1f17\u1f18\u1f19\u1f1a\u1f1b\u1f1c\u1f1d\u1f1e\u1f1f\u1f20\u1f21\u1f22\u1f24\u1f26\u1f27\u1f2a\u1f2d\u1f30\u1f31\u0e66\u0d15\u0d21\u0d16\u0d24\u1e1d\u1e1e\u1e1f\u1e20\u1f32\u1f33\u1f34\u1f35\u1f36\u1f37\u1f38\u1f39\u1f3a" +
232+
"\u1f3b\u1f3c\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\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0002\u0000\u0001\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
233+
"\u0001\u0001\u0001\u0001\u0001").toCharArray();
230234

231235
public static final int accent_aigu = 1;
232236
public static final int accent_arrows = 130;
@@ -253,5 +257,11 @@ public final class ComposeKeyData
253257
public static final int accent_trema = 1172;
254258
public static final int compose = 1270;
255259
public static final int fn = 7207;
256-
public static final int shift = 7721;
260+
public static final int numpad_bengali = 7721;
261+
public static final int numpad_devanagari = 7742;
262+
public static final int numpad_gujarati = 7763;
263+
public static final int numpad_hindu = 7784;
264+
public static final int numpad_kannada = 7805;
265+
public static final int numpad_persian = 7826;
266+
public static final int shift = 7847;
257267
}

srcs/juloo.keyboard2/Config.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public KeyValue apply(KeyValue key, boolean localized)
319319
public KeyboardData modify_numpad(KeyboardData kw, KeyboardData main_kw)
320320
{
321321
final KeyValue action_key = action_key();
322-
final KeyModifier.Map_char map_digit = KeyModifier.modify_numpad_script(main_kw.numpad_script);
322+
final int map_digit = KeyModifier.modify_numpad_script(main_kw.numpad_script);
323323
return kw.mapKeys(new KeyboardData.MapKeyValues() {
324324
public KeyValue apply(KeyValue key, boolean localized)
325325
{
@@ -345,9 +345,9 @@ public KeyValue apply(KeyValue key, boolean localized)
345345
char c = prev_c;
346346
if (inverse_numpad)
347347
c = inverse_numpad_char(c);
348-
String modified = map_digit.apply(c);
348+
KeyValue modified = ComposeKey.apply(map_digit, c);
349349
if (modified != null) // Was modified by script
350-
return KeyValue.makeStringKey(modified);
350+
return modified;
351351
if (prev_c != c) // Was inverted
352352
return key.withChar(c);
353353
break;
@@ -359,16 +359,16 @@ public KeyValue apply(KeyValue key, boolean localized)
359359

360360
static KeyboardData.MapKeyValues numpad_script_map(String numpad_script)
361361
{
362-
final KeyModifier.Map_char map_digit = KeyModifier.modify_numpad_script(numpad_script);
362+
final int map_digit = KeyModifier.modify_numpad_script(numpad_script);
363363
return new KeyboardData.MapKeyValues() {
364364
public KeyValue apply(KeyValue key, boolean localized)
365365
{
366366
switch (key.getKind())
367367
{
368368
case Char:
369-
String modified = map_digit.apply(key.getChar());
369+
KeyValue modified = ComposeKey.apply(map_digit, key.getChar());
370370
if (modified != null)
371-
return KeyValue.makeStringKey(modified);
371+
return modified;
372372
break;
373373
}
374374
return key;

0 commit comments

Comments
 (0)