move WaitForInputEventPoll.

This commit is contained in:
jief 2020-04-26 12:36:21 +03:00
parent b609bfef1c
commit 4a9a99873d
3 changed files with 32 additions and 33 deletions

View File

@ -703,6 +703,38 @@ UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc)
}
// TimeoutDefault for a wait in seconds
// return EFI_TIMEOUT if no inputs
//the function must be in menu class
//so UpdatePointer(); => mPointer.Update(&gItemID, &Screen->mAction);
EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefault)
{
REFIT_MENU_SCREEN& Screen = *ScreenPtr;
EFI_STATUS Status = EFI_SUCCESS;
UINTN TimeoutRemain = TimeoutDefault * 100;
while (TimeoutRemain != 0) {
Status = WaitFor2EventWithTsc (gST->ConIn->WaitForKey, NULL, 10);
if (Status != EFI_TIMEOUT) {
break;
}
Screen.UpdateFilm();
if (gSettings.PlayAsync) {
CheckSyncSound();
}
TimeoutRemain--;
if (Screen.mPointer.isAlive()) {
Screen.mPointer.UpdatePointer();
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
break;
}
}
}
return Status;
}
UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
{
EFI_STATUS Status;

View File

@ -1064,37 +1064,6 @@ WaitFor2EventWithTsc (
#define ONE_SECOND 10000000
#define ONE_MSECOND 10000
// TimeoutDefault for a wait in seconds
// return EFI_TIMEOUT if no inputs
//the function must be in menu class
//so UpdatePointer(); => mPointer.Update(&gItemID, &Screen->mAction);
EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefault)
{
REFIT_MENU_SCREEN& Screen = *ScreenPtr;
EFI_STATUS Status = EFI_SUCCESS;
UINTN TimeoutRemain = TimeoutDefault * 100;
while (TimeoutRemain != 0) {
Status = WaitFor2EventWithTsc (gST->ConIn->WaitForKey, NULL, 10);
if (Status != EFI_TIMEOUT) {
break;
}
Screen.UpdateFilm();
if (gSettings.PlayAsync) {
CheckSyncSound();
}
TimeoutRemain--;
if (Screen.mPointer.isAlive()) {
Screen.mPointer.UpdatePointer();
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
break;
}
}
}
return Status;
}
BOOLEAN
SetPageBreak (

View File

@ -286,8 +286,6 @@ WaitFor2EventWithTsc (
IN UINT64 Timeout OPTIONAL
);
EFI_STATUS
WaitForInputEventPoll(REFIT_MENU_SCREEN *Screen, UINTN TimeoutDefault);
//VOID LowCase (IN OUT CHAR8 *Str);
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len);