summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c79
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h5
2 files changed, 69 insertions, 15 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 203b6b5138..fe3d875cd9 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1478,6 +1478,7 @@ FindTopMenu (
UI_MENU_OPTION *SavedMenuOption;
UINTN TmpValue;
+ TmpValue = 0;
TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;
@@ -1521,19 +1522,37 @@ FindTopMenu (
UpdateOptionSkipLines (SavedMenuOption);
//
- // If highlight opcode is date/time, keep the highlight row info not change.
+ // FormRefreshEvent != NULL means this form will auto exit at an interval, display engine
+ // will try to keep highlight on the current position after this form exit and re-enter.
//
- if ((SavedMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP || SavedMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP) &&
- (gHighligthMenuInfo.QuestionId != 0) &&
- (gHighligthMenuInfo.QuestionId == GetQuestionIdInfo(SavedMenuOption->ThisTag->OpCode))) {
- //
- // Still show the highlight menu before exit from display engine.
- //
- BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;
+ // HiiHandle + QuestionId can find the only one question in the system.
+ //
+ // If this question has question id, save the question id info to find the question.
+ // else save the opcode buffer to find it.
+ //
+ if (gFormData->FormRefreshEvent != NULL && gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle) {
+ if (gHighligthMenuInfo.QuestionId != 0) {
+ if (gHighligthMenuInfo.QuestionId == GetQuestionIdInfo(SavedMenuOption->ThisTag->OpCode)) {
+ BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;
+ //
+ // SkipValue only used for menu at the top of the form.
+ // If Highlight menu is not at the top, this value will be update later.
+ //
+ TmpValue = gHighligthMenuInfo.SkipValue;
+ }
+ } else if (gHighligthMenuInfo.OpCode != NULL){
+ if (!CompareMem (gHighligthMenuInfo.OpCode, SavedMenuOption->ThisTag->OpCode, gHighligthMenuInfo.OpCode->Length)) {
+ BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;
+ //
+ // SkipValue only used for menu at the top of the form.
+ // If Highlight menu is not at the top, this value will be update later.
+ //
+ TmpValue = gHighligthMenuInfo.SkipValue;
+ }
+ }
}
if (SavedMenuOption->Skip >= BottomRow - TopRow) {
- TmpValue = 0;
*TopOfScreen = NewPos;
} else {
*TopOfScreen = FindTopOfScreenMenu(NewPos, BottomRow - TopRow - SavedMenuOption->Skip, &TmpValue);
@@ -1547,11 +1566,14 @@ FindTopMenu (
Update highlight menu info.
@param MenuOption The menu opton which is highlight.
+ @param SkipValue The skipvalue info for this menu.
+ SkipValue only used for the menu at the top of the form.
**/
VOID
UpdateHighlightMenuInfo (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption,
+ IN UINTN SkipValue
)
{
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
@@ -1568,14 +1590,39 @@ UpdateHighlightMenuInfo (
gSequence = (UINT16) MenuOption->Sequence;
//
- // Record highlight row info for date/time opcode.
+ // FormRefreshEvent != NULL means this form will auto exit at an interval, display engine
+ // will try to keep highlight on the current position after this form exit and re-enter.
//
- if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ // HiiHandle + QuestionId can find the only one question in the system.
+ //
+ // If this question has question id, base on the question id info to find the question.
+ // else base on the opcode buffer to find it.
+ //
+ if (gFormData->FormRefreshEvent != NULL) {
+ gHighligthMenuInfo.HiiHandle = gFormData->HiiHandle;
gHighligthMenuInfo.QuestionId = GetQuestionIdInfo(Statement->OpCode);
+
+ //
+ // if question id == 0, save the opcode buffer for later use.
+ //
+ if (gHighligthMenuInfo.QuestionId == 0) {
+ if (gHighligthMenuInfo.OpCode != NULL) {
+ FreePool (gHighligthMenuInfo.OpCode);
+ }
+ gHighligthMenuInfo.OpCode = AllocateCopyPool (Statement->OpCode->Length, Statement->OpCode);
+ ASSERT (gHighligthMenuInfo.OpCode != NULL);
+ }
gHighligthMenuInfo.DisplayRow = (UINT16) MenuOption->Row;
+ gHighligthMenuInfo.SkipValue = (UINT16) SkipValue;
} else {
+ gHighligthMenuInfo.HiiHandle = NULL;
gHighligthMenuInfo.QuestionId = 0;
+ if (gHighligthMenuInfo.OpCode != NULL) {
+ FreePool (gHighligthMenuInfo.OpCode);
+ gHighligthMenuInfo.OpCode = NULL;
+ }
gHighligthMenuInfo.DisplayRow = 0;
+ gHighligthMenuInfo.SkipValue = 0;
}
RefreshKeyHelp(gFormData, Statement, FALSE);
@@ -2252,7 +2299,7 @@ UiDisplayMenu (
if (SkipHighLight) {
MenuOption = SavedMenuOption;
SkipHighLight = FALSE;
- UpdateHighlightMenuInfo (MenuOption);
+ UpdateHighlightMenuInfo (MenuOption, TopOfScreen == &MenuOption->Link ? SkipValue : 0);
break;
}
@@ -2296,7 +2343,7 @@ UiDisplayMenu (
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
Statement = MenuOption->ThisTag;
- UpdateHighlightMenuInfo (MenuOption);
+ UpdateHighlightMenuInfo (MenuOption, Temp2);
if (!IsSelectable (MenuOption)) {
break;
@@ -3393,5 +3440,9 @@ UnloadDisplayEngine (
FreeDisplayStrings ();
+ if (gHighligthMenuInfo.OpCode != NULL) {
+ FreePool (gHighligthMenuInfo.OpCode);
+ }
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
index 45bcadc7e6..a0638caf5a 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
@@ -1,7 +1,7 @@
/** @file
FormDiplay protocol to show Form
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -194,8 +194,11 @@ typedef struct {
} SCREEN_OPERATION_T0_CONTROL_FLAG;
typedef struct {
+ EFI_HII_HANDLE HiiHandle;
EFI_QUESTION_ID QuestionId;
+ EFI_IFR_OP_HEADER *OpCode;
UINT16 DisplayRow;
+ UINT16 SkipValue;
} DISPLAY_HIGHLIGHT_MENU_INFO;
#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')