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: Port quickscreen to gesture API

Use the gesture API to improve reliability, and allow press and hold
to repeatedly increment or decrement a value like on button targets.

Change-Id: Ic01b7a0802c3dec9f1534f5dd11e006b28a875b6

authored by

Aidan MacDonald and committed by
Solomon Peachy
0f99defe 94468f69

+25 -11
+23 -6
apps/gui/quickscreen.c
··· 50 50 #define MARGIN 10 51 51 #define CENTER_ICONAREA_SIZE (MARGIN+8*2) 52 52 53 + struct gui_quickscreen 54 + { 55 + const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; 56 + }; 57 + 53 58 static bool redraw; 54 59 55 60 static void quickscreen_update_callback(unsigned short id, ··· 297 302 #ifdef HAVE_TOUCHSCREEN 298 303 static int quickscreen_touchscreen_button(void) 299 304 { 300 - short x,y; 301 - if (action_get_touchscreen_press(&x, &y) != BUTTON_REL) 305 + struct gesture_event gevent; 306 + if (!action_gesture_get_event(&gevent)) 302 307 return ACTION_NONE; 303 308 309 + switch (gevent.id) { 310 + case GESTURE_TAP: 311 + case GESTURE_HOLD: 312 + break; 313 + default: 314 + return ACTION_NONE; 315 + } 316 + 304 317 enum { left=1, right=2, top=4, bottom=8 }; 305 318 306 319 int bits = 0; 307 320 308 - if(x < LCD_WIDTH/3) 321 + if(gevent.x < LCD_WIDTH/3) 309 322 bits |= left; 310 - else if(x > 2*LCD_WIDTH/3) 323 + else if(gevent.x > 2*LCD_WIDTH/3) 311 324 bits |= right; 312 325 313 - if(y < LCD_HEIGHT/3) 326 + if(gevent.y < LCD_HEIGHT/3) 314 327 bits |= top; 315 - else if(y > 2*LCD_HEIGHT/3) 328 + else if(gevent.y > 2*LCD_HEIGHT/3) 316 329 bits |= bottom; 317 330 318 331 switch(bits) { ··· 366 379 talk_qs_option(qs->items[QUICKSCREEN_LEFT], true); 367 380 if (qs->items[QUICKSCREEN_LEFT] != qs->items[QUICKSCREEN_RIGHT]) 368 381 talk_qs_option(qs->items[QUICKSCREEN_RIGHT], true); 382 + 383 + #ifdef HAVE_TOUCHSCREEN 384 + action_gesture_reset(); 385 + #endif 369 386 while (true) { 370 387 if (redraw) 371 388 {
+2 -5
apps/gui/quickscreen.h
··· 28 28 29 29 #include "screen_access.h" 30 30 31 + struct settings_list; 32 + 31 33 enum quickscreen_item { 32 34 QUICKSCREEN_TOP = 0, 33 35 QUICKSCREEN_LEFT, ··· 41 43 QUICKSCREEN_IN_USB = 0x1, 42 44 QUICKSCREEN_GOTO_SHORTCUTS_MENU = 0x2, 43 45 QUICKSCREEN_CHANGED = 0x4, 44 - }; 45 - 46 - struct gui_quickscreen 47 - { 48 - const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; 49 46 }; 50 47 51 48 extern int quick_screen_quick(int button_enter);