mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
Pickers: Replace OC_INPUT_EXTRA with better defined change detection
This commit is contained in:
parent
183e028a5f
commit
ef2db45050
@ -502,7 +502,9 @@ typedef INTN OC_KEY_CODE;
|
||||
typedef UINT16 OC_MODIFIER_MAP;
|
||||
|
||||
/**
|
||||
Full picker key info - OC and non-OC.
|
||||
Full picker key info.
|
||||
Note: Typing is 'orthogonal' to actions, and the presence or absence of a next
|
||||
typing key should be detected by TypingChar != '\0'.
|
||||
**/
|
||||
typedef struct {
|
||||
OC_KEY_CODE OcKeyCode;
|
||||
@ -1122,7 +1124,6 @@ OcLoadPickerHotKeys (
|
||||
#define OC_INPUT_TYPING_RIGHT -17 ///< Move right while typing (UI does not have to support)
|
||||
#define OC_INPUT_TYPING_CONFIRM -18 ///< Confirm input while typing (press enter)
|
||||
#define OC_INPUT_SWITCH_CONTEXT -19 ///< Switch context (tab and shift+tab)
|
||||
#define OC_INPUT_EXTRA -50 ///< No OC_INPUT value as above, but returned early to allow GUI to respond to modifiers or other keys
|
||||
#define OC_INPUT_FUNCTIONAL(x) (-50 - (x)) ///< Function hotkeys
|
||||
|
||||
/**
|
||||
@ -1200,8 +1201,10 @@ OcWaitForPickerKeyInfoGetEndTime(
|
||||
@param[in,out] PickerKeyInfo On input, old modifiers are noticed and used to return
|
||||
immediately on modifier changes.
|
||||
On output, the new picker key info.
|
||||
|
||||
@retval True if modifiers have changed.
|
||||
**/
|
||||
VOID
|
||||
BOOLEAN
|
||||
OcWaitForPickerKeyInfo (
|
||||
IN OUT OC_PICKER_CONTEXT *Context,
|
||||
IN UINT64 EndTime,
|
||||
|
||||
@ -575,11 +575,6 @@ OcGetPickerKeyInfo (
|
||||
}
|
||||
}
|
||||
|
||||
if (PickerKeyInfo->TypingChar != '\0') {
|
||||
PickerKeyInfo->OcKeyCode = OC_INPUT_EXTRA;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Return NO_ACTION here, since all non-null actions now feedback
|
||||
// immediately to either picker, to allow UI response.
|
||||
@ -599,7 +594,7 @@ OcWaitForPickerKeyInfoGetEndTime(
|
||||
return GetTimeInNanoSecond (GetPerformanceCounter ()) + Timeout * 1000000u;
|
||||
}
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
OcWaitForPickerKeyInfo (
|
||||
IN OUT OC_PICKER_CONTEXT *Context,
|
||||
IN UINT64 EndTime,
|
||||
@ -625,17 +620,11 @@ OcWaitForPickerKeyInfo (
|
||||
OcGetPickerKeyInfo (Context, FilterForTyping, PickerKeyInfo);
|
||||
|
||||
//
|
||||
// All non-null actions (even internal) are now returned to picker for possible UI response
|
||||
// All non-null actions (even internal) are now returned to picker for possible UI response.
|
||||
//
|
||||
if (PickerKeyInfo->OcKeyCode != OC_INPUT_NO_ACTION) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return modifiers if they change, so we can optionally update UI
|
||||
//
|
||||
if (PickerKeyInfo->OcModifiers != OldOcModifiers) {
|
||||
PickerKeyInfo->OcKeyCode = OC_INPUT_EXTRA;
|
||||
if (PickerKeyInfo->OcKeyCode != OC_INPUT_NO_ACTION ||
|
||||
PickerKeyInfo->OcModifiers != OldOcModifiers ||
|
||||
PickerKeyInfo->TypingChar != '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -659,4 +648,6 @@ OcWaitForPickerKeyInfo (
|
||||
}
|
||||
DEBUG_CODE_END ();
|
||||
}
|
||||
|
||||
return PickerKeyInfo->OcModifiers != OldOcModifiers;
|
||||
}
|
||||
|
||||
@ -297,6 +297,7 @@ OcShowSimpleBootMenu (
|
||||
BOOLEAN PlayedOnce;
|
||||
BOOLEAN PlayChosen;
|
||||
BOOLEAN IsTyping;
|
||||
BOOLEAN ModifiersChanged;
|
||||
#if defined(BUILTIN_DEMONSTRATE_TYPING)
|
||||
INT32 TypingColumn;
|
||||
INT32 TypingStartColumn;
|
||||
@ -509,7 +510,7 @@ OcShowSimpleBootMenu (
|
||||
KeyEndTime = 0;
|
||||
}
|
||||
|
||||
OcWaitForPickerKeyInfo (
|
||||
ModifiersChanged = OcWaitForPickerKeyInfo (
|
||||
BootContext->PickerContext,
|
||||
KeyEndTime,
|
||||
IsTyping,
|
||||
@ -576,10 +577,6 @@ OcShowSimpleBootMenu (
|
||||
}
|
||||
#endif
|
||||
|
||||
if (PickerKeyInfo.OcKeyCode == OC_INPUT_EXTRA) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (PlayChosen && PickerKeyInfo.OcKeyCode == OC_INPUT_TIMEOUT) {
|
||||
OcPlayAudioFile (BootContext->PickerContext, OcVoiceOverAudioFileSelected, FALSE);
|
||||
OcPlayAudioEntry (BootContext->PickerContext, BootEntries[ChosenEntry]);
|
||||
@ -664,11 +661,15 @@ OcShowSimpleBootMenu (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (TimeOutSeconds > 0) {
|
||||
if (PickerKeyInfo.OcKeyCode != OC_INPUT_NO_ACTION && TimeOutSeconds > 0) {
|
||||
OcPlayAudioFile (BootContext->PickerContext, OcVoiceOverAudioFileAbortTimeout, FALSE);
|
||||
TimeOutSeconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ModifiersChanged || PickerKeyInfo.TypingChar != '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user