diff options
author | Ray Strode <rstrode@redhat.com> | 2009-11-27 18:52:54 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2012-05-05 21:42:03 -0400 |
commit | c56fbb65277e8a17db5e0939f0b02e41c4ec784c (patch) | |
tree | b91d650f58fe7cd3f122b495777578c4e26ae0c6 /daemon/gdm-server.c | |
parent | c93d98b646a9a4fce3052260a1f08808d62d7155 (diff) | |
download | gdm-c56fbb65277e8a17db5e0939f0b02e41c4ec784c.tar.gz |
daemon: enable smooth transition between plymouth and X
This commit adds optional support for interacting with plymouth
from gdm. This feature can be enabled by passing --with-plymouth
to configure.
Hopefully, this will enable the various distributions that use
plymouth to drop a patch.
https://bugzilla.gnome.org/show_bug.cgi?id=572173
Diffstat (limited to 'daemon/gdm-server.c')
-rw-r--r-- | daemon/gdm-server.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c index d0d8ff9e..6f2a9391 100644 --- a/daemon/gdm-server.c +++ b/daemon/gdm-server.c @@ -32,6 +32,7 @@ #include <pwd.h> #include <grp.h> #include <signal.h> +#include <sys/ioctl.h> #include <sys/resource.h> #ifdef HAVE_SYS_PRCTL_H @@ -42,6 +43,10 @@ #include <systemd/sd-daemon.h> #endif +#ifdef WITH_PLYMOUTH +#include <linux/vt.h> +#endif + #include <glib.h> #include <glib/gi18n.h> #include <glib/gstdio.h> @@ -751,6 +756,61 @@ gdm_server_spawn (GdmServer *server, return ret; } +#ifdef WITH_PLYMOUTH +static int +get_active_vt (void) +{ + int console_fd; + struct vt_stat console_state = { 0 }; + + console_fd = open ("/dev/tty0", O_RDONLY | O_NOCTTY); + + if (console_fd < 0) { + goto out; + } + + if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) { + goto out; + } + +out: + if (console_fd >= 0) { + close (console_fd); + } + + return console_state.v_active; +} + +static char * +get_active_vt_as_string (void) +{ + int vt; + + vt = get_active_vt (); + + if (vt <= 0) { + return NULL; + } + + return g_strdup_printf ("vt%d", vt); +} + +gboolean +gdm_server_start_on_active_vt (GdmServer *server) +{ + gboolean res; + char *vt; + + g_free (server->priv->command); + server->priv->command = g_strdup (X_SERVER " -background none -logverbose 7"); + vt = get_active_vt_as_string (); + res = gdm_server_spawn (server, vt); + g_free (vt); + + return res; +} +#endif + /** * gdm_server_start: * @disp: Pointer to a GdmDisplay structure |