diff options
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/rockboy/sys_rockbox.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c index faba95e..54b369d 100644 --- a/apps/plugins/rockboy/sys_rockbox.c +++ b/apps/plugins/rockboy/sys_rockbox.c @@ -36,7 +36,7 @@ struct fb fb IBSS_ATTR; extern int debug_trace; -unsigned int oldbuttonstate = 0, newbuttonstate,holdbutton; +static unsigned int oldbuttonstate; #ifdef HAVE_WHEEL_POSITION int oldwheel = -1, wheel; @@ -54,39 +54,30 @@ static int wheelmap[8] = { int released, pressed; - -#ifdef ROCKBOY_SCROLLWHEEL -/* Scrollwheel events are posted directly and not polled by the button - driver - synthesize polling */ -static inline unsigned int read_scroll_wheel(void) +void ev_poll(void) { + event_t ev; + unsigned int buttons = BUTTON_NONE; unsigned int btn; - /* Empty out the button queue and see if any scrollwheel events were - posted */ + /* loop until all button events are popped off */ do { - btn = rb->button_get_w_tmo(0); + btn = rb->button_get(false); buttons |= btn; +#if defined(HAVE_SCROLLWHEEL) && !defined(ROCKBOY_SCROLLWHEEL) + /* filter out scroll wheel events if not supported */ + buttons &= ~(BUTTON_SCROLL_FWD|BUTTON_SCROLL_BACK); +#endif } while (btn != BUTTON_NONE); - return buttons & (ROCKBOY_SCROLLWHEEL_CC | ROCKBOY_SCROLLWHEEL_CW); -} -#endif - -void ev_poll(void) -{ - event_t ev; - newbuttonstate = rb->button_status(); -#ifdef ROCKBOY_SCROLLWHEEL - newbuttonstate |= read_scroll_wheel(); -#endif - released = ~newbuttonstate & oldbuttonstate; - pressed = newbuttonstate & ~oldbuttonstate; - oldbuttonstate = newbuttonstate; + released = ~buttons & oldbuttonstate; + pressed = buttons & ~oldbuttonstate; + oldbuttonstate = buttons; #if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) + static unsigned int holdbutton; if (rb->button_hold()&~holdbutton) fb.mode=(fb.mode+1)%4; holdbutton=rb->button_hold(); @@ -374,4 +365,3 @@ void vid_update(int scanline) #endif /* LCD_HEIGHT */ } #endif - |