From 8b6161b24b642ce6ac7e74218de1f64728f747f9 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Tue, 6 Oct 2009 01:26:01 +0000 Subject: Simulator: Fix scrollwheel targets. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22977 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/sdl/button-sdl.h | 1 - uisimulator/sdl/button.c | 23 +++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/uisimulator/sdl/button-sdl.h b/uisimulator/sdl/button-sdl.h index 5a0a7e2620..8159d24729 100644 --- a/uisimulator/sdl/button-sdl.h +++ b/uisimulator/sdl/button-sdl.h @@ -34,7 +34,6 @@ bool button_hold(void); void button_init_sdl(void); -intptr_t button_get_data_sdl(void); #undef button_init_device #define button_init_device() button_init_sdl() diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index ee0a24008b..f8889bafb8 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c @@ -1203,21 +1203,28 @@ void button_event(int key, bool pressed) break; } + /* Call to make up for scrollwheel target implementation. This is + * not handled in the main button.c driver, but on the target + * implementation (look at button-e200.c for example if you are trying to + * figure out why using button_get_data needed a hack before). + */ +#if defined(BUTTON_SCROLL_FWD) && defined(BUTTON_SCROLL_BACK) + if((new_btn == BUTTON_SCROLL_FWD || new_btn == BUTTON_SCROLL_BACK) && + pressed) + { + queue_post(&button_queue, new_btn, 1<<24); + } +#endif + if (pressed) btn |= new_btn; else btn &= ~new_btn; } -#ifdef HAVE_BUTTON_DATA +#if defined(HAVE_BUTTON_DATA) && defined(HAVE_TOUCHSCREEN) int button_read_device(int* data) { -#if defined(HAVE_TOUCHSCREEN) - *data=mouse_coords; -#else - /* pass scrollwheel acceleration to the button driver */ - *data = 1<<24; -#endif - + *data = mouse_coords; #else int button_read_device(void) { -- cgit v1.2.3