Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UQFsG-0002SU-HI for mharc-grub-devel@gnu.org; Thu, 11 Apr 2013 07:41:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFsD-0002Ou-ND for grub-devel@gnu.org; Thu, 11 Apr 2013 07:41:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQFsC-0002Dg-C4 for grub-devel@gnu.org; Thu, 11 Apr 2013 07:41:01 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:33396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFsB-0002DU-Ul for grub-devel@gnu.org; Thu, 11 Apr 2013 07:41:00 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 24F0E29C1BD for ; Thu, 11 Apr 2013 15:40:59 +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 PdhwmDOLCFA8 for ; Thu, 11 Apr 2013 15:40:58 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id 8DB37F0002 for ; Thu, 11 Apr 2013 15:40:58 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: [PATCH] [11/11] [gfxmenu/list] some more code cleaning Date: Thu, 11 Apr 2013 15:40:58 +0400 Message-ID: <4914877.aM6JyMzAbm@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3871141.vjfXcZR4gL" 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:41:03 -0000 This is a multi-part message in MIME format. --nextPart3871141.vjfXcZR4gL Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" subj -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart3871141.vjfXcZR4gL Content-Disposition: attachment; filename="grub-2.00-list-some-more-code-cleaning.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-2.00-list-some-more-code-cleaning.patch" diff -Naur grub-newA/grub-core/gfxmenu/gui_list.c grub-newB/grub-core/gfxmenu/gui_list.c --- grub-newA/grub-core/gfxmenu/gui_list.c 2013-04-10 12:51:47.579232188 +0400 +++ grub-newB/grub-core/gfxmenu/gui_list.c 2013-04-10 13:00:31.139354643 +0400 @@ -268,14 +268,18 @@ grub_gfxmenu_box_t itbox = self->item_box; int sel_toppad = selbox->get_top_pad (selbox); int it_toppad = itbox->get_top_pad (itbox); - int item_top = sel_toppad; - if ((self->list_version > 0) && (it_toppad > item_top)) - item_top = it_toppad; + int item_top; + if (self->list_version == 0) + item_top = sel_toppad; + else + item_top = grub_max (sel_toppad, it_toppad); int sel_leftpad = selbox->get_left_pad (selbox); int it_leftpad = itbox->get_left_pad (itbox); - int total_leftpad = sel_leftpad; - if ((self->list_version > 0) && (it_leftpad > total_leftpad)) - total_leftpad = it_leftpad; + int total_leftpad; + if (self->list_version == 0) + total_leftpad = sel_leftpad; + else + total_leftpad = grub_max (sel_leftpad, it_leftpad); int menu_index; int visible_index; struct grub_video_rect oviewport; @@ -298,15 +302,10 @@ } if (selbox->get_border_width) cwidth -= selbox->get_border_width (selbox); - if (self->list_version > 0) - { - if (itbox->get_border_width) - it_cwidth -= itbox->get_border_width (itbox); - } + if (self->list_version > 0 && itbox->get_border_width) + it_cwidth -= itbox->get_border_width (itbox); if (self->list_version == 0) - { - selbox->set_content_size (selbox, cwidth, item_height - 1); - } + selbox->set_content_size (selbox, cwidth, item_height - 1); else { selbox->set_content_size (selbox, cwidth, item_height); @@ -318,9 +317,11 @@ int selected_top_offset; int top_offset; - int total_width = cwidth; - if ((self->list_version > 0) && (it_cwidth < total_width)) - total_width = it_cwidth; + int total_width; + if (self->list_version == 0) + total_width = cwidth; + else + total_width = grub_min (cwidth, it_cwidth); grub_video_rect_t svpsave, sviewport; sviewport.x = string_left_offset; @@ -385,13 +386,11 @@ grub_menu_get_entry (self->view->menu, menu_index)->title; sviewport.y = item_top; if (self->list_version == 0) - { - grub_font_draw_string (item_title, - font, - color, - string_left_offset, - (item_top + string_top_offset)); - } + grub_font_draw_string (item_title, + font, + color, + string_left_offset, + (item_top + string_top_offset)); else { grub_gui_set_viewport (&sviewport, &svpsave); --nextPart3871141.vjfXcZR4gL--