File gdm-plymouth-vt1.patch of Package gdm.7833

Index: gdm-3.26.1/daemon/main.c
===================================================================
--- gdm-3.26.1.orig/daemon/main.c
+++ gdm-3.26.1/daemon/main.c
@@ -33,6 +33,8 @@
 #include <sys/wait.h>
 #include <locale.h>
 #include <signal.h>
+#include <sys/ioctl.h>
+#include <sys/vt.h>
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -302,6 +304,23 @@ block_sigusr1 (void)
         sigprocmask (SIG_BLOCK, &mask, NULL);
 }
 
+static void
+jump_to_vt (int                vt_number)
+{
+        int fd;
+
+        fd = open ("/dev/tty0", O_RDWR | O_NOCTTY);
+        if (ioctl (fd, VT_ACTIVATE, vt_number) < 0) {
+                g_debug ("Gdm: couldn't initiate jump to VT %d: %m",
+                         vt_number);
+        } else if (ioctl (fd, VT_WAITACTIVE, vt_number) < 0) {
+                g_debug ("Gdm: couldn't finalize jump to VT %d: %m",
+                         vt_number);
+        }
+        close(fd);
+}
+
+
 int
 main (int    argc,
       char **argv)
@@ -310,6 +329,7 @@ main (int    argc,
         GOptionContext     *context;
         GError             *error = NULL;
         gboolean            res;
+        gboolean            plymouth_running = FALSE;
         static gboolean     do_timed_exit    = FALSE;
         static gboolean     print_version    = FALSE;
         static gboolean     fatal_warnings   = FALSE;
@@ -383,6 +403,8 @@ main (int    argc,
 
         g_chdir ("/");
 
+        plymouth_running = g_access("/run/plymouth/pid", F_OK) == 0;
+
         main_loop = g_main_loop_new (NULL, FALSE);
 
         g_unix_signal_add (SIGTERM, on_shutdown_signal_cb, main_loop);
@@ -405,6 +427,10 @@ main (int    argc,
 
         g_main_loop_unref (main_loop);
 
+        if (plymouth_running) {
+            jump_to_vt (1);
+        }
+
         return EXIT_SUCCESS;
 }
 
openSUSE Build Service is sponsored by