summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy')
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index faba95ea68..54b369d10a 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -36,7 +36,7 @@ struct fb fb IBSS_ATTR;
36 36
37extern int debug_trace; 37extern int debug_trace;
38 38
39unsigned int oldbuttonstate = 0, newbuttonstate,holdbutton; 39static unsigned int oldbuttonstate;
40#ifdef HAVE_WHEEL_POSITION 40#ifdef HAVE_WHEEL_POSITION
41int oldwheel = -1, wheel; 41int oldwheel = -1, wheel;
42 42
@@ -54,39 +54,30 @@ static int wheelmap[8] = {
54 54
55int released, pressed; 55int released, pressed;
56 56
57 57void ev_poll(void)
58#ifdef ROCKBOY_SCROLLWHEEL
59/* Scrollwheel events are posted directly and not polled by the button
60 driver - synthesize polling */
61static inline unsigned int read_scroll_wheel(void)
62{ 58{
59 event_t ev;
60
63 unsigned int buttons = BUTTON_NONE; 61 unsigned int buttons = BUTTON_NONE;
64 unsigned int btn; 62 unsigned int btn;
65 63
66 /* Empty out the button queue and see if any scrollwheel events were 64 /* loop until all button events are popped off */
67 posted */
68 do 65 do
69 { 66 {
70 btn = rb->button_get_w_tmo(0); 67 btn = rb->button_get(false);
71 buttons |= btn; 68 buttons |= btn;
69#if defined(HAVE_SCROLLWHEEL) && !defined(ROCKBOY_SCROLLWHEEL)
70 /* filter out scroll wheel events if not supported */
71 buttons &= ~(BUTTON_SCROLL_FWD|BUTTON_SCROLL_BACK);
72#endif
72 } 73 }
73 while (btn != BUTTON_NONE); 74 while (btn != BUTTON_NONE);
74 75
75 return buttons & (ROCKBOY_SCROLLWHEEL_CC | ROCKBOY_SCROLLWHEEL_CW); 76 released = ~buttons & oldbuttonstate;
76} 77 pressed = buttons & ~oldbuttonstate;
77#endif 78 oldbuttonstate = buttons;
78
79void ev_poll(void)
80{
81 event_t ev;
82 newbuttonstate = rb->button_status();
83#ifdef ROCKBOY_SCROLLWHEEL
84 newbuttonstate |= read_scroll_wheel();
85#endif
86 released = ~newbuttonstate & oldbuttonstate;
87 pressed = newbuttonstate & ~oldbuttonstate;
88 oldbuttonstate = newbuttonstate;
89#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) 79#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2)
80 static unsigned int holdbutton;
90 if (rb->button_hold()&~holdbutton) 81 if (rb->button_hold()&~holdbutton)
91 fb.mode=(fb.mode+1)%4; 82 fb.mode=(fb.mode+1)%4;
92 holdbutton=rb->button_hold(); 83 holdbutton=rb->button_hold();
@@ -374,4 +365,3 @@ void vid_update(int scanline)
374#endif /* LCD_HEIGHT */ 365#endif /* LCD_HEIGHT */
375} 366}
376#endif 367#endif
377