rpms/rhgb/devel rhgb-0.16.2-init-utf8.patch, NONE, 1.1 rhgb.spec, 1.25, 1.26

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Oct 26 19:47:18 UTC 2005


Author: rstrode

Update of /cvs/dist/rpms/rhgb/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv28432

Modified Files:
	rhgb.spec 
Added Files:
	rhgb-0.16.2-init-utf8.patch 
Log Message:
- initialize utf-8 mode on console


rhgb-0.16.2-init-utf8.patch:
 main.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+)

--- NEW FILE rhgb-0.16.2-init-utf8.patch ---
--- rhgb-0.16.2/src/main.c.init-utf8	2005-01-31 15:47:26.000000000 -0500
+++ rhgb-0.16.2/src/main.c	2005-10-26 15:44:48.000000000 -0400
@@ -51,6 +51,7 @@
 #define XLOGFILE TMPPATH"/XFree86.0.log"
 #define DEBUGFILE TMPPATH"/rhgb.debug"
 #define X_NO_DRI "-extension XFree86-DRI"
+#define VT_NAME "/dev/tty8"
 #define X_COMMAND1 "/usr/bin/X11/X -s off -dpms -v -nolock -fp /usr/lib/X11/fonts/misc -logfile " XLOGFILE " " X_NO_DRI " " DISPLAY_NO " vt8"
 #define X_COMMAND2 "/usr/bin/X11/X -config " X_CONFIG " -s off -dpms -v -nolock -fp /usr/lib/X11/fonts/misc -logfile " XLOGFILE " " X_NO_DRI " " DISPLAY_NO " vt8"
 #define X_FAILSAFE "/usr/bin/X11/X -s off -dpms -v -nolock -fp /usr/lib/X11/fonts/misc -logfile " XLOGFILE " " DISPLAY_NO " vt8"
@@ -521,6 +522,54 @@
   _exit (1);
 }
 
+static gboolean
+virtual_console_init (void)
+{
+  int fd;
+  gboolean console_initialized;
+
+  console_initialized = FALSE;
+  fd = open (VT_NAME, O_RDWR | O_NOCTTY, 0);
+
+  /* initialize console for utf-8 mode if running in utf-8 locale
+   */
+  if ((fd >= 0) && g_get_charset (NULL) /* TRUE if UTF-8 */)
+    {
+      static const char utf8_enable_command[] = "\033%G";
+      ssize_t bytes_written;
+      char *set_font_command;
+
+      bytes_written = write (fd, utf8_enable_command,
+                             sizeof (utf8_enable_command));
+      close (fd);
+
+      if (bytes_written != sizeof (utf8_enable_command))
+        console_initialized = FALSE;
+      else
+        {
+          const char *font;
+          
+          font = g_getenv ("SYSFONT");
+
+          if (font == NULL)
+            font = "latarcyrheb-sun16";
+
+          set_font_command = g_strdup_printf ("setfont -C %s %s",
+                                              VT_NAME, font);
+
+          if (!g_spawn_command_line_sync (set_font_command, NULL, NULL, NULL, NULL))
+            console_initialized = FALSE;
+          else
+            console_initialized = TRUE;
+
+            g_free (set_font_command);
+	}
+    }
+  else
+    console_initialized = FALSE;
+
+  return console_initialized;
+}
 
 /* Display
  */
@@ -556,6 +605,11 @@
 			  NULL);
   }
 
+  /* ignore error.  It shouldn't really be fatal I think
+   * and rhgb doesn't do any sort of logging, unfortunately.
+   */
+  virtual_console_init ();
+
   g_spawn_async ("/", argv, NULL,
 		 G_SPAWN_DO_NOT_REAP_CHILD,
 		 NULL, NULL, &child_pid, NULL);
@@ -565,6 +619,7 @@
       write(fd, DISPLAY_STRING, strlen(DISPLAY_STRING));
       close(fd);
   }
+
   return 0;
 }
 
@@ -1065,6 +1120,8 @@
     { 0, 0, 0, 0, 0, 0, 0 }
   };
 
+  setlocale (LC_ALL, "");
+
   bindtextdomain (GETTEXT_PACKAGE, "/usr/share/locale");
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);


Index: rhgb.spec
===================================================================
RCS file: /cvs/dist/rpms/rhgb/devel/rhgb.spec,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- rhgb.spec	26 Oct 2005 19:35:03 -0000	1.25
+++ rhgb.spec	26 Oct 2005 19:47:09 -0000	1.26
@@ -3,7 +3,7 @@
 Summary: Red Hat Graphical Boot
 Name: rhgb
 Version: 0.16.2
-Release: 6
+Release: 7
 URL: http://www.redhat.com/
 Source0: %{name}-%{version}.tar.gz
 License: GPL
@@ -14,6 +14,7 @@
 Requires: initscripts >= 7.22-1
 
 Patch0: rhgb-0.16.2-reap-child.patch
+Patch1: rhgb-0.16.2-init-utf8.patch
 
 %description
 Red Hat Graphical Boot provides a clean and simple interface to the boot process
@@ -21,6 +22,7 @@
 %prep
 %setup -q
 %patch0 -p1 -b .reap-child
+%patch1 -p1 -b .init-utf8
 
 %build
 %configure
@@ -45,6 +47,9 @@
 %doc doc/HOW_IT_WORKS
 
 %changelog
+* Wed Oct 26 2005 Ray Strode <rstrode at redhat.com> 0.16.2-7
+- initialize utf-8 mode on console
+
 * Wed Oct 26 2005 Ray Strode <rstrode at redhat.com> 0.16.2-6
 - Don't make setxkbmap hungry for brains 
   (reported by Chris Lumens).




More information about the fedora-cvs-commits mailing list