From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 3F2D621E1DAFA for ; Thu, 3 Aug 2017 21:26:24 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Aug 2017 21:28:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,319,1498546800"; d="scan'208";a="886280137" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 03 Aug 2017 21:28:36 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Aug 2017 21:28:36 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Aug 2017 21:28:35 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Fri, 4 Aug 2017 12:28:33 +0800 From: "Dong, Eric" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue Thread-Index: AQHTDNaVesVp3me4cECJShWJ874EQ6Jzmn7g Date: Fri, 4 Aug 2017 04:28:32 +0000 Message-ID: References: <1501819339-225636-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1501819339-225636-1-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Fri, 04 Aug 2017 04:26:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong -----Original Message----- From: Bi, Dandan=20 Sent: Friday, August 4, 2017 12:02 PM To: edk2-devel@lists.01.org Cc: Dong, Eric ; Gao, Liming Subject: [PATCH V3] MdeModulePkg/DisplayEngine: Fix incorrect display issue In a form, some new menus may be dynamically inserted between highlight men= u 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 show= n in one page. Existing codes miss to handle this case then will cause inco= rrect 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 | 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 @@ Fi= ndTopOfScreenMenuOption ( =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=20 + within one page, // if can't, return NULL to re-calcaulate the top of=20 + scrren menu. Because some new menus // may be dynamically inserted=20 + between highlightmenu and previous top of screen menu, // So previous re= cord 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 -- 1.9.5.msysgit.1