summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-11-20 02:38:00 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-11-21 20:26:20 +0000
commitad66c3b807245a8c0b4ea78e0c5d980d71726d89 (patch)
tree7234867d611db6489e83b7e92f47fadb0305ea46 /firmware
parent990c543ebcf821658a421aec3ae842bb51726072 (diff)
downloadrockbox-ad66c3b807245a8c0b4ea78e0c5d980d71726d89.tar.gz
rockbox-ad66c3b807245a8c0b4ea78e0c5d980d71726d89.zip
touchscreen: use repeat acceleration for button input
Touch devices have physical buttons too, and these should be subject to repeat acceleration. That feature was disabled for the sake of better touch event responsiveness (apparently). So, re-enable the acceleration feature & add a special case to exempt BUTTON_TOUCHSCREEN from acceleration. Change-Id: I9e097e27457fbd6b824f098e8b325ff35c59dde4
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/button.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 5addfee3de..0af51dc3b2 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -70,27 +70,21 @@ static bool enable_sw_poweroff = true;
/* how long until repeat kicks in, in centiseconds */
#define REPEAT_START (30*HZ/100)
-#ifndef HAVE_TOUCHSCREEN
-/* the next two make repeat "accelerate", which is nice for lists
+/* The next two make repeat "accelerate", which is nice for lists
* which begin to scroll a bit faster when holding until the
- * real list accerelation kicks in (this smoothes acceleration)
+ * real list accerelation kicks in (this smooths acceleration).
+ *
+ * Note that touchscreen pointing events are not subject to this
+ * acceleration and always use REPEAT_INTERVAL_TOUCH. (Do repeat
+ * events even do anything sane for touchscreens??)
*/
/* the speed repeat starts at, in centiseconds */
#define REPEAT_INTERVAL_START (16*HZ/100)
/* speed repeat finishes at, in centiseconds */
#define REPEAT_INTERVAL_FINISH (5*HZ/100)
-#else
-/*
- * on touchscreen it's different, scrolling is done by swiping over the
- * screen (potentially very quickly) and is completely different from button
- * targets
- * So, on touchscreen we don't want to artifically slow down early repeats,
- * it'd have the contrary effect of making rockbox appear lagging
- */
-#define REPEAT_INTERVAL_START (5*HZ/100)
-#define REPEAT_INTERVAL_FINISH (5*HZ/100)
-#endif
+/* repeat interval for touch events */
+#define REPEAT_INTERVAL_TOUCH (5*HZ/100)
#ifdef HAVE_BUTTON_DATA
static int button_read(int *data);
@@ -275,6 +269,11 @@ static void button_tick(void)
/* yes we have repeat */
if (repeat_speed > REPEAT_INTERVAL_FINISH)
repeat_speed--;
+#ifdef HAVE_TOUCHSCREEN
+ if(btn & BUTTON_TOUCHSCREEN)
+ repeat_speed = REPEAT_INTERVAL_TOUCH;
+#endif
+
count = repeat_speed;
repeat_count++;