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: Integrate gesture API with action system

Provide a default gesture object in the action system which will
be kept up to date with touch events automatically. This reduces
the boilerplate needed to handle touch input.

Change-Id: I76f51ac2c3e3a0da204707d62e91a175c5f8c76a

authored by

Aidan MacDonald and committed by
Solomon Peachy
8aae7238 bb1e0b48

+38
+25
apps/action.c
··· 104 104 int ts_data; 105 105 long ts_start_tick; 106 106 struct touchevent touchevent; 107 + struct gesture gesture; 107 108 #endif 108 109 } action_last_t; 109 110 ··· 466 467 last->touchevent.x = (last->ts_data >> 16) & 0xffff; 467 468 last->touchevent.y = last->ts_data & 0xffff; 468 469 last->touchevent.tick = last->tick; 470 + 471 + /* Update gesture state */ 472 + gesture_process(&last->gesture, &last->touchevent); 469 473 470 474 return true; 471 475 } ··· 1149 1153 *ev = action_last.touchevent; 1150 1154 1151 1155 return action_last.touchevent.type; 1156 + } 1157 + 1158 + void action_gesture_reset(void) 1159 + { 1160 + gesture_reset(&action_last.gesture); 1161 + } 1162 + 1163 + bool action_gesture_get_event_in_vp(struct gesture_event *gevt, 1164 + const struct viewport *vp) 1165 + { 1166 + return gesture_get_event_in_vp(&action_last.gesture, gevt, vp); 1167 + } 1168 + 1169 + bool action_gesture_is_valid(void) 1170 + { 1171 + return gesture_is_valid(&action_last.gesture); 1172 + } 1173 + 1174 + bool action_gesture_is_pressed(void) 1175 + { 1176 + return gesture_is_pressed(&action_last.gesture); 1152 1177 } 1153 1178 1154 1179 /* return BUTTON_NONE on error
+13
apps/action.h
··· 23 23 #include "stdbool.h" 24 24 #include "button.h" 25 25 #include "viewport.h" 26 + #include "gesture.h" 26 27 27 28 #define TIMEOUT_BLOCK -1 28 29 #define TIMEOUT_NOBLOCK 0 ··· 417 418 #ifdef HAVE_TOUCHSCREEN 418 419 /* Return a touch event and screen coordinates of the touch. */ 419 420 int action_get_touch_event(struct touchevent *ev); 421 + 422 + /* Action system gesture recognition */ 423 + void action_gesture_reset(void); 424 + bool action_gesture_get_event_in_vp(struct gesture_event *gevt, 425 + const struct viewport *vp); 426 + bool action_gesture_is_valid(void); 427 + bool action_gesture_is_pressed(void); 428 + 429 + static inline bool action_gesture_get_event(struct gesture_event *gevt) 430 + { 431 + return action_gesture_get_event_in_vp(gevt, NULL); 432 + } 420 433 421 434 /* DEPRECATED, do not use these anymore */ 422 435 int action_get_touchscreen_press(short *x, short *y);