Received: from list by lists.gnu.org with archive (Exim 4.71) id 1U8aBj-0008WT-Ms for mharc-grub-devel@gnu.org; Thu, 21 Feb 2013 12:44:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8aBa-0008SF-99 for grub-devel@gnu.org; Thu, 21 Feb 2013 12:44:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8aBV-0006Ah-QX for grub-devel@gnu.org; Thu, 21 Feb 2013 12:43:58 -0500 Received: from mail-lb0-f176.google.com ([209.85.217.176]:54571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8aBV-0006AD-JE for grub-devel@gnu.org; Thu, 21 Feb 2013 12:43:53 -0500 Received: by mail-lb0-f176.google.com with SMTP id s4so6940473lbc.21 for ; Thu, 21 Feb 2013 09:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer; bh=Qc7o7hnRE64otUmZ6+J+x5gcuRqyTU8Z+iKozOkTWLo=; b=F7CDSnR/rBF7lYi0LM3mxR1EpOTtYei2wMiaB5lai1geeGr6hklv0Df5ZpoFvH5YSh 1QI2MUjgsgCASlrwJDIP1goJYaspY8hr1VfcuAUstIGVNwKhbO1B1DVJQWqFjtrxgCny t84cg40lhKt1m4vwHZgj/U/FCRji6xx8mwlx5xrr8VaUnlxh6HocGJcc6meMGhmNpIgK NdVf98MISRXDeslpv7LjNzDupYJSOUPMsdegGwLOnk6Wj5nroq58OzdhE7L12mXoeIGY CzfQzZu7GVqkf2Ze4ewL8JVT2wCl9XB5GOqafepgrqgOFU/3pasfhz+z5PQxk4ktPjSE Fogg== X-Received: by 10.112.54.42 with SMTP id g10mr10541714lbp.55.1361468205325; Thu, 21 Feb 2013 09:36:45 -0800 (PST) Received: from localhost.localdomain (ppp79-139-243-180.pppoe.spdop.ru. [79.139.243.180]) by mx.google.com with ESMTPS id oy10sm41360908lab.8.2013.02.21.09.36.44 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 09:36:44 -0800 (PST) From: Andrey Borzenkov To: grub-devel@gnu.org Subject: [PATCH] fix menu size calculation in presence of selected item pixmap Date: Thu, 21 Feb 2013 21:36:41 +0400 Message-Id: <1361468201-26961-1-git-send-email-arvidjaar@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.217.176 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 17:44:05 -0000 draw_menu() acconted for upper border of selected item pixmap, but not for lower. So it could happen that lower border was visually cut off. Also various calculations of menu vertical size did not account for space for lower border Signed-off-by: Andrey Borzenkov --- grub-core/gfxmenu/gui_list.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index 1982d9a..5c83383 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -97,8 +97,14 @@ get_num_shown_items (list_impl_t self) grub_gfxmenu_box_t box = self->menu_box; int box_top_pad = box->get_top_pad (box); int box_bottom_pad = box->get_bottom_pad (box); + + grub_gfxmenu_box_t selbox = self->selected_item_box; + int sel_top_pad = selbox->get_top_pad (selbox); + int sel_bottom_pad = selbox->get_bottom_pad (selbox); + return (self->bounds.height + item_vspace - 2 * boxpad + - sel_top_pad - sel_bottom_pad - box_top_pad - box_bottom_pad) / (item_height + item_vspace); } @@ -392,7 +398,8 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height) unsigned width_s; grub_gfxmenu_box_t selbox = self->selected_item_box; - int sel_toppad = selbox->get_top_pad (selbox); + int sel_top_pad = selbox->get_top_pad (selbox); + int sel_bottom_pad = selbox->get_bottom_pad (selbox); *width = grub_font_get_string_width (self->item_font, "Typical OS"); width_s = grub_font_get_string_width (self->selected_item_font, @@ -406,7 +413,7 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height) *height = (item_height * num_items + item_vspace * (num_items - 1) + 2 * boxpad - + box_top_pad + box_bottom_pad + sel_toppad); + + box_top_pad + box_bottom_pad + sel_top_pad + sel_bottom_pad); } else { -- tg: (cc35b49..) e/menu-selected-pad (depends on: master)