Skip to content

Commit

Permalink
Fix event handling bug with touch and keyboard input.
Browse files Browse the repository at this point in the history
Fix the bug in event handling that occurs when alternating between touch and keyboard inputs, ensuring seamless interaction.
  • Loading branch information
Wenbo Hou authored and makubacki committed Jan 21, 2025
1 parent ab34fe5 commit 7ab78cc
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions 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,7 +2196,8 @@ UiDisplayMenu (
//
if (SWM_INPUT_TYPE_TOUCH == InputState.InputType) {
MasterFrameSharedState->ShowTopMenuHighlight = FALSE;
FormHasKeyFocus = FALSE;
} else if (SWM_INPUT_TYPE_KEY == InputState.InputType) {
MasterFrameSharedState->ShowTopMenuHighlight = TRUE;
}

gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
Expand Down Expand Up @@ -2293,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 7ab78cc

Please sign in to comment.