summaryrefslogtreecommitdiff
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
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
-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;
70/* how long until repeat kicks in, in centiseconds */ 70/* how long until repeat kicks in, in centiseconds */
71#define REPEAT_START (30*HZ/100) 71#define REPEAT_START (30*HZ/100)
72 72
73#ifndef HAVE_TOUCHSCREEN 73/* The next two make repeat "accelerate", which is nice for lists
74/* the next two make repeat "accelerate", which is nice for lists
75 * which begin to scroll a bit faster when holding until the 74 * which begin to scroll a bit faster when holding until the
76 * real list accerelation kicks in (this smoothes acceleration) 75 * real list accerelation kicks in (this smooths acceleration).
76 *
77 * Note that touchscreen pointing events are not subject to this
78 * acceleration and always use REPEAT_INTERVAL_TOUCH. (Do repeat
79 * events even do anything sane for touchscreens??)
77 */ 80 */
78 81
79/* the speed repeat starts at, in centiseconds */ 82/* the speed repeat starts at, in centiseconds */
80#define REPEAT_INTERVAL_START (16*HZ/100) 83#define REPEAT_INTERVAL_START (16*HZ/100)
81/* speed repeat finishes at, in centiseconds */ 84/* speed repeat finishes at, in centiseconds */
82#define REPEAT_INTERVAL_FINISH (5*HZ/100) 85#define REPEAT_INTERVAL_FINISH (5*HZ/100)
83#else 86/* repeat interval for touch events */
84/* 87#define REPEAT_INTERVAL_TOUCH (5*HZ/100)
85 * on touchscreen it's different, scrolling is done by swiping over the
86 * screen (potentially very quickly) and is completely different from button
87 * targets
88 * So, on touchscreen we don't want to artifically slow down early repeats,
89 * it'd have the contrary effect of making rockbox appear lagging
90 */
91#define REPEAT_INTERVAL_START (5*HZ/100)
92#define REPEAT_INTERVAL_FINISH (5*HZ/100)
93#endif
94 88
95#ifdef HAVE_BUTTON_DATA 89#ifdef HAVE_BUTTON_DATA
96static int button_read(int *data); 90static int button_read(int *data);
@@ -275,6 +269,11 @@ static void button_tick(void)
275 /* yes we have repeat */ 269 /* yes we have repeat */
276 if (repeat_speed > REPEAT_INTERVAL_FINISH) 270 if (repeat_speed > REPEAT_INTERVAL_FINISH)
277 repeat_speed--; 271 repeat_speed--;
272#ifdef HAVE_TOUCHSCREEN
273 if(btn & BUTTON_TOUCHSCREEN)
274 repeat_speed = REPEAT_INTERVAL_TOUCH;
275#endif
276
278 count = repeat_speed; 277 count = repeat_speed;
279 278
280 repeat_count++; 279 repeat_count++;