From e3c96c391c5e76274a0b4e4d052f5062187f00d3 Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 24 Aug 2018 11:47:25 +0800 Subject: [PATCH] EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1118 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Reviewed-by: Hao Wu Cc: Andrew Fish --- EmulatorPkg/Win/Host/WinGopInput.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/EmulatorPkg/Win/Host/WinGopInput.c b/EmulatorPkg/Win/Host/WinGopInput.c index 6c218ab98a..17d35bb52c 100644 --- a/EmulatorPkg/Win/Host/WinGopInput.c +++ b/EmulatorPkg/Win/Host/WinGopInput.c @@ -363,6 +363,23 @@ WinNtWndKeySetState ( GRAPHICS_PRIVATE_DATA *Private; Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo); + Private->ScrollLock = FALSE; + Private->NumLock = FALSE; + Private->CapsLock = FALSE; + Private->IsPartialKeySupport = FALSE; + + if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) { + Private->ScrollLock = TRUE; + } + if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) { + Private->NumLock = TRUE; + } + if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) { + Private->CapsLock = TRUE; + } + if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) { + Private->IsPartialKeySupport = TRUE; + } Private->KeyState.KeyToggleState = *KeyToggleState; return EFI_SUCCESS; }