From nobody Mon May 6 00:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1501819381950886.2099097566833; Thu, 3 Aug 2017 21:03:01 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5E80C21D19944; Thu, 3 Aug 2017 21:00:47 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4E248209589C8 for ; Thu, 3 Aug 2017 21:00:46 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 03 Aug 2017 21:02:58 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga005.jf.intel.com with ESMTP; 03 Aug 2017 21:02:57 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,319,1498546800"; d="scan'208";a="133391272" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 4 Aug 2017 12:02:19 +0800 Message-Id: <1501819339-225636-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong --- .../Universal/DisplayEngineDxe/FormDisplay.c | 62 ++++++++++++++++++= ---- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeMod= ulePkg/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 ( =20 return FALSE; } =20 /** - Find the Top of screen menu. + Calculate the distance between two menus and include the skip value of S= tartMenu. =20 - 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. =20 - @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; =20 - @retval The highlight menu index. + Distance =3D 0; + + Link =3D StartMenu; + while (Link !=3D EndMenu) { + MenuOption =3D MENU_OPTION_FROM_LINK (Link); + if (MenuOption->Row =3D=3D 0) { + UpdateOptionSkipLines (MenuOption); + } + Distance +=3D MenuOption->Skip; + Link =3D 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. =20 **/ LIST_ENTRY * FindTopOfScreenMenuOption ( - VOID - ) + IN LIST_ENTRY *HighLightMenu + ) { LIST_ENTRY *NewPos; UI_MENU_OPTION *MenuOption; + UINTN TopRow; + UINTN BottomRow; + + TopRow =3D gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT; + BottomRow =3D gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT; =20 NewPos =3D gMenuOption.ForwardLink; MenuOption =3D MENU_OPTION_FROM_LINK (NewPos); =20 while (!IsTopOfScreeMenuOption(MenuOption)) { @@ -1752,11 +1785,20 @@ FindTopOfScreenMenuOption ( =20 // // Last time top of screen menu has disappeared. // if (NewPos =3D=3D &gMenuOption) { - NewPos =3D NULL; + return NULL; + } + // + // Check whether highlight menu and top of screen menu can be shown with= in one page, + // if can't, return NULL to re-calcaulate the top of scrren menu. Becaus= e 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 - To= pRow) { + return NULL; } =20 return NewPos; } =20 @@ -1803,11 +1845,11 @@ FindTopMenu ( UpdateOptionSkipLines (MenuOption); =20 // // Found the last time highlight menu. // - *TopOfScreen =3D FindTopOfScreenMenuOption(); + *TopOfScreen =3D FindTopOfScreenMenuOption(*HighlightMenu); if (*TopOfScreen !=3D 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 =3D MENU_OPTION_FROM_LINK (*HighlightMenu); UpdateOptionSkipLines (MenuOption); =20 - *TopOfScreen =3D FindTopOfScreenMenuOption(); + *TopOfScreen =3D FindTopOfScreenMenuOption(*HighlightMenu); if (*TopOfScreen =3D=3D NULL) { // // Not found last time top of screen menu, so base on current high= light menu // to find the new top of screen menu. // Make the current highlight menu at the bottom of the form to ca= lculate the --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel