summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2018-03-13 15:39:47 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2018-03-14 11:25:44 +0800
commit58793b8838f500955c8a7a548b4b450e81798f6e (patch)
tree667d3ef18e2f644e2fb99ebe301a7aa81a749e9a /ShellPkg/Library
parent81feb6d3059d6dfdfecd47f6b1f0c7d2b9f66e65 (diff)
downloadedk2-58793b8838f500955c8a7a548b4b450e81798f6e.zip
edk2-58793b8838f500955c8a7a548b4b450e81798f6e.tar.gz
edk2-58793b8838f500955c8a7a548b4b450e81798f6e.tar.bz2
ShellPkg/[hex]edit: Fix mouse freeze issue
In edit or hexedit, the mouse cursor doesn't move when moving the mouse. The root cause is 5563281fa2b31093a1cbd415553b9264c5136e89 * ShellPkg/[hex]edit: use SimpleTextInEx to read console wrongly uses WaitForEvent() to listen keyboard input. It blocks the code execution when there is no keyboard input. While the same function also polls the mouse move status, the mouse movement cannot be reflected to the screen when there is no keyboard input. The patch fixes the issue by use CheckEvent() instead of WaitForEvent(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c16
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c16
2 files changed, 18 insertions, 14 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
index 6832441..98e1331 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
@@ -1840,7 +1840,6 @@ MainEditorKeyInput (
EFI_KEY_DATA KeyData;
EFI_STATUS Status;
EFI_SIMPLE_POINTER_STATE MouseState;
- UINTN EventIndex;
BOOLEAN NoShiftState;
do {
@@ -1876,8 +1875,11 @@ MainEditorKeyInput (
}
}
- Status = gBS->WaitForEvent (1, &MainEditor.TextInputEx->WaitForKeyEx, &EventIndex);
- if (!EFI_ERROR (Status) && EventIndex == 0) {
+ //
+ // CheckEvent() returns Success when non-partial key is pressed.
+ //
+ Status = gBS->CheckEvent (MainEditor.TextInputEx->WaitForKeyEx);
+ if (!EFI_ERROR (Status)) {
Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData);
if (!EFI_ERROR (Status)) {
//
@@ -1917,11 +1919,11 @@ MainEditorKeyInput (
}
}
- //
- // after handling, refresh editor
- //
- MainEditorRefresh ();
}
+ //
+ // after handling, refresh editor
+ //
+ MainEditorRefresh ();
} while (Status != EFI_OUT_OF_RESOURCES && !EditorExit);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
index a2e52ea..1a89d3d 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
@@ -2108,7 +2108,6 @@ HMainEditorKeyInput (
EFI_KEY_DATA KeyData;
EFI_STATUS Status;
EFI_SIMPLE_POINTER_STATE MouseState;
- UINTN EventIndex;
BOOLEAN NoShiftState;
BOOLEAN LengthChange;
UINTN Size;
@@ -2268,8 +2267,11 @@ HMainEditorKeyInput (
}
}
- Status = gBS->WaitForEvent (1, &HMainEditor.TextInputEx->WaitForKeyEx, &EventIndex);
- if (!EFI_ERROR (Status) && EventIndex == 0) {
+ //
+ // CheckEvent() returns Success when non-partial key is pressed.
+ //
+ Status = gBS->CheckEvent (HMainEditor.TextInputEx->WaitForKeyEx);
+ if (!EFI_ERROR (Status)) {
Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData);
if (!EFI_ERROR (Status)) {
//
@@ -2351,11 +2353,11 @@ HMainEditorKeyInput (
}
}
}
- //
- // after handling, refresh editor
- //
- HMainEditorRefresh ();
}
+ //
+ // after handling, refresh editor
+ //
+ HMainEditorRefresh ();
} while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit);