Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

touchscreen: Fix event reporting in button driver

The way the button driver reported touch events was problematic
and made it impossible to detect if a touch started or if it was
a continuation of an existing touch.

Now, the first detected touch event gets BUTTON_TOUCHSCREEN and
all subsequent touch events while the screen is pressed will get
the BUTTON_REPEAT bit set. When the screen is released the final
event will have the BUTTON_REL bit set.

Change-Id: Ia456a22b2180031555a82231c2af32576bc5f2cb

authored by

Aidan MacDonald and committed by
Solomon Peachy
c47c075b 9f613fd9

+18 -10
+18 -10
firmware/drivers/button.c
··· 75 75 * real list acceleration kicks in (this smooths acceleration). 76 76 * 77 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??) 78 + * acceleration and always use REPEAT_INTERVAL_TOUCH. That value 79 + * essentially determines the touchscreen polling rate. 80 80 */ 81 81 82 82 /* the speed repeat starts at, in centiseconds */ ··· 324 324 } 325 325 else 326 326 { 327 - if (count++ > REPEAT_START) 327 + ++count; 328 + if (count > REPEAT_START 329 + #ifdef HAVE_TOUCHSCREEN 330 + /* For touch events we want to repost quickly since 331 + * the coordinates can change */ 332 + || ((btn & BUTTON_TOUCHSCREEN) && 333 + count > REPEAT_INTERVAL_TOUCH) 334 + #endif 335 + ) 328 336 { 329 337 post = true; 330 338 repeat = true; 331 339 repeat_count = 0; 332 340 /* initial repeat */ 333 - count = REPEAT_INTERVAL_START; 334 - } 335 341 #ifdef HAVE_TOUCHSCREEN 336 - else if (lastdata != data && btn == lastbtn) 337 - { /* only coordinates changed, post anyway */ 338 - if (touchscreen_get_mode() == TOUCHSCREEN_POINT) 339 - post = true; 340 - } 342 + if (btn & BUTTON_TOUCHSCREEN) 343 + count = REPEAT_INTERVAL_TOUCH; 344 + else 341 345 #endif 346 + { 347 + count = REPEAT_INTERVAL_START; 348 + } 349 + } 342 350 } 343 351 } 344 352 if ( post )