diff options
| author | Jules Aguillon | 2025-01-11 16:00:08 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2025-01-11 16:18:58 +0100 |
| commit | 1783dcdb35a5c482ca6de2351a0f9c6321bdf786 (patch) | |
| tree | ed9f42a22fc772a2637ace7c3bf5a5c147ca9482 /srcs/juloo.keyboard2/KeyEventHandler.java | |
| parent | 4f8b5fa6cee72feda63162c8aa71905ba893a71d (diff) | |
| download | unexpected-keyboard-1783dcdb35a5c482ca6de2351a0f9c6321bdf786.tar.gz unexpected-keyboard-1783dcdb35a5c482ca6de2351a0f9c6321bdf786.zip | |
Refactor: Restrict sliders to new 'Slider' key kind
Setting 'slider="true"' on a key is no longer enough to make a slider,
the key must also be of kind 'Slider'.
Only the KeyValue that started sliding is now considered, they can be
generated with negative values. This allows keys that don't have the
complementary cursor movement key on the opposite direction.
This will help implement other kind of sliders as well as up/down
sliders.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyEventHandler.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyEventHandler.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java index 0a8cd65..45db719 100644 --- a/srcs/juloo.keyboard2/KeyEventHandler.java +++ b/srcs/juloo.keyboard2/KeyEventHandler.java @@ -99,7 +99,7 @@ public final class KeyEventHandler case Compose_pending: _recv.set_compose_pending(true); break; - case Cursor_move: move_cursor(key.getCursorMove()); break; + case Slider: handle_slider(key.getSlider(), key.getSliderRepeat()); break; case Complex: send_complex_key(key.getComplexKind(), key.getComplex()); break; } update_meta_state(old_mods); @@ -262,6 +262,15 @@ public final class KeyEventHandler return conn.getExtractedText(_move_cursor_req, 0); } + void handle_slider(KeyValue.Slider s, int repeatition) + { + switch (s) + { + case Cursor_left: move_cursor(-repeatition); break; + case Cursor_right: move_cursor(repeatition); break; + } + } + /** Move the cursor right or left, if possible without sending key events. Unlike arrow keys, the selection is not removed even if shift is not on. Falls back to sending arrow keys events if the editor do not support |
