bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

console-client patch: selecting amount of font slots


From: Marco Gerards
Subject: console-client patch: selecting amount of font slots
Date: 08 Jul 2003 00:28:30 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi,

Here is a patch so users can select the mode to use in vga:

* 512 font slots, less colors.
* 256 font slots, all colors.

Because many people were confused by it, because it is default on most
systems I set the default amount of font slots to 256. After applying
this patch use:
"-d vga --font-slots 512"
To set the amount of font slots to 512.

Thanks,
Marco

Changelog entry:

2003-07-07  Marco Gerards  <metgerards@student.han.nl>

        * vga.c: New global variable vga_display_font_slots.
        (DEFAULT_FONT_SLOTS): New macro.
        (parse_startup_args): Parse "--font-slots".
        (vga_display_init): Check if the parsed "--font-slots" was correct
        and setup the vga driver to use this value.
        (vga_display_fini): Deallocate memory for vga_display_font_slots.

Patch:

Common subdirectories: /home/marco/src/hurdcvs/hurd/console-client/CVS and 
console-client/CVS
diff -up /home/marco/src/hurdcvs/hurd/console-client/vga.c console-client/vga.c
--- /home/marco/src/hurdcvs/hurd/console-client/vga.c   2002-09-17 
14:26:10.000000000 +0200
+++ console-client/vga.c        2003-07-07 23:36:08.000000000 +0200
@@ -1,5 +1,5 @@
 /* vga.c - The VGA device display driver.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    Written by Marcus Brinkmann.
 
    This file is part of the GNU Hurd.
@@ -62,6 +62,9 @@ static char *vga_display_font_bold;
        "/lib/hurd/fonts/vga-system-bold-italic.bdf"
 static char *vga_display_font_bold_italic;
 
+#define DEFAULT_FONT_SLOTS     256
+static char *vga_display_font_slots;
+
 /* The timer used for flashing the screen.  */
 static struct timer_list vga_display_timer;
 
@@ -177,7 +180,7 @@ parse_startup_args (int no_exit, int arg
       PARSE_FONT_OPT ("--font-italic", font_italic);
       PARSE_FONT_OPT ("--font-bold", font_bold);
       PARSE_FONT_OPT ("--font-bold-italic", font_bold_italic);
-
+      PARSE_FONT_OPT ("--font-slots", font_slots);
       break;
     }
   return 0;
@@ -189,6 +192,7 @@ vga_display_init (void **handle, int no_
 {
   error_t err;
   struct vga_display *disp;
+  char *tail;
 
   /* XXX Assert that we are called only once.  */
   mutex_init (&vga_display_lock);
@@ -206,8 +210,23 @@ vga_display_init (void **handle, int no_
   if (!disp)
     return ENOMEM;
 
-  /* Set this to 256 for full color support.  */
-  disp->df_size = 512;
+  if (vga_display_font_slots)
+    {
+      disp->df_size = strtoul (vga_display_font_slots, &tail, 0);
+      if (tail == NULL || tail == vga_display_font_slots || *tail != '\0')
+       return EINVAL;
+      if (errno)
+       return errno;
+      
+      if (disp->df_size != 256 && disp->df_size != 512)
+       {
+         error (0, EINVAL, "Amount of font slots must be 256 or 512");
+         return EINVAL;
+       }
+    }
+  else
+    disp->df_size = DEFAULT_FONT_SLOTS;
+  
   disp->width = VGA_DISP_WIDTH;
   disp->height = VGA_DISP_HEIGHT;
 
@@ -299,6 +318,8 @@ vga_display_fini (void *handle, int forc
     free (vga_display_font_bold);
   if (vga_display_font_bold_italic)
     free (vga_display_font_bold_italic);
+  if (vga_display_font_slots)
+    free (vga_display_font_slots);
 
   return 0;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]