From nobody Fri Dec 27 01:36:27 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 1501593543583751.084911972144; Tue, 1 Aug 2017 06:19:03 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 58DC42095DBB3; Tue, 1 Aug 2017 06:16:49 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 D2D8F2095DB97 for ; Tue, 1 Aug 2017 06:16:48 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2017 06:18:57 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by FMSMGA003.fm.intel.com with ESMTP; 01 Aug 2017 06:18:56 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,306,1498546800"; d="scan'208";a="885049469" From: Dandan Bi To: edk2-devel@lists.01.org Date: Tue, 1 Aug 2017 21:18:43 +0800 Message-Id: <1501593523-150012-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [patch] 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 --- .../Universal/DisplayEngineDxe/FormDisplay.c | 43 ++++++++++++++++++= +--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeMod= ulePkg/Universal/DisplayEngineDxe/FormDisplay.c index dc4ae4b..f4025e9 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -1759,10 +1759,41 @@ FindTopOfScreenMenuOption ( =20 return NewPos; } =20 /** + Calculate the distance between two menus and include the skip value of S= tartMenu. + + @param StartMenu The link_entry pointer to startt menu. + @param EndMenu The link_entry pointer to end menu. + +**/ +UINTN +GetDistanceBetweenMenus( + IN LIST_ENTRY *StartMenu, + IN LIST_ENTRY *EndMenu +) +{ + LIST_ENTRY *Link; + UI_MENU_OPTION *MenuOption; + UINTN Distance; + + 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 first menu which will be show at the top. =20 @param FormData The data info for this form. @param TopOfScreen The link_entry pointer to top menu. @param HighlightMenu The menu which will be highlight. @@ -1804,25 +1835,25 @@ FindTopMenu ( =20 // // Found the last time highlight menu. // *TopOfScreen =3D FindTopOfScreenMenuOption(); - if (*TopOfScreen !=3D NULL) { + if (*TopOfScreen !=3D NULL && (GetDistanceBetweenMenus (*HighlightMe= nu,*TopOfScreen) + 1 <=3D BottomRow - TopRow)) { // - // Found the last time selectable top of screen menu. + // Found the last time selectable top of screen menu, and the high= light menu and top of screen menu or part of the screen menu can be shown i= n one page. // AdjustDateAndTimePosition(TRUE, TopOfScreen); MenuOption =3D MENU_OPTION_FROM_LINK (*TopOfScreen); UpdateOptionSkipLines (MenuOption); =20 *SkipValue =3D gHighligthMenuInfo.SkipValue; } else { // - // 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 - // top of screen menu. + // Case1:not found last time top of screen menu. + // Case2:the distance between highlight menu and top of screen men= u are beyond the screen scope, such as some menus are inserted when questio= n is refreshed. + // 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 ca= lculate the top of screen menu. // if (MenuOption->Skip >=3D BottomRow - TopRow) { *TopOfScreen =3D *HighlightMenu; TmpValue =3D 0; } else { --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel