diff options
| author | Jules Aguillon | 2025-01-03 12:33:48 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2025-01-03 12:33:48 +0100 |
| commit | 11c9bd850b1d1d629b988bfab5e7cc515a495bee (patch) | |
| tree | 4e5bd6858cdd295f6e3cd9b048306d80533b9d21 /srcs/juloo.keyboard2/LayoutModifier.java | |
| parent | b120fa8f09c3466ec5ddbc8fc7c68b2d8303e5ac (diff) | |
| download | unexpected-keyboard-11c9bd850b1d1d629b988bfab5e7cc515a495bee.tar.gz unexpected-keyboard-11c9bd850b1d1d629b988bfab5e7cc515a495bee.zip | |
Remove numpad keys from the main layout
When the numpad is visible, remove the digits and arithmetic symbols
from the main layout. Similarly to when the number row is added.
Diffstat (limited to 'srcs/juloo.keyboard2/LayoutModifier.java')
| -rw-r--r-- | srcs/juloo.keyboard2/LayoutModifier.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/LayoutModifier.java b/srcs/juloo.keyboard2/LayoutModifier.java index bda86c8..7220634 100644 --- a/srcs/juloo.keyboard2/LayoutModifier.java +++ b/srcs/juloo.keyboard2/LayoutModifier.java @@ -33,12 +33,20 @@ public final class LayoutModifier extra_keys.put(KeyValue.getKeyByName("config"), KeyboardData.PreferredPos.ANYWHERE); extra_keys.putAll(globalConfig.extra_keys_param); extra_keys.putAll(globalConfig.extra_keys_custom); - // The number row is added after the modification pass to avoid adding extra keys to it. + // Number row and numpads are added after the modification pass to allow + // removing the number keys from the main layout. KeyboardData.Row added_number_row = null; - if (globalConfig.add_number_row && !globalConfig.show_numpad) + KeyboardData added_numpad = null; + if (globalConfig.show_numpad) + { + added_numpad = modify_numpad(num_pad, kw); + remove_keys.addAll(added_numpad.getKeys().keySet()); + } + else if (globalConfig.add_number_row) // The numpad removes the number row + { added_number_row = modify_number_row(number_row, kw); - if (added_number_row != null) remove_keys.addAll(added_number_row.getKeys(0).keySet()); + } // Add the bottom row before computing the extra keys if (kw.bottom_row) kw = kw.insert_row(bottom_row, kw.rows.size()); @@ -64,12 +72,13 @@ public final class LayoutModifier return modify_key(key); } }); - if (globalConfig.show_numpad) - kw = kw.addNumPad(modify_numpad(num_pad, kw)); + if (added_numpad != null) + kw = kw.addNumPad(added_numpad); // Add extra keys that are not on the layout (including 'loc' keys) extra_keys_keyset.removeAll(kw_keys); if (extra_keys.size() > 0) kw = kw.addExtraKeys(extra_keys.entrySet().iterator()); + // Avoid adding extra keys to the number row if (added_number_row != null) kw = kw.insert_row(added_number_row, 0); return kw; |
