From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UPasS-0003wy-C9 for mharc-grub-devel@gnu.org; Tue, 09 Apr 2013 11:54:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPasL-0003mN-KB for grub-devel@gnu.org; Tue, 09 Apr 2013 11:54:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPasG-0008Fw-IS for grub-devel@gnu.org; Tue, 09 Apr 2013 11:54:25 -0400 Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:64473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPasG-0008Ff-8P for grub-devel@gnu.org; Tue, 09 Apr 2013 11:54:20 -0400 Received: by mail-la0-f52.google.com with SMTP id ej20so2325581lab.25 for ; Tue, 09 Apr 2013 08:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type; bh=J8H/zR6yoHDjSa4imxHgRPfFFd7ODHBKoNLAYJeHagY=; b=d9Fbd9RaY/gPEDTWMCRGDqgVRmIAxMTE7hPmhNSw3n+aeKR40phcKzAgeZLhG5h7vA yLnmSj6Rdjo5AQDCOU7FPzCHFNdHn6Genb6wFjW4BjEvt0xqRaUjEMcZhlZAQs4AkfdL Q7XcDmH2yrfNIO1LzgLUFxpRZYpdrYfq2hP4uVKfbzCd0VxKYzyGkL4oLkAOZmIRx3DT JKsVFjsI6QsIOSpWX39Ng1i0I73Cdcrd9xV4veokSx9Bx8hk8+VY23RPYKt51p7UzwgH +phi/l87sR/wVa1/znIQoanyp54TdNep4vMh5jSZCGX1kfFqvVIpG2qDiOKV49ZGC3Ia HLuA== X-Received: by 10.152.29.232 with SMTP id n8mr14343133lah.55.1365522859128; Tue, 09 Apr 2013 08:54:19 -0700 (PDT) Received: from opensuse.site ([94.29.72.160]) by mx.google.com with ESMTPS id vs6sm65263lbb.7.2013.04.09.08.54.18 (version=SSLv3 cipher=RC4-SHA bits=128/128); Tue, 09 Apr 2013 08:54:18 -0700 (PDT) Date: Tue, 9 Apr 2013 19:54:16 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH] fix menu size calculation in presence of selected item pixmap Message-ID: <20130409195416.6a76b5ff@opensuse.site> In-Reply-To: <516311A5.3090506@gmail.com> References: <1361468201-26961-1-git-send-email-arvidjaar@gmail.com> <516311A5.3090506@gmail.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.14; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/BhuTw6yrTLCgrSinzCe3s.T"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 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: Tue, 09 Apr 2013 15:54:30 -0000 --Sig_/BhuTw6yrTLCgrSinzCe3s.T Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Mon, 08 Apr 2013 20:51:17 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 21.02.2013 18:36, Andrey Borzenkov wrote: >=20 > > 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. > >=20 > > Also various calculations of menu vertical size did not account for > > space for lower border > >=20 > > Signed-off-by: Andrey Borzenkov > >=20 > > --- > > grub-core/gfxmenu/gui_list.c | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > >=20 > > 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 =3D self->menu_box; > > int box_top_pad =3D box->get_top_pad (box); > > int box_bottom_pad =3D box->get_bottom_pad (box); > > + > > + grub_gfxmenu_box_t selbox =3D self->selected_item_box; > > + int sel_top_pad =3D selbox->get_top_pad (selbox); > > + int sel_bottom_pad =3D selbox->get_bottom_pad (selbox); > > + =20 > > =20 > > return (self->bounds.height + item_vspace - 2 * boxpad > > + - sel_top_pad - sel_bottom_pad >=20 > I don't see the logic behind this. item_top in draw_menu doesn't > increase more on selected item than on any other one. >=20 Layout of menu entries used by draw_menu sel_top_pad entry 1 item_vspace entry 2 item_vspace ... entry n sel_bottom_pad draw_menu() explicitly offsets start of the first menu entry by sel_top_pad (int item_top =3D sel_toppad;) Currently get_num_shown_items can return more items than would fit using above scheme. Which results in cut off image below last visible entry. The updated formula ensures all elements are always displayed in full. Vladimir already demonstrated it a while back with screenshots. > > - box_top_pad - box_bottom_pad) / (item_height + item_vspace); > > } > > =20 > > @@ -392,7 +398,8 @@ list_get_minimal_size (void *vself, unsigned *width= , unsigned *height) > > unsigned width_s; > > =20 > > grub_gfxmenu_box_t selbox =3D self->selected_item_box; > > - int sel_toppad =3D selbox->get_top_pad (selbox); > > + int sel_top_pad =3D selbox->get_top_pad (selbox); > > + int sel_bottom_pad =3D selbox->get_bottom_pad (selbox); > > =20 > > *width =3D grub_font_get_string_width (self->item_font, "Typical= OS"); > > width_s =3D grub_font_get_string_width (self->selected_item_font, > > @@ -406,7 +413,7 @@ list_get_minimal_size (void *vself, unsigned *width= , unsigned *height) > > *height =3D (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_bo= ttom_pad); > > } > > else > > { >=20 >=20 >=20 --Sig_/BhuTw6yrTLCgrSinzCe3s.T Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlFkOagACgkQR6LMutpd94yzXACgrSAfn8Jt5TKkLo4R2aYRKnh7 MVkAniSXnm7gIWscBoHAhbTJDzVZ60Aw =eU0a -----END PGP SIGNATURE----- --Sig_/BhuTw6yrTLCgrSinzCe3s.T--