SHA256
1
0
forked from pool/gdm
gdm/gdm-plymouth-vt1.patch

67 lines
1.8 KiB
Diff
Raw Normal View History

Index: gdm-3.12.2/daemon/main.c
===================================================================
--- gdm-3.12.2.orig/daemon/main.c
+++ gdm-3.12.2/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>
@@ -308,6 +310,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)
@@ -317,6 +336,7 @@ main (int argc,
GError *error = NULL;
int ret;
gboolean res;
+ gboolean plymouth_running = FALSE;
static gboolean do_timed_exit = FALSE;
static gboolean print_version = FALSE;
static gboolean fatal_warnings = FALSE;
@@ -400,6 +420,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);
@@ -429,6 +451,11 @@ main (int argc,
g_printerr ("%s\n", error->message);
g_clear_error (&error);
}
+
+ if (plymouth_running) {
+ jump_to_vt (1);
+ }
+
return ret;
}