diff options
-rw-r--r-- | apps/gui/quickscreen.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index c6da1bb8dc..b2f5050ab3 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -282,22 +282,30 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | #ifdef HAVE_TOUCHSCREEN | 284 | #ifdef HAVE_TOUCHSCREEN |
285 | static int quickscreen_touchscreen_button(const struct viewport | 285 | static int quickscreen_touchscreen_button(void) |
286 | vps[QUICKSCREEN_ITEM_COUNT]) | ||
287 | { | 286 | { |
288 | short x,y; | 287 | short x,y; |
289 | /* only hitting the text counts, everything else is exit */ | 288 | /* only hitting the text counts, everything else is exit */ |
290 | if (action_get_touchscreen_press(&x, &y) != BUTTON_REL) | 289 | if (action_get_touchscreen_press(&x, &y) != BUTTON_REL) |
291 | return ACTION_NONE; | 290 | return ACTION_NONE; |
292 | else if (viewport_point_within_vp(&vps[QUICKSCREEN_TOP], x, y)) | 291 | |
292 | enum { left=1, right=2, top=4, bottom=8 }; | ||
293 | |||
294 | int bits = (x < LCD_WIDTH/3 ? left : (x > 2*LCD_WIDTH/3 ? 2 : right)) | | ||
295 | (y < LCD_WIDTH/3 ? top : (y > 2*LCD_WIDTH/3 ? 8 : bottom)); | ||
296 | |||
297 | switch(bits) { | ||
298 | case top: | ||
293 | return ACTION_QS_TOP; | 299 | return ACTION_QS_TOP; |
294 | else if (viewport_point_within_vp(&vps[QUICKSCREEN_BOTTOM], x, y)) | 300 | case bottom: |
295 | return ACTION_QS_DOWN; | 301 | return ACTION_QS_DOWN; |
296 | else if (viewport_point_within_vp(&vps[QUICKSCREEN_LEFT], x, y)) | 302 | case left: |
297 | return ACTION_QS_LEFT; | 303 | return ACTION_QS_LEFT; |
298 | else if (viewport_point_within_vp(&vps[QUICKSCREEN_RIGHT], x, y)) | 304 | case right: |
299 | return ACTION_QS_RIGHT; | 305 | return ACTION_QS_RIGHT; |
300 | return ACTION_STD_CANCEL; | 306 | default: |
307 | return ACTION_STD_CANCEL; | ||
308 | } | ||
301 | } | 309 | } |
302 | #endif | 310 | #endif |
303 | 311 | ||
@@ -339,7 +347,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente | |||
339 | button = get_action(CONTEXT_QUICKSCREEN, HZ/5); | 347 | button = get_action(CONTEXT_QUICKSCREEN, HZ/5); |
340 | #ifdef HAVE_TOUCHSCREEN | 348 | #ifdef HAVE_TOUCHSCREEN |
341 | if (button == ACTION_TOUCHSCREEN) | 349 | if (button == ACTION_TOUCHSCREEN) |
342 | button = quickscreen_touchscreen_button(vps[SCREEN_MAIN]); | 350 | button = quickscreen_touchscreen_button(); |
343 | #endif | 351 | #endif |
344 | if (default_event_handler(button) == SYS_USB_CONNECTED) | 352 | if (default_event_handler(button) == SYS_USB_CONNECTED) |
345 | { | 353 | { |