X-Git-Url: https://code.delx.au/refind/blobdiff_plain/dd910ca40c3ea630983ad18cf1a23e0afe38ffe9..278bed1cfa0a2bc31db18617cad24170014c05b3:/refind/menu.c diff --git a/refind/menu.c b/refind/menu.c index 762fd7a..fe4cf7d 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -34,7 +34,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * Modifications copyright (c) 2012-2015 Roderick W. Smith + * Modifications copyright (c) 2012-2017 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public * License (GPL) version 3 (GPLv3), or (at your option) any later version. @@ -394,9 +394,11 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty CHAR16 TimeoutMessage[256]; CHAR16 KeyAsString[2]; UINTN MenuExit; - - EFI_STATUS TouchStatus = EFI_NOT_READY; - EFI_ABSOLUTE_POINTER_STATE *TouchState = NULL; + EFI_STATUS TouchStatus = EFI_NOT_READY; + EFI_ABSOLUTE_POINTER_STATE TouchState; + UINT32 TouchScreenPosX; + UINT32 TouchScreenPosY; + UINTN Item; if (Screen->TimeoutSeconds > 0) { HaveTimeout = TRUE; @@ -469,7 +471,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty // read key press or touch event (and wait for them if applicable) if(TouchEnabled) { - TouchStatus = refit_call2_wrapper(TouchProtocol->GetState, TouchProtocol, TouchState); + TouchStatus = refit_call2_wrapper(TouchProtocol->GetState, TouchProtocol, &TouchState); } Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &key); @@ -600,7 +602,11 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty case ' ': MenuExit = MENU_EXIT_ENTER; break; + case CHAR_BACKSPACE: + MenuExit = MENU_EXIT_ESCAPE; + break; case '+': + case CHAR_TAB: MenuExit = MENU_EXIT_DETAILS; break; default: @@ -614,7 +620,10 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty break; } } else { //react to touch event - UINTN Item = FindMainMenuItem(Screen, &State, TouchState->CurrentX, TouchState->CurrentY); + //the TouchProtocol min/max may not match the screen size + TouchScreenPosX = ((UINT32) TouchState.CurrentX * UGAWidth) / (UINT32) TouchProtocol->Mode->AbsoluteMaxX; + TouchScreenPosY = ((UINT32) TouchState.CurrentY * UGAHeight) / (UINT32) TouchProtocol->Mode->AbsoluteMaxY; + Item = FindMainMenuItem(Screen, &State, TouchScreenPosX, TouchScreenPosY); switch (Item) { case TOUCH_NO_ITEM: //do nothing