From ac41940a515d28ebe5246a1b689b345e616bb00a Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Thu, 27 Oct 2016 16:59:37 +0100 Subject: [PATCH] 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 --- refind/menu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.2