summaryrefslogtreecommitdiffstats
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
parentbff63a4f909770d86b12217e9003a22c54789c7b (diff)
downloadrockbox-3f966b2aa4.tar.gz
rockbox-3f966b2aa4.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
-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)
}
#ifdef HAVE_TOUCHSCREEN
-static int quickscreen_touchscreen_button(const struct viewport
- vps[QUICKSCREEN_ITEM_COUNT])
+static int quickscreen_touchscreen_button(void)
{
short x,y;
/* only hitting the text counts, everything else is exit */
if (action_get_touchscreen_press(&x, &y) != BUTTON_REL)
return ACTION_NONE;
- else if (viewport_point_within_vp(&vps[QUICKSCREEN_TOP], x, y))
+
+ enum { left=1, right=2, top=4, bottom=8 };
+
+ int bits = (x < LCD_WIDTH/3 ? left : (x > 2*LCD_WIDTH/3 ? 2 : right)) |
+ (y < LCD_WIDTH/3 ? top : (y > 2*LCD_WIDTH/3 ? 8 : bottom));
+
+ switch(bits) {
+ case top:
return ACTION_QS_TOP;
- else if (viewport_point_within_vp(&vps[QUICKSCREEN_BOTTOM], x, y))
+ case bottom:
return ACTION_QS_DOWN;
- else if (viewport_point_within_vp(&vps[QUICKSCREEN_LEFT], x, y))
+ case left:
return ACTION_QS_LEFT;
- else if (viewport_point_within_vp(&vps[QUICKSCREEN_RIGHT], x, y))
+ case right:
return ACTION_QS_RIGHT;
- return ACTION_STD_CANCEL;
+ default:
+ return ACTION_STD_CANCEL;
+ }
}
#endif
@@ -339,7 +347,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
button = get_action(CONTEXT_QUICKSCREEN, HZ/5);
#ifdef HAVE_TOUCHSCREEN
if (button == ACTION_TOUCHSCREEN)
- button = quickscreen_touchscreen_button(vps[SCREEN_MAIN]);
+ button = quickscreen_touchscreen_button();
#endif
if (default_event_handler(button) == SYS_USB_CONNECTED)
{