From cedf3aeb1c63ac91f550dd48f984cf4f6cf68ed7 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 17 Aug 2025 19:24:08 +0200 Subject: Slider sensitivity option and improve slider ergonimics (#1070) * Add option 'Space bar slider sensitivity' * Fix slider moving the cursor twice at the beginning The slider was generating two events when first activated. Since 2bed42857. * Make slider less sensitive for the first step This moves the second slider step approximately 40% further and takes the new sensitivity option into account. Allows moving the cursor by one spot more easily.--- srcs/juloo.keyboard2/Config.java | 3 ++- srcs/juloo.keyboard2/Pointers.java | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'srcs') diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 06a82db..6ca8113 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -144,7 +144,8 @@ public final class Config float swipe_scaling = Math.min(dm.widthPixels, dm.heightPixels) / 10.f * dpi_ratio; float swipe_dist_value = Float.valueOf(_prefs.getString("swipe_dist", "15")); swipe_dist_px = swipe_dist_value / 25.f * swipe_scaling; - slide_step_px = 0.4f * swipe_scaling; + float slider_sensitivity = Float.valueOf(_prefs.getString("slider_sensitivity", "30")) / 100.f; + slide_step_px = slider_sensitivity * swipe_scaling; vibrate_custom = _prefs.getBoolean("vibrate_custom", false); vibrate_duration = _prefs.getInt("vibrate_duration", 20); longPressTimeout = _prefs.getInt("longpress_timeout", 600); diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index 90cfc28..62fdbb8 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -473,7 +473,6 @@ public final class Pointers implements Handler.Callback stopLongPress(ptr); ptr.flags |= FLAG_P_SLIDING; ptr.sliding = new Sliding(x, y, dirx, diry, kv.getSlider()); - _handler.onPointerDown(kv, true); } /** Return the [FLAG_P_*] flags that correspond to pressing [kv]. */ @@ -622,7 +621,7 @@ public final class Pointers implements Handler.Callback float travelled = Math.abs(x - last_x) + Math.abs(y - last_y); if (last_move_ms == -1) { - if (travelled < _config.swipe_dist_px) + if (travelled < (_config.swipe_dist_px + _config.slide_step_px)) return; last_move_ms = System.currentTimeMillis(); } -- cgit v1.2.3