summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2017-07-28 10:40:14 +0800
committerHao Wu <hao.a.wu@intel.com>2017-08-04 14:32:43 +0800
commitef3d1df77bbd5227c76306e5c64c66d82805bbd9 (patch)
tree3bc68a17b5902f4847fa83098803a7ebc00ba465 /MdeModulePkg
parentba78032bc8c9f74a4c4cc4917a3284a51840ec70 (diff)
downloadedk2-ef3d1df77bbd5227c76306e5c64c66d82805bbd9.tar.gz
edk2-ef3d1df77bbd5227c76306e5c64c66d82805bbd9.tar.bz2
edk2-ef3d1df77bbd5227c76306e5c64c66d82805bbd9.zip
MdeModulePkg/DisplayEngine: Fix incorrect display issue
In a form, some new menus may be dynamically inserted between highlight menu and previous top of screen menu when some question are refreshed. So the highlight menu and previous top of screen menu perhaps can't be shown in one page. Existing codes miss to handle this case then will cause incorrect display.This patch is to fix this display issue. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c62
1 files changed, 52 insertions, 10 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index dc4ae4bda1..bbb2675697 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1718,23 +1718,56 @@ IsTopOfScreeMenuOption (
}
/**
- Find the Top of screen menu.
+ Calculate the distance between two menus and include the skip value of StartMenu.
- If the input is NULL, base on the record highlight info in
- gHighligthMenuInfo to find the last highlight menu.
+ @param StartMenu The link_entry pointer to start menu.
+ @param EndMenu The link_entry pointer to end menu.
- @param HighLightedStatement The input highlight statement.
+**/
+UINTN
+GetDistanceBetweenMenus(
+ IN LIST_ENTRY *StartMenu,
+ IN LIST_ENTRY *EndMenu
+)
+{
+ LIST_ENTRY *Link;
+ UI_MENU_OPTION *MenuOption;
+ UINTN Distance;
- @retval The highlight menu index.
+ Distance = 0;
+
+ Link = StartMenu;
+ while (Link != EndMenu) {
+ MenuOption = MENU_OPTION_FROM_LINK (Link);
+ if (MenuOption->Row == 0) {
+ UpdateOptionSkipLines (MenuOption);
+ }
+ Distance += MenuOption->Skip;
+ Link = Link->BackLink;
+ }
+ return Distance;
+}
+
+/**
+ Find the top of screen menu base on the previous record menu info.
+
+ @param HighLightMenu The link_entry pointer to highlight menu.
+
+ @retval Return the the link_entry pointer top of screen menu.
**/
LIST_ENTRY *
FindTopOfScreenMenuOption (
- VOID
- )
+ IN LIST_ENTRY *HighLightMenu
+ )
{
LIST_ENTRY *NewPos;
UI_MENU_OPTION *MenuOption;
+ UINTN TopRow;
+ UINTN BottomRow;
+
+ TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
+ BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;
NewPos = gMenuOption.ForwardLink;
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
@@ -1754,7 +1787,16 @@ FindTopOfScreenMenuOption (
// Last time top of screen menu has disappeared.
//
if (NewPos == &gMenuOption) {
- NewPos = NULL;
+ return NULL;
+ }
+ //
+ // Check whether highlight menu and top of screen menu can be shown within one page,
+ // if can't, return NULL to re-calcaulate the top of scrren menu. Because some new menus
+ // may be dynamically inserted between highlightmenu and previous top of screen menu,
+ // So previous record top of screen menu is not appropriate for current display.
+ //
+ if (GetDistanceBetweenMenus (HighLightMenu, NewPos) + 1 > BottomRow - TopRow) {
+ return NULL;
}
return NewPos;
@@ -1805,7 +1847,7 @@ FindTopMenu (
//
// Found the last time highlight menu.
//
- *TopOfScreen = FindTopOfScreenMenuOption();
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
if (*TopOfScreen != NULL) {
//
// Found the last time selectable top of screen menu.
@@ -1858,7 +1900,7 @@ FindTopMenu (
MenuOption = MENU_OPTION_FROM_LINK (*HighlightMenu);
UpdateOptionSkipLines (MenuOption);
- *TopOfScreen = FindTopOfScreenMenuOption();
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
if (*TopOfScreen == NULL) {
//
// Not found last time top of screen menu, so base on current highlight menu