From nobody Sat Apr 27 17:39:16 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 150174118627689.73931525461865; Wed, 2 Aug 2017 23:19:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 764EF209589CD; Wed, 2 Aug 2017 23:17:32 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 0E2C621E1DADD for ; Wed, 2 Aug 2017 23:17:31 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 02 Aug 2017 23:19:41 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 02 Aug 2017 23:19:40 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,314,1498546800"; d="scan'208";a="115040292" From: Dandan Bi To: edk2-devel@lists.01.org Date: Thu, 3 Aug 2017 14:19:31 +0800 Message-Id: <1501741171-226236-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [PATCH v2] 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" V2: Refine the codes to make the logic clear. 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 --- .../Universal/DisplayEngineDxe/FormDisplay.c | 60 ++++++++++++++++++= ---- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeMod= ulePkg/Universal/DisplayEngineDxe/FormDisplay.c index dc4ae4b..b6e14bf 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)) { @@ -1754,10 +1787,19 @@ FindTopOfScreenMenuOption ( // Last time top of screen menu has disappeared. // if (NewPos =3D=3D &gMenuOption) { NewPos =3D 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) { + NewPos =3D 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