diff options
| author | Jules Aguillon | 2026-02-19 00:35:14 +0100 |
|---|---|---|
| committer | GitHub | 2026-02-19 00:35:14 +0100 |
| commit | ebf80415d8034d853bd79ba7cfb578db67862529 (patch) | |
| tree | 6c437e8130edace1fb1efc03b7a79dc1e5214b57 /srcs/juloo.keyboard2/LayoutModifier.java | |
| parent | 1cd252f8fa7b7b776c8b86f0c4e4357c46b5693b (diff) | |
| download | unexpected-keyboard-ebf80415d8034d853bd79ba7cfb578db67862529.tar.gz unexpected-keyboard-ebf80415d8034d853bd79ba7cfb578db67862529.zip | |
Refactor: KeyValue constants (#1180)
* Refactor: KeyValue constants
Add constants for keys that are accessed from the app's code. This
simplifies the fake pointer handling in Keyboard2View.
* Refactor: Pre-compute action key replacement
The action key and the enter swap are pre-computed in EditorConfig. This
simplifies the code.
Diffstat (limited to 'srcs/juloo.keyboard2/LayoutModifier.java')
| -rw-r--r-- | srcs/juloo.keyboard2/LayoutModifier.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/srcs/juloo.keyboard2/LayoutModifier.java b/srcs/juloo.keyboard2/LayoutModifier.java index 4a79314..163ff4e 100644 --- a/srcs/juloo.keyboard2/LayoutModifier.java +++ b/srcs/juloo.keyboard2/LayoutModifier.java @@ -31,7 +31,7 @@ public final class LayoutModifier final Set<KeyValue> remove_keys = new HashSet<KeyValue>(); // Make sure the config key is accessible to avoid being locked in a custom // layout. - extra_keys.put(KeyValue.getKeyByName("config"), KeyboardData.PreferredPos.ANYWHERE); + extra_keys.put(KeyValue.CONFIG, KeyboardData.PreferredPos.ANYWHERE); extra_keys.putAll(globalConfig.extra_keys_param); extra_keys.putAll(globalConfig.extra_keys_custom); // Number row and numpads are added after the modification pass to allow @@ -158,12 +158,7 @@ public final class LayoutModifier case CHANGE_METHOD_PICKER: return globalConfig.change_method_key_replacement; case ACTION: - String action_label = ec.actionLabel; - if (action_label == null) - return null; // Remove the action key - if (ec.swapEnterActionKey) - return KeyValue.getKeyByName("enter"); - return KeyValue.makeActionKey(action_label); + return ec.action_key_replacement; case SWITCH_FORWARD: return (globalConfig.layouts.size() > 1) ? orig : null; case SWITCH_BACKWARD: @@ -177,8 +172,8 @@ public final class LayoutModifier switch (orig.getKeyevent()) { case KeyEvent.KEYCODE_ENTER: - if (ec.swapEnterActionKey && ec.actionLabel != null) - return KeyValue.makeActionKey(ec.actionLabel); + if (ec.enter_key_replacement != null) + return ec.enter_key_replacement; break; } break; |
