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
This commit is contained in:
parent
bff63a4f90
commit
3f966b2aa4
1 changed files with 16 additions and 8 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue