Skip to content

Commit

Permalink
Fix event handling bug with touch and keyboard input (#620)
Browse files Browse the repository at this point in the history
## 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 <wenbhou@microsoft.com>
  • Loading branch information
2 people authored and ProjectMuBot committed Jan 21, 2025
1 parent 6975ce7 commit dcc962b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion MsGraphicsPkg/DisplayEngineDxe/FormDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ UiDisplayMenu (

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

gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
Expand Down Expand Up @@ -2292,9 +2294,24 @@ UiDisplayMenu (
{
if (InputState.State.TouchState.CurrentX >= mMasterFrameWidth) {
FormHasKeyFocus = TRUE;
} else {
FormHasKeyFocus = FALSE;
}

MasterFrameSharedState->ShowTopMenuHighlight = FALSE;

gUserInput->Action = BROWSER_ACTION_FORM_EXIT;

// Signal to the Top Menu to refresh to show the highlight.
//
MasterFrameSharedState->NotificationType = REDRAW;
CopyMem (&MasterFrameSharedState->InputState, &InputState, sizeof (SWM_INPUT_STATE));

// Signal FP that there's data for it to process.
//
gBS->SignalEvent (mMasterFrameNotifyEvent);

break;
}

default:
Expand Down

0 comments on commit dcc962b

Please sign in to comment.