diff options
| author | Jules Aguillon | 2023-09-03 23:38:55 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-09-03 23:38:55 +0200 |
| commit | 687d88f4f767190d2d60fe104a140381b6652d18 (patch) | |
| tree | e1826612c41d8e620e3b7869258366532018d925 /srcs/juloo.keyboard2/Config.java | |
| parent | b079e5cf436ccd4ef83ee00031b0955b1595ef1a (diff) | |
| download | unexpected-keyboard-687d88f4f767190d2d60fe104a140381b6652d18.tar.gz unexpected-keyboard-687d88f4f767190d2d60fe104a140381b6652d18.zip | |
Per-script numpad
The numeric layout and the optional right hand side numpad are modified
to show the digits belonging to the script used in the current layout.
The numpads are still defined as it was before. The digits are changed
in `modify_numpad` if needed.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 8900656..30be772 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -242,7 +242,7 @@ final class Config } }); if (show_numpad) - kw = kw.addNumPad(modify_numpad(KeyboardData.num_pad)); + kw = kw.addNumPad(modify_numpad(KeyboardData.num_pad, kw.script)); if (number_row) kw = kw.addNumberRow(); if (extra_keys.size() > 0) @@ -253,9 +253,10 @@ final class Config /** * Handle the numpad layout. */ - public KeyboardData modify_numpad(KeyboardData kw) + public KeyboardData modify_numpad(KeyboardData kw, String script) { final KeyValue action_key = action_key(); + final KeyModifier.Map_char map_digit = KeyModifier.modify_numpad_script(script); return kw.mapKeys(new KeyboardData.MapKeyValues() { public KeyValue apply(KeyValue key, boolean localized) { @@ -277,11 +278,15 @@ final class Config } break; case Char: - char a = key.getChar(), b = a; + char prev_c = key.getChar(); + char c = prev_c; if (inverse_numpad) - b = inverse_numpad_char(a); - if (a != b) - return key.withChar(b); + c = inverse_numpad_char(c); + String modified = map_digit.apply(c); + if (modified != null) // Was modified by script + return key.withSymbol(modified); + if (prev_c != c) // Was inverted + return key.withChar(c); break; } return key; |
