From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1CnIx7-0006Jr-Co for mharc-grub-devel@gnu.org; Sat, 08 Jan 2005 10:56:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CnIr7-0004ug-NF for grub-devel@gnu.org; Sat, 08 Jan 2005 10:50:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CnIqn-0004pn-38 for grub-devel@gnu.org; Sat, 08 Jan 2005 10:50:05 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CnIqm-0004jv-FM for grub-devel@gnu.org; Sat, 08 Jan 2005 10:50:00 -0500 Received: from [217.12.11.36] (helo=smtp005.mail.ukl.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1CnISk-0003Ur-BC for grub-devel@gnu.org; Sat, 08 Jan 2005 10:25:10 -0500 Received: from unknown (HELO ?192.168.0.2?) (subdino2004@83.194.34.92 with plain) by smtp005.mail.ukl.yahoo.com with SMTP; 8 Jan 2005 15:25:09 -0000 Message-ID: <41DFFB5A.4080909@yahoo.fr> Date: Sat, 08 Jan 2005 16:25:14 +0100 From: Vincent Pelletier User-Agent: Mozilla Thunderbird 0.9 (X11/20041124) X-Accept-Language: fr, en MIME-Version: 1.0 To: The development of GRUB 2 References: <41BEC01B.9020709@yahoo.fr> <200412191622.00337.okuji@enbug.org> <41C5F65C.4080809@yahoo.fr> <41C5F963.8010908@yahoo.fr> In-Reply-To: <41C5F963.8010908@yahoo.fr> X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------040903080304050900040508" Subject: [PATCH v2] grub2 menu : freeze while initial drawing X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2005 15:56:31 -0000 This is a multi-part message in MIME format. --------------040903080304050900040508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Here is the second version of the patch. The result should look closer to what was originally designed. Updated Changelog entry: 2005-01-08 Vincent Pelletier ~ * normal/menu.c: Corrected TERM_TOP_BORDER_Y. ~ (draw_border): Replaced "while" loop by "for" loop. Number of lines ~ in rectangle consistent with number of lines displayed in ~ print_entries. Added a margin below the rectangle. ~ (print_entry): Entry fits the rectangle client width. ~ (print_entries): Scroll arrows displayed next to right border. I'm not sure about how the scroll arrows should look like (whether they should stick to the right border of the rectangle, be on the border or or have an empty char between the border and the arrow). Please correct my patch if I'm wrong - I've chosen the first. Vincent Pelletier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB3/tZFEQoKRQyjtURAgk9AKChdkYrT4S00/jOUFKaBp3YNKX+AwCfRrEX mqjDKP/ewL9Z9gAt7W7sqlo= =5ssG -----END PGP SIGNATURE----- --------------040903080304050900040508 Content-Type: text/plain; name="menu.c-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="menu.c-2.diff" Index: menu.c =================================================================== RCS file: /cvsroot/grub/grub2/normal/menu.c,v retrieving revision 1.8 diff -u -p -r1.8 menu.c --- menu.c 18 Sep 2004 13:42:05 -0000 1.8 +++ menu.c 8 Jan 2005 15:03:05 -0000 @@ -38,7 +38,7 @@ #define DISP_LR 0x251B /* FIXME: These should be dynamically obtained from a terminal. */ -#define TERM_WIDTH (80 - 1) +#define TERM_WIDTH 80 #define TERM_HEIGHT 25 /* The number of lines of "GRUB version..." at the top. */ @@ -51,7 +51,7 @@ #define TERM_SCROLL_WIDTH 1 /* The Y position of the top border. */ -#define TERM_TOP_BORDER_Y (TERM_MARGIN + TERM_HEIGHT + TERM_MARGIN) +#define TERM_TOP_BORDER_Y (TERM_MARGIN + TERM_INFO_HEIGHT + TERM_MARGIN) /* The X position of the left border. */ #define TERM_LEFT_BORDER_X TERM_MARGIN @@ -98,27 +98,24 @@ draw_border (void) grub_putcode (DISP_HLINE); grub_putcode (DISP_UR); - i = 1; - while (1) + for(i=0;i<(unsigned) TERM_NUM_ENTRIES;i++) { - grub_gotoxy (TERM_MARGIN, TERM_TOP_BORDER_Y + i); - - if (i > (unsigned) TERM_NUM_ENTRIES) - break; - + grub_gotoxy (TERM_MARGIN, TERM_TOP_BORDER_Y + i + 1); grub_putcode (DISP_VLINE); - grub_gotoxy (TERM_MARGIN + TERM_BORDER_WIDTH - 1, TERM_TOP_BORDER_Y + i); + grub_gotoxy (TERM_MARGIN + TERM_BORDER_WIDTH - 1, TERM_TOP_BORDER_Y + i + 1); grub_putcode (DISP_VLINE); - i++; } + grub_gotoxy (TERM_MARGIN, TERM_TOP_BORDER_Y + TERM_NUM_ENTRIES + 1); grub_putcode (DISP_LL); for (i = 0; i < TERM_BORDER_WIDTH - 2; i++) grub_putcode (DISP_HLINE); grub_putcode (DISP_LR); grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + + grub_gotoxy (TERM_MARGIN, TERM_TOP_BORDER_Y + TERM_NUM_ENTRIES + TERM_MARGIN + 1); } static void @@ -172,12 +169,12 @@ print_entry (int y, int highlight, grub_ grub_gotoxy (TERM_LEFT_BORDER_X + TERM_MARGIN, y); grub_putchar (' '); for (x = TERM_LEFT_BORDER_X + TERM_MARGIN + 1; - x < TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH - 1; + x < TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH - TERM_MARGIN; x++) { - if (*title && x <= TERM_LEFT_BORDER_X + TERM_ENTRY_WIDTH + 1) + if (*title && x <= TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH - TERM_MARGIN - 1) { - if (x == TERM_LEFT_BORDER_X + TERM_ENTRY_WIDTH + 1) + if (x == TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH - TERM_MARGIN - 1) grub_putcode (DISP_RIGHT); else grub_putchar (*title++); @@ -196,7 +193,7 @@ print_entries (grub_menu_t menu, int fir grub_menu_entry_t e; int i; - grub_gotoxy (TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH + TERM_MARGIN, + grub_gotoxy (TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH, TERM_FIRST_ENTRY_Y); if (first) @@ -213,7 +210,7 @@ print_entries (grub_menu_t menu, int fir e = e->next; } - grub_gotoxy (TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH + TERM_MARGIN, + grub_gotoxy (TERM_LEFT_BORDER_X + TERM_BORDER_WIDTH, TERM_TOP_BORDER_Y + TERM_NUM_ENTRIES); if (e) --------------040903080304050900040508--