summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-10-07 23:38:01 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-11-21 20:26:21 +0000
commit3f966b2aa45755cd7788ea71eeea6a5d64bb827f (patch)
tree1c4ebf2414995886c77d6ada859e821514d497d4 /apps
parentbff63a4f909770d86b12217e9003a22c54789c7b (diff)
downloadrockbox-3f966b2aa45755cd7788ea71eeea6a5d64bb827f.tar.gz
rockbox-3f966b2aa45755cd7788ea71eeea6a5d64bb827f.zip
touchscreen: make quickscreen easier to use
In absolute pointing mode, the quickscreen now accepts a touch anywhere in the middle third of the screen edge to trigger an item, and pressing anywhere else on the 'grid' will exit -- the same as how 3x3 mode works. Previously it required a touch inside the text viewport to trigger an item, and exited after any touch outside the viewports. This made it very difficult to use since the text viewports are too small to reliably touch. Change-Id: I971eaeb4a2c67bebef3d7b070a29b897df07b8e7
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/quickscreen.c24
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
285static int quickscreen_touchscreen_button(const struct viewport 285static 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 {