summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 519ac8d7c5..3321a01bc6 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -96,7 +96,7 @@ static void touchscreen_event(int x, int y)
96 mouse_coords = (x << 16) | y; 96 mouse_coords = (x << 16) | y;
97 button_event(BUTTON_TOUCHSCREEN, true); 97 button_event(BUTTON_TOUCHSCREEN, true);
98 if (debug_wps) 98 if (debug_wps)
99 printf("Mouse at: (%d, %d)\n", x, y); 99 printf("Mouse at 1: (%d, %d)\n", x, y);
100 } 100 }
101} 101}
102#endif 102#endif
@@ -193,15 +193,15 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up)
193 } 193 }
194 else 194 else
195 { 195 {
196 m_x = event->x / display_zoom; 196 m_x = event->x;
197 m_y = event->y / display_zoom; 197 m_y = event->y;
198#ifdef HAVE_REMOTE 198#ifdef HAVE_REMOTE
199 if ( m_y >= LCD_HEIGHT ) /* Remote Screen */ 199 if ( m_y >= LCD_HEIGHT ) /* Remote Screen */
200 m_y -= LCD_HEIGHT; 200 m_y -= LCD_HEIGHT;
201#endif 201#endif
202 } 202 }
203 203
204 printf("Mouse at: (%d, %d)\n", m_x, m_y); 204 printf("Mouse at 2: (%d, %d)\n", m_x, m_y);
205 } 205 }
206 } 206 }
207#undef SQUARE 207#undef SQUARE
@@ -218,15 +218,23 @@ static bool event_handler(SDL_Event *event)
218#ifdef HAVE_TOUCHSCREEN 218#ifdef HAVE_TOUCHSCREEN
219 case SDL_MOUSEMOTION: 219 case SDL_MOUSEMOTION:
220 if (event->motion.state & SDL_BUTTON(1)) 220 if (event->motion.state & SDL_BUTTON(1))
221 touchscreen_event(event->motion.x, event->motion.y); 221 {
222 int x = event->motion.x / display_zoom;
223 int y = event->motion.y / display_zoom;
224 touchscreen_event(x, y);
225 }
222 break; 226 break;
223#endif 227#endif
224 228
225 case SDL_MOUSEBUTTONUP: 229 case SDL_MOUSEBUTTONUP:
226 case SDL_MOUSEBUTTONDOWN: 230 case SDL_MOUSEBUTTONDOWN:
227 mouse_event(&event->button, event->type == SDL_MOUSEBUTTONUP); 231 {
232 SDL_MouseButtonEvent *mev = &event->button;
233 mev->x /= display_zoom;
234 mev->y /= display_zoom;
235 mouse_event(mev, event->type == SDL_MOUSEBUTTONUP);
228 break; 236 break;
229 237 }
230 case SDL_QUIT: 238 case SDL_QUIT:
231 return true; 239 return true;
232 } 240 }