From: Tom Briden Date: Thu, 27 Oct 2016 15:59:37 +0000 (+0100) Subject: Use AbsoluteMaxX and Y to determine actual screen position touched X-Git-Url: https://code.delx.au/refind/commitdiff_plain/ac41940a515d28ebe5246a1b689b345e616bb00a Use AbsoluteMaxX and Y to determine actual screen position touched If the AbsoluteMax doesn't match the screen resolution then the touch position passed in to FindMainMenuItem is totally wrong --- diff --git a/refind/menu.c b/refind/menu.c index 4191e5d..4719228 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -614,7 +614,11 @@ 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 + UINT32 TouchScreenPosX = (TouchState.CurrentX * UGAWidth) / TouchProtocol->Mode->AbsoluteMaxX; + UINT32 TouchScreenPosY = (TouchState.CurrentY * UGAHeight) / TouchProtocol->Mode->AbsoluteMaxY; + + UINTN Item = FindMainMenuItem(Screen, &State, TouchScreenPosX, TouchScreenPosY); switch (Item) { case TOUCH_NO_ITEM: //do nothing