diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-08-23 09:46:38 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-08-23 09:46:38 +0000 |
commit | 1392dc2144a4b1810ba5c421f54e05dc1a3a74c7 (patch) | |
tree | 7f7f7d6dd6ce00e8146896456549441d4e8153d7 /uisimulator | |
parent | 965d2af61f5035dcf5179b8539785de641a9f015 (diff) | |
download | rockbox-1392dc2144a4b1810ba5c421f54e05dc1a3a74c7.tar.gz rockbox-1392dc2144a4b1810ba5c421f54e05dc1a3a74c7.zip |
Commit FS#9308: differentiate between TOUCHPAD & TOUCHSCREEN
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18338 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/sdl/button.c | 40 | ||||
-rw-r--r-- | uisimulator/sdl/uisdl.c | 4 |
2 files changed, 22 insertions, 22 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 843f685226..47ecb2b368 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -32,16 +32,16 @@ | |||
32 | 32 | ||
33 | static intptr_t button_data; /* data value from last message dequeued */ | 33 | static intptr_t button_data; /* data value from last message dequeued */ |
34 | 34 | ||
35 | #ifdef HAVE_TOUCHPAD | 35 | #ifdef HAVE_TOUCHSCREEN |
36 | static int mouse_coords = 0; | 36 | static int mouse_coords = 0; |
37 | static enum touchpad_mode touchpad_mode = TOUCHPAD_POINT; | 37 | static enum touchscreen_mode touchscreen_mode = TOUCHSCREEN_POINT; |
38 | void touchpad_set_mode(enum touchpad_mode mode) | 38 | void touchscreen_set_mode(enum touchscreen_mode mode) |
39 | { | 39 | { |
40 | touchpad_mode = mode; | 40 | touchscreen_mode = mode; |
41 | } | 41 | } |
42 | enum touchpad_mode touchpad_get_mode(void) | 42 | enum touchscreen_mode touchscreen_get_mode(void) |
43 | { | 43 | { |
44 | return touchpad_mode; | 44 | return touchscreen_mode; |
45 | } | 45 | } |
46 | #endif | 46 | #endif |
47 | /* how long until repeat kicks in */ | 47 | /* how long until repeat kicks in */ |
@@ -120,23 +120,23 @@ void button_event(int key, bool pressed) | |||
120 | switch (key) | 120 | switch (key) |
121 | { | 121 | { |
122 | 122 | ||
123 | #ifdef HAVE_TOUCHPAD | 123 | #ifdef HAVE_TOUCHSCREEN |
124 | case BUTTON_TOUCHPAD: | 124 | case BUTTON_TOUCHSCREEN: |
125 | data = mouse_coords; | 125 | data = mouse_coords; |
126 | switch (touchpad_mode) | 126 | switch (touchscreen_mode) |
127 | { | 127 | { |
128 | case TOUCHPAD_POINT: | 128 | case TOUCHSCREEN_POINT: |
129 | new_btn = BUTTON_TOUCHPAD; | 129 | new_btn = BUTTON_TOUCHSCREEN; |
130 | break; | 130 | break; |
131 | case TOUCHPAD_BUTTON: | 131 | case TOUCHSCREEN_BUTTON: |
132 | { | 132 | { |
133 | static int touchpad_buttons[3][3] = { | 133 | static int touchscreen_buttons[3][3] = { |
134 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, | 134 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, |
135 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, | 135 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, |
136 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, | 136 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, |
137 | }; | 137 | }; |
138 | int px_x = ((data&0xffff0000)>>16), px_y = ((data&0x0000ffff)); | 138 | int px_x = ((data&0xffff0000)>>16), px_y = ((data&0x0000ffff)); |
139 | new_btn = touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; | 139 | new_btn = touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; |
140 | break; | 140 | break; |
141 | } | 141 | } |
142 | } | 142 | } |
@@ -171,8 +171,8 @@ void button_event(int key, bool pressed) | |||
171 | case SDLK_F4: | 171 | case SDLK_F4: |
172 | if(pressed) | 172 | if(pressed) |
173 | { | 173 | { |
174 | touchpad_mode = (touchpad_mode == TOUCHPAD_POINT ? TOUCHPAD_BUTTON : TOUCHPAD_POINT); | 174 | touchscreen_mode = (touchscreen_mode == TOUCHSCREEN_POINT ? TOUCHSCREEN_BUTTON : TOUCHSCREEN_POINT); |
175 | printf("Touchpad mode: %s\n", touchpad_mode == TOUCHPAD_POINT ? "TOUCHPAD_POINT" : "TOUCHPAD_BUTTON"); | 175 | printf("Touchscreen mode: %s\n", touchscreen_mode == TOUCHSCREEN_POINT ? "TOUCHSCREEN_POINT" : "TOUCHSCREEN_BUTTON"); |
176 | } | 176 | } |
177 | break; | 177 | break; |
178 | 178 | ||
@@ -1105,7 +1105,7 @@ long button_get_w_tmo(int ticks) | |||
1105 | 1105 | ||
1106 | intptr_t button_get_data(void) | 1106 | intptr_t button_get_data(void) |
1107 | { | 1107 | { |
1108 | #ifdef HAVE_TOUCHPAD | 1108 | #ifdef HAVE_TOUCHSCREEN |
1109 | return button_data; | 1109 | return button_data; |
1110 | #else | 1110 | #else |
1111 | /* Needed by the accelerating wheel driver for Sansa e200 */ | 1111 | /* Needed by the accelerating wheel driver for Sansa e200 */ |
@@ -1113,7 +1113,7 @@ intptr_t button_get_data(void) | |||
1113 | #endif | 1113 | #endif |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | #ifdef HAVE_TOUCHPAD | 1116 | #ifdef HAVE_TOUCHSCREEN |
1117 | extern bool debug_wps; | 1117 | extern bool debug_wps; |
1118 | void mouse_tick_task(void) | 1118 | void mouse_tick_task(void) |
1119 | { | 1119 | { |
@@ -1134,7 +1134,7 @@ void mouse_tick_task(void) | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | mouse_coords = (x<<16)|y; | 1136 | mouse_coords = (x<<16)|y; |
1137 | button_event(BUTTON_TOUCHPAD, true); | 1137 | button_event(BUTTON_TOUCHSCREEN, true); |
1138 | if (debug_wps) | 1138 | if (debug_wps) |
1139 | printf("Mouse at: (%d, %d)\n", x, y); | 1139 | printf("Mouse at: (%d, %d)\n", x, y); |
1140 | } | 1140 | } |
@@ -1142,7 +1142,7 @@ void mouse_tick_task(void) | |||
1142 | #endif | 1142 | #endif |
1143 | void button_init(void) | 1143 | void button_init(void) |
1144 | { | 1144 | { |
1145 | #ifdef HAVE_TOUCHPAD | 1145 | #ifdef HAVE_TOUCHSCREEN |
1146 | tick_add_task(mouse_tick_task); | 1146 | tick_add_task(mouse_tick_task); |
1147 | #endif | 1147 | #endif |
1148 | } | 1148 | } |
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c index f0e99070e5..156e4203f6 100644 --- a/uisimulator/sdl/uisdl.c +++ b/uisimulator/sdl/uisdl.c | |||
@@ -78,7 +78,7 @@ void gui_message_loop(void) | |||
78 | button_event(event.key.keysym.sym, false); | 78 | button_event(event.key.keysym.sym, false); |
79 | sim_exit_irq_handler(); | 79 | sim_exit_irq_handler(); |
80 | break; | 80 | break; |
81 | #ifndef HAVE_TOUCHPAD | 81 | #ifndef HAVE_TOUCHSCREEN |
82 | case SDL_MOUSEBUTTONDOWN: | 82 | case SDL_MOUSEBUTTONDOWN: |
83 | if (debug_wps && event.button.button == 1) | 83 | if (debug_wps && event.button.button == 1) |
84 | { | 84 | { |
@@ -88,7 +88,7 @@ void gui_message_loop(void) | |||
88 | #else | 88 | #else |
89 | case SDL_MOUSEBUTTONUP: | 89 | case SDL_MOUSEBUTTONUP: |
90 | sim_enter_irq_handler(); | 90 | sim_enter_irq_handler(); |
91 | button_event(BUTTON_TOUCHPAD, false); | 91 | button_event(BUTTON_TOUCHSCREEN, false); |
92 | sim_exit_irq_handler(); | 92 | sim_exit_irq_handler(); |
93 | break; | 93 | break; |
94 | #endif | 94 | #endif |