[FREELDR] Check for any user keypress in menu even when the timeout is zero.

Before taking any default action if there is no timeout, check whether
the supplied key filter callback function may handle a specific user
keypress. If it does, the menu timeout is cancelled.

This allows e.g. handling F8 press for displaying boot options even when
the timeout is zero.

CORE-14046
This commit is contained in:
Hermès Bélusca-Maïto
2018-11-25 17:09:19 +01:00
parent a94d24fe20
commit f8d3f9de29
2 changed files with 57 additions and 0 deletions
+25
View File
@@ -556,6 +556,31 @@ UiDisplayMenu(IN PCSTR MenuHeader,
ULONG CurrentClockSecond;
ULONG KeyPress;
/*
* Before taking any default action if there is no timeout,
* check whether the supplied key filter callback function
* may handle a specific user keypress. If it does, the
* timeout is cancelled.
*/
if (!MenuTimeOut && KeyPressFilter && MachConsKbHit())
{
/* Get the key */
KeyPress = MachConsGetCh();
/* Is it extended? Then get the extended key */
if (!KeyPress) KeyPress = MachConsGetCh();
/*
* Call the supplied key filter callback function to see
* if it is going to handle this keypress.
*/
if (KeyPressFilter(KeyPress))
{
/* It processed the key character, cancel the timeout */
MenuTimeOut = -1;
}
}
/* Check if there's no timeout */
if (!MenuTimeOut)
{
+32
View File
@@ -30,8 +30,40 @@ TuiDisplayMenu(PCSTR MenuHeader,
ULONG CurrentClockSecond;
ULONG KeyPress;
//
// Before taking any default action if there is no timeout,
// check whether the supplied key filter callback function
// may handle a specific user keypress. If it does, the
// timeout is cancelled.
//
if (!MenuTimeOut && KeyPressFilter && MachConsKbHit())
{
//
// Get the key
//
KeyPress = MachConsGetCh();
//
// Is it extended? Then get the extended key
//
if (!KeyPress) KeyPress = MachConsGetCh();
//
// Call the supplied key filter callback function to see
// if it is going to handle this keypress.
//
if (KeyPressFilter(KeyPress))
{
//
// It processed the key character, cancel the timeout
//
MenuTimeOut = -1;
}
}
//
// Check if there's no timeout
//
if (!MenuTimeOut)
{
//