Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UQFEy-0008SC-Um for mharc-grub-devel@gnu.org; Thu, 11 Apr 2013 07:00:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFEw-0008R5-GQ for grub-devel@gnu.org; Thu, 11 Apr 2013 07:00:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQFEr-0004XR-E7 for grub-devel@gnu.org; Thu, 11 Apr 2013 07:00:26 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:55577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFEr-0004XD-0O for grub-devel@gnu.org; Thu, 11 Apr 2013 07:00:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 0215329C33B for ; Thu, 11 Apr 2013 15:00:20 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w9l+Hu3WT7Oa for ; Thu, 11 Apr 2013 15:00:19 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id 5916429C328 for ; Thu, 11 Apr 2013 15:00:19 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: Re: [PATCH] [1/11] [gfxmenu/list] fixed height detemination Date: Thu, 11 Apr 2013 15:00:19 +0400 Message-ID: <3141847.izJu9Hqjl6@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) In-Reply-To: <105054487.EGMUzIhLRg@icedphoenix> References: <105054487.EGMUzIhLRg@icedphoenix> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1633992.Zd63k2L3vs" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.199.216.181 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, 11 Apr 2013 11:00:27 -0000 This is a multi-part message in MIME format. --nextPart1633992.Zd63k2L3vs Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Thursday, April 11, 2013 02:54:43 PM you wrote: > fixed: > - get_num_shown_item > - list_get_minimal_size > - height of the selected item (it was item_height - 1) > > based on patch made by Andrey Borzenkov and my own patch. (And also base on > the coversation about how the menu should work) > > see screenshots included for explanation of the problem > 1-1 - how the styled box should look > 1-2 - how it looks on the las position > > 1-3 - result of get_minimal_size function - we can see only one pixel > (should see 5 of them) of selected_item_pixmap_style - because: > 1) height of the center slice is item_height - 1 > 2) selected_bottom_pad hasn't been taken into account > -- > With best regards, > _______________________________ > Vladimir Testov, ROSA Laboratory. > www.rosalab.ru Oups, forgot to include the patch. :) -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart1633992.Zd63k2L3vs Content-Disposition: attachment; filename="grub-2.00-list-height-fix.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-2.00-list-height-fix.patch" diff -Naur grub-new/grub-core/gfxmenu/gui_list.c grub-new2/grub-core/gfxmenu/gui_list.c --- grub-new/grub-core/gfxmenu/gui_list.c 2013-03-25 17:24:09.283623915 +0400 +++ grub-new2/grub-core/gfxmenu/gui_list.c 2013-03-25 17:42:18.730948425 +0400 @@ -98,9 +98,21 @@ 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 - - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + if (self->list_version == 0) + { + return (self->bounds.height + item_vspace - 2 * boxpad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + } + else + { + return (self->bounds.height + item_vspace - 2 * boxpad + - sel_top_pad - sel_bottom_pad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + } } static int @@ -253,7 +265,10 @@ int cwidth = oviewport.width - 2 * boxpad - 2; if (selbox->get_border_width) cwidth -= selbox->get_border_width (selbox); - selbox->set_content_size (selbox, cwidth, item_height - 1); + if (self->list_version == 0) + selbox->set_content_size (selbox, cwidth, item_height - 1); + else + selbox->set_content_size (selbox, cwidth, item_height); selbox->draw (selbox, 0, item_top - sel_toppad); } @@ -393,7 +408,8 @@ 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, @@ -404,10 +420,21 @@ *width += 2 * boxpad + box_left_pad + box_right_pad; /* Set the menu box height to fit the items. */ - *height = (item_height * num_items - + item_vspace * (num_items - 1) - + 2 * boxpad - + box_top_pad + box_bottom_pad + sel_toppad); + if (self->list_version == 0) + { + *height = (item_height * num_items + + item_vspace * (num_items - 1) + + 2 * boxpad + + box_top_pad + box_bottom_pad + sel_top_pad); + } + else + { + *height = (item_height * num_items + + item_vspace * (num_items - 1) + + 2 * boxpad + + box_top_pad + box_bottom_pad + + sel_top_pad + sel_bottom_pad); + } } else { --nextPart1633992.Zd63k2L3vs--