summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/sdl/button.c')
-rw-r--r--uisimulator/sdl/button.c40
1 files changed, 20 insertions, 20 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
33static intptr_t button_data; /* data value from last message dequeued */ 33static intptr_t button_data; /* data value from last message dequeued */
34 34
35#ifdef HAVE_TOUCHPAD 35#ifdef HAVE_TOUCHSCREEN
36static int mouse_coords = 0; 36static int mouse_coords = 0;
37static enum touchpad_mode touchpad_mode = TOUCHPAD_POINT; 37static enum touchscreen_mode touchscreen_mode = TOUCHSCREEN_POINT;
38void touchpad_set_mode(enum touchpad_mode mode) 38void touchscreen_set_mode(enum touchscreen_mode mode)
39{ 39{
40 touchpad_mode = mode; 40 touchscreen_mode = mode;
41} 41}
42enum touchpad_mode touchpad_get_mode(void) 42enum 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
1106intptr_t button_get_data(void) 1106intptr_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
1117extern bool debug_wps; 1117extern bool debug_wps;
1118void mouse_tick_task(void) 1118void 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
1143void button_init(void) 1143void 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}