Skip to content

Commit f3e3c50

Browse files
wenbhouWenbo Hou
andauthored
Fix event handling bug with touch and keyboard input (#620)
## Description Fixes #621 Fix the bug in event handling that occurs when alternating between touch and keyboard inputs, ensuring seamless interaction. - [x] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? - [x] Backport to release branch? ## How This Was Tested Tested on Surface Laptop and Surface Pro. Booted to UEFI front page and alternated between Touchpad and Keyboard for operation. The interaction was seamless. ## Integration Instructions N/A --------- Co-authored-by: Wenbo Hou <[email protected]>
1 parent 32dcdcc commit f3e3c50

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

MsGraphicsPkg/DisplayEngineDxe/FormDisplay.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ UiDisplayMenu (
21872187

21882188
// Check whether the event should be forwarded to the Master Frame instead of the form canvas.
21892189
//
2190-
if (((SWM_INPUT_TYPE_TOUCH == InputState.InputType) && (InputState.State.TouchState.CurrentX < mMasterFrameWidth)) ||
2190+
if (((SWM_INPUT_TYPE_TOUCH == InputState.InputType) && (FALSE == FormHasKeyFocus) && (InputState.State.TouchState.CurrentX < mMasterFrameWidth)) ||
21912191
((SWM_INPUT_TYPE_KEY == InputState.InputType) && (FALSE == FormHasKeyFocus) && (CHAR_TAB != InputState.State.KeyState.Key.UnicodeChar)))
21922192
{
21932193
// If we're displaying the Top Menu highlight and the TAB or SHIFT+TAB is pressed, toggle the tab order highlight state.
@@ -2196,6 +2196,8 @@ UiDisplayMenu (
21962196
//
21972197
if (SWM_INPUT_TYPE_TOUCH == InputState.InputType) {
21982198
MasterFrameSharedState->ShowTopMenuHighlight = FALSE;
2199+
} else if (SWM_INPUT_TYPE_KEY == InputState.InputType) {
2200+
MasterFrameSharedState->ShowTopMenuHighlight = TRUE;
21992201
}
22002202

22012203
gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
@@ -2292,9 +2294,24 @@ UiDisplayMenu (
22922294
{
22932295
if (InputState.State.TouchState.CurrentX >= mMasterFrameWidth) {
22942296
FormHasKeyFocus = TRUE;
2297+
} else {
2298+
FormHasKeyFocus = FALSE;
22952299
}
22962300

22972301
MasterFrameSharedState->ShowTopMenuHighlight = FALSE;
2302+
2303+
gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
2304+
2305+
// Signal to the Top Menu to refresh to show the highlight.
2306+
//
2307+
MasterFrameSharedState->NotificationType = REDRAW;
2308+
CopyMem (&MasterFrameSharedState->InputState, &InputState, sizeof (SWM_INPUT_STATE));
2309+
2310+
// Signal FP that there's data for it to process.
2311+
//
2312+
gBS->SignalEvent (mMasterFrameNotifyEvent);
2313+
2314+
break;
22982315
}
22992316

23002317
default:

0 commit comments

Comments
 (0)