summaryrefslogtreecommitdiff
path: root/apps/gui/quickscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/quickscreen.c')
-rw-r--r--apps/gui/quickscreen.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 402b1e2585..863bd54be4 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -285,15 +285,8 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
285 talk_qs_option((struct settings_list *)qs->items[item], false); 285 talk_qs_option((struct settings_list *)qs->items[item], false);
286 return true; 286 return true;
287} 287}
288#ifdef HAVE_TOUCHSCREEN
289/* figure out which button was pressed... */
290static bool xy_is_within_viewport(int x, int y, const struct viewport *vp)
291{
292 bool is_x = (x > vp->x && x < (vp->x + vp->width));
293 bool is_y = (y > vp->y && y < (vp->y + vp->height));
294 return (is_x && is_y);
295}
296 288
289#ifdef HAVE_TOUCHSCREEN
297static int quickscreen_touchscreen_button(const struct viewport 290static int quickscreen_touchscreen_button(const struct viewport
298 vps[QUICKSCREEN_ITEM_COUNT]) 291 vps[QUICKSCREEN_ITEM_COUNT])
299{ 292{
@@ -301,17 +294,18 @@ static int quickscreen_touchscreen_button(const struct viewport
301 /* only hitting the text counts, everything else is exit */ 294 /* only hitting the text counts, everything else is exit */
302 if (action_get_touchscreen_press(&x, &y) != BUTTON_REL) 295 if (action_get_touchscreen_press(&x, &y) != BUTTON_REL)
303 return ACTION_NONE; 296 return ACTION_NONE;
304 else if (xy_is_within_viewport(x,y,&vps[QUICKSCREEN_TOP])) 297 else if (viewport_point_within_vp(&vps[QUICKSCREEN_TOP], x, y))
305 return ACTION_QS_TOP; 298 return ACTION_QS_TOP;
306 else if (xy_is_within_viewport(x,y,&vps[QUICKSCREEN_BOTTOM])) 299 else if (viewport_point_within_vp(&vps[QUICKSCREEN_BOTTOM], x, y))
307 return ACTION_QS_DOWN; 300 return ACTION_QS_DOWN;
308 else if (xy_is_within_viewport(x,y,&vps[QUICKSCREEN_LEFT])) 301 else if (viewport_point_within_vp(&vps[QUICKSCREEN_LEFT], x, y))
309 return ACTION_QS_LEFT; 302 return ACTION_QS_LEFT;
310 else if (xy_is_within_viewport(x,y,&vps[QUICKSCREEN_RIGHT])) 303 else if (viewport_point_within_vp(&vps[QUICKSCREEN_RIGHT], x, y))
311 return ACTION_QS_RIGHT; 304 return ACTION_QS_RIGHT;
312 return ACTION_STD_CANCEL; 305 return ACTION_STD_CANCEL;
313} 306}
314#endif 307#endif
308
315static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) 309static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
316{ 310{
317 int button, i, j; 311 int button, i, j;