* [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue
@ 2017-08-04 4:02 Dandan Bi
2017-08-04 4:28 ` Dong, Eric
0 siblings, 1 reply; 2+ messages in thread
From: Dandan Bi @ 2017-08-04 4:02 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
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>
---
.../Universal/DisplayEngineDxe/FormDisplay.c | 62 ++++++++++++++++++----
1 file changed, 52 insertions(+), 10 deletions(-)
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index dc4ae4b..bbb2675 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1716,27 +1716,60 @@ IsTopOfScreeMenuOption (
return FALSE;
}
/**
- 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);
while (!IsTopOfScreeMenuOption(MenuOption)) {
@@ -1752,11 +1785,20 @@ 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;
}
@@ -1803,11 +1845,11 @@ FindTopMenu (
UpdateOptionSkipLines (MenuOption);
//
// Found the last time highlight menu.
//
- *TopOfScreen = FindTopOfScreenMenuOption();
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
if (*TopOfScreen != NULL) {
//
// Found the last time selectable top of screen menu.
//
AdjustDateAndTimePosition(TRUE, TopOfScreen);
@@ -1856,11 +1898,11 @@ FindTopMenu (
// Update skip info for this highlight menu.
//
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
// to find the new top of screen menu.
// Make the current highlight menu at the bottom of the form to calculate the
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue
2017-08-04 4:02 [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue Dandan Bi
@ 2017-08-04 4:28 ` Dong, Eric
0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2017-08-04 4:28 UTC (permalink / raw)
To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Gao, Liming
Reviewed-by: Eric Dong <eric.dong@intel.com>
-----Original Message-----
From: Bi, Dandan
Sent: Friday, August 4, 2017 12:02 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH V3] 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>
---
.../Universal/DisplayEngineDxe/FormDisplay.c | 62 ++++++++++++++++++----
1 file changed, 52 insertions(+), 10 deletions(-)
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index dc4ae4b..bbb2675 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1716,27 +1716,60 @@ IsTopOfScreeMenuOption (
return FALSE;
}
/**
- 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);
while (!IsTopOfScreeMenuOption(MenuOption)) { @@ -1752,11 +1785,20 @@ 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;
}
@@ -1803,11 +1845,11 @@ FindTopMenu (
UpdateOptionSkipLines (MenuOption);
//
// Found the last time highlight menu.
//
- *TopOfScreen = FindTopOfScreenMenuOption();
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
if (*TopOfScreen != NULL) {
//
// Found the last time selectable top of screen menu.
//
AdjustDateAndTimePosition(TRUE, TopOfScreen); @@ -1856,11 +1898,11 @@ FindTopMenu (
// Update skip info for this highlight menu.
//
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
// to find the new top of screen menu.
// Make the current highlight menu at the bottom of the form to calculate the
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-04 4:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-04 4:02 [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue Dandan Bi
2017-08-04 4:28 ` Dong, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox