[2020] 2009-03-06 Robert Millan <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2020
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2020
Author:   robertmh
Date:     2009-03-06 19:10:23 +0000 (Fri, 06 Mar 2009)
Log Message:
-----------
2009-03-06  Robert Millan  <[email protected]>

        Fix display issue on terminals with screen size other than 80x25 
        (e.g. gfxterm with resolution higher than 640x480).

        * normal/main.c (grub_normal_init_page): Display title text in a  
        position relative to the center of the terminal instead of reliing
        on a hardcoded offset.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/normal/main.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-03-05 05:23:58 UTC (rev 2019)
+++ trunk/grub2/ChangeLog	2009-03-06 19:10:23 UTC (rev 2020)
@@ -1,3 +1,12 @@
+2009-03-06  Robert Millan  <[email protected]>
+
+	Fix display issue on terminals with screen size other than 80x25
+	(e.g. gfxterm with resolution higher than 640x480).
+
+	* normal/main.c (grub_normal_init_page): Display title text in a
+	position relative to the center of the terminal instead of reliing
+	on a hardcoded offset.
+
 2009-03-04  Robert Millan  <[email protected]>
 
 	Filter /etc/grub.d/10_* so that only add-ons for native kernels are

Modified: trunk/grub2/normal/main.c
===================================================================
--- trunk/grub2/normal/main.c	2009-03-05 05:23:58 UTC (rev 2019)
+++ trunk/grub2/normal/main.c	2009-03-06 19:10:23 UTC (rev 2020)
@@ -389,10 +389,22 @@
 void
 grub_normal_init_page (void)
 {
+  grub_uint8_t width, margin;
+
+#define TITLE ("GNU GRUB  version " PACKAGE_VERSION)
+
+  width = grub_getwh () >> 8;
+  margin = (width - (sizeof(TITLE) + 7)) / 2;
+
   grub_cls ();
-  grub_printf ("\n\
-                         GNU GRUB  version %s\n\n",
-	       PACKAGE_VERSION);
+  grub_putchar ('\n');
+
+  while (margin--)
+    grub_putchar (' ');
+
+  grub_printf ("%s\n\n", TITLE);
+
+#undef TITLE
 }
 
 /* Read the file command.lst for auto-loading.  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.