summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/sys_rockbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/sys_rockbox.c')
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 54b369d10a..1bf63b7a74 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -36,9 +36,8 @@ struct fb fb IBSS_ATTR;
36 36
37extern int debug_trace; 37extern int debug_trace;
38 38
39static unsigned int oldbuttonstate;
40#ifdef HAVE_WHEEL_POSITION 39#ifdef HAVE_WHEEL_POSITION
41int oldwheel = -1, wheel; 40static int oldwheel = -1, wheel;
42 41
43static int wheelmap[8] = { 42static int wheelmap[8] = {
44 PAD_UP, /* Top */ 43 PAD_UP, /* Top */
@@ -52,29 +51,40 @@ static int wheelmap[8] = {
52}; 51};
53#endif 52#endif
54 53
55int released, pressed;
56
57void ev_poll(void) 54void ev_poll(void)
58{ 55{
59 event_t ev; 56 event_t ev;
60 57
58 static unsigned int oldbuttonstate;
61 unsigned int buttons = BUTTON_NONE; 59 unsigned int buttons = BUTTON_NONE;
60 unsigned int released, pressed;
62 unsigned int btn; 61 unsigned int btn;
62 bool quit = false;
63 63
64 /* loop until all button events are popped off */
65 do 64 do
66 { 65 {
67 btn = rb->button_get(false); 66 btn = rb->button_get(false);
67 /* BUTTON_NONE doesn't necessarily mean no button is pressed,
68 * it just means the button queue became empty for this tick.
69 * One can only be sure that no button is pressed by
70 * calling button_status(). */
71 if (btn == BUTTON_NONE)
72 {
73 /* loop only until all button events are popped off */
74 quit = true;
75 btn = rb->button_status();
76 }
68 buttons |= btn; 77 buttons |= btn;
69#if defined(HAVE_SCROLLWHEEL) && !defined(ROCKBOY_SCROLLWHEEL) 78#if defined(HAVE_SCROLLWHEEL) && !defined(ROCKBOY_SCROLLWHEEL)
70 /* filter out scroll wheel events if not supported */ 79 /* filter out scroll wheel events if not supported */
71 buttons &= ~(BUTTON_SCROLL_FWD|BUTTON_SCROLL_BACK); 80 buttons &= ~(BUTTON_SCROLL_FWD|BUTTON_SCROLL_BACK);
72#endif 81#endif
73 } 82 }
74 while (btn != BUTTON_NONE); 83 while (!quit);
75 84
76 released = ~buttons & oldbuttonstate; 85 released = ~buttons & oldbuttonstate;
77 pressed = buttons & ~oldbuttonstate; 86 pressed = buttons & ~oldbuttonstate;
87
78 oldbuttonstate = buttons; 88 oldbuttonstate = buttons;
79#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) 89#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2)
80 static unsigned int holdbutton; 90 static unsigned int holdbutton;