From 346503cd41793fe6a7dfe7de6d018032d10cda97 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 5 Sep 2015 00:50:51 -0700 Subject: [PATCH] GUI: Fix non-touch support --- src/platform/3ds/main.c | 2 +- src/platform/psp2/main.c | 2 +- src/util/gui.c | 2 +- src/util/gui/menu.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index 5b99ff675..b35005b33 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -238,7 +238,7 @@ static uint32_t _pollInput(void) { static enum GUICursorState _pollCursor(int* x, int* y) { hidScanInput(); if (!(hidKeysHeld() & KEY_TOUCH)) { - return GUI_CURSOR_UP; + return GUI_CURSOR_NOT_PRESENT; } touchPosition pos; hidTouchRead(&pos); diff --git a/src/platform/psp2/main.c b/src/platform/psp2/main.c index 0dd1ad8a8..e1ca9285e 100644 --- a/src/platform/psp2/main.c +++ b/src/platform/psp2/main.c @@ -68,7 +68,7 @@ static enum GUICursorState _pollCursor(int* x, int* y) { SceTouchData touch; sceTouchPeek(0, &touch, 1); if (touch.reportNum < 1) { - return GUI_CURSOR_UP; + return GUI_CURSOR_NOT_PRESENT; } *x = touch.report[0].x / 2; *y = touch.report[0].y / 2; diff --git a/src/util/gui.c b/src/util/gui.c index 85c09a1c7..b391876b6 100644 --- a/src/util/gui.c +++ b/src/util/gui.c @@ -43,7 +43,7 @@ enum GUICursorState GUIPollCursor(struct GUIParams* params, int* x, int* y) { params->cursorState = GUI_CURSOR_DRAGGING; return GUI_CURSOR_DRAGGING; } - if (state == GUI_CURSOR_UP) { + if (state == GUI_CURSOR_UP || state == GUI_CURSOR_NOT_PRESENT) { params->cursorState = GUI_CURSOR_UP; return GUI_CURSOR_CLICKED; } diff --git a/src/util/gui/menu.c b/src/util/gui/menu.c index 9481cbd70..ab9ad8846 100644 --- a/src/util/gui/menu.c +++ b/src/util/gui/menu.c @@ -80,7 +80,7 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men return GUI_MENU_EXIT_ACCEPT; } } - if ((cursorOverItem == 1 && cursor == GUI_CURSOR_UP)) { + if (cursorOverItem == 1 && (cursor == GUI_CURSOR_UP || cursor == GUI_CURSOR_NOT_PRESENT)) { cursorOverItem = 2; } if (newInput & (1 << GUI_INPUT_BACK)) {