[gdm/wip/xserver-in-session: 49/54] session: start login screen using gdm-x-session wrapper



commit 3c4f14c5a8d6a8ef1fcfa9e9e01bb34221d3dda5
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jan 23 13:59:14 2015 -0500

    session: start login screen using gdm-x-session wrapper
    
    Since we have the wrapper, let's use it for the login screen,
    too, when we can.
    
    This commit removes GdmServer from GdmLocalDisplay, since
    starting the X server should be handled implicitly by
    gdm-x-session, now.
    
    All the old logic is now in a new GdmLegacyDisplay object,
    that will remain for cases where gdm-x-session doesn't work.
    (ConsoleKit systems, non-seat0 displays, etc)

 daemon/Makefile.am                 |    2 +
 daemon/gdm-legacy-display.c        |  264 ++++++++++++++++++++++++++++++++++++
 daemon/gdm-legacy-display.h        |   57 ++++++++
 daemon/gdm-local-display-factory.c |   36 ++++--
 daemon/gdm-local-display.c         |  123 ++----------------
 daemon/gdm-local-display.h         |    2 +-
 daemon/gdm-manager.c               |   12 ++-
 daemon/gdm-session.c               |   34 +++--
 8 files changed, 389 insertions(+), 141 deletions(-)
---
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index fd7ac4a..65b7a95 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -178,6 +178,8 @@ gdm_SOURCES =                       \
        gdm-local-display-factory.h     \
        gdm-display.c                   \
        gdm-display.h                   \
+       gdm-legacy-display.c            \
+       gdm-legacy-display.h            \
        gdm-local-display.c             \
        gdm-local-display.h             \
        gdm-launch-environment.c        \
diff --git a/daemon/gdm-legacy-display.c b/daemon/gdm-legacy-display.c
new file mode 100644
index 0000000..f532597
--- /dev/null
+++ b/daemon/gdm-legacy-display.c
@@ -0,0 +1,264 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann jhu edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib-object.h>
+
+#include "gdm-common.h"
+#include "gdm-display.h"
+#include "gdm-launch-environment.h"
+#include "gdm-legacy-display.h"
+#include "gdm-local-display-glue.h"
+#include "gdm-server.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
+
+#define GDM_LEGACY_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayPrivate))
+
+struct GdmLegacyDisplayPrivate
+{
+        GdmDBusLocalDisplay *skeleton;
+
+        GdmServer           *server;
+};
+
+static void     gdm_legacy_display_class_init   (GdmLegacyDisplayClass *klass);
+static void     gdm_legacy_display_init         (GdmLegacyDisplay      *legacy_display);
+
+G_DEFINE_TYPE (GdmLegacyDisplay, gdm_legacy_display, GDM_TYPE_DISPLAY)
+
+static GObject *
+gdm_legacy_display_constructor (GType                  type,
+                               guint                  n_construct_properties,
+                               GObjectConstructParam *construct_properties)
+{
+        GdmLegacyDisplay      *display;
+
+        display = GDM_LEGACY_DISPLAY (G_OBJECT_CLASS (gdm_legacy_display_parent_class)->constructor (type,
+                                                                                                     
n_construct_properties,
+                                                                                                     
construct_properties));
+
+        display->priv->skeleton = GDM_DBUS_LOCAL_DISPLAY (gdm_dbus_local_display_skeleton_new ());
+
+        g_dbus_object_skeleton_add_interface (gdm_display_get_object_skeleton (GDM_DISPLAY (display)),
+                                              G_DBUS_INTERFACE_SKELETON (display->priv->skeleton));
+
+        return G_OBJECT (display);
+}
+
+static void
+gdm_legacy_display_finalize (GObject *object)
+{
+        GdmLegacyDisplay *display = GDM_LEGACY_DISPLAY (object);
+
+        g_clear_object (&display->priv->skeleton);
+        g_clear_object (&display->priv->server);
+
+        G_OBJECT_CLASS (gdm_legacy_display_parent_class)->finalize (object);
+}
+
+static gboolean
+gdm_legacy_display_prepare (GdmDisplay *display)
+{
+        GdmLegacyDisplay *self = GDM_LEGACY_DISPLAY (display);
+        GdmLaunchEnvironment *launch_environment;
+        char          *display_name;
+        char          *seat_id;
+        gboolean       doing_initial_setup = FALSE;
+
+        display_name = NULL;
+        seat_id = NULL;
+
+        g_object_get (self,
+                      "x11-display-name", &display_name,
+                      "seat-id", &seat_id,
+                      "doing-initial-setup", &doing_initial_setup,
+                      NULL);
+
+        if (!doing_initial_setup) {
+                launch_environment = gdm_create_greeter_launch_environment (display_name,
+                                                                            seat_id,
+                                                                            NULL,
+                                                                            TRUE);
+        } else {
+                launch_environment = gdm_create_initial_setup_launch_environment (display_name,
+                                                                                seat_id,
+                                                                                NULL,
+                                                                                TRUE);
+        }
+
+        g_object_set (self, "launch-environment", launch_environment, NULL);
+        g_object_unref (launch_environment);
+
+        return GDM_DISPLAY_CLASS (gdm_legacy_display_parent_class)->prepare (display);
+}
+
+static void
+on_server_ready (GdmServer       *server,
+                 GdmLegacyDisplay *self)
+{
+        gboolean ret;
+
+        ret = gdm_display_connect (GDM_DISPLAY (self));
+
+        if (!ret) {
+                g_debug ("GdmDisplay: could not connect to display");
+                gdm_display_unmanage (GDM_DISPLAY (self));
+        } else {
+                g_debug ("GdmDisplay: connected to display");
+                g_object_set (G_OBJECT (self), "status", GDM_DISPLAY_MANAGED, NULL);
+        }
+}
+
+static void
+on_server_exited (GdmServer  *server,
+                  int         exit_code,
+                  GdmDisplay *self)
+{
+        g_debug ("GdmDisplay: server exited with code %d\n", exit_code);
+
+        gdm_display_unmanage (GDM_DISPLAY (self));
+}
+
+static void
+on_server_died (GdmServer  *server,
+                int         signal_number,
+                GdmDisplay *self)
+{
+        g_debug ("GdmDisplay: server died with signal %d, (%s)",
+                 signal_number,
+                 g_strsignal (signal_number));
+
+        gdm_display_unmanage (GDM_DISPLAY (self));
+}
+
+static void
+gdm_legacy_display_manage (GdmDisplay *display)
+{
+        GdmLegacyDisplay *self = GDM_LEGACY_DISPLAY (display);
+        char            *display_name;
+        char            *auth_file;
+        char            *seat_id;
+        gboolean         is_initial;
+        gboolean         res;
+        gboolean         disable_tcp;
+
+        g_object_get (G_OBJECT (self),
+                      "x11-display-name", &display_name,
+                      "x11-authority-file", &auth_file,
+                      "seat-id", &seat_id,
+                      "is-initial", &is_initial,
+                      NULL);
+
+        self->priv->server = gdm_server_new (display_name, seat_id, auth_file, is_initial);
+
+        g_free (display_name);
+        g_free (auth_file);
+        g_free (seat_id);
+
+        disable_tcp = TRUE;
+        if (gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disable_tcp)) {
+                g_object_set (self->priv->server,
+                              "disable-tcp", disable_tcp,
+                              NULL);
+        }
+
+        g_signal_connect (self->priv->server,
+                          "exited",
+                          G_CALLBACK (on_server_exited),
+                          self);
+        g_signal_connect (self->priv->server,
+                          "died",
+                          G_CALLBACK (on_server_died),
+                          self);
+        g_signal_connect (self->priv->server,
+                          "ready",
+                          G_CALLBACK (on_server_ready),
+                          self);
+
+        res = gdm_server_start (self->priv->server);
+        if (! res) {
+                g_warning (_("Could not start the X "
+                             "server (your graphical environment) "
+                             "due to an internal error. "
+                             "Please contact your system administrator "
+                             "or check your syslog to diagnose. "
+                             "In the meantime this display will be "
+                             "disabled.  Please restart GDM when "
+                             "the problem is corrected."));
+                gdm_display_unmanage (GDM_DISPLAY (self));
+        }
+
+        g_debug ("GdmDisplay: Started X server");
+
+}
+
+static void
+gdm_legacy_display_class_init (GdmLegacyDisplayClass *klass)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
+        GdmDisplayClass *display_class = GDM_DISPLAY_CLASS (klass);
+
+        object_class->constructor = gdm_legacy_display_constructor;
+        object_class->finalize = gdm_legacy_display_finalize;
+
+        display_class->prepare = gdm_legacy_display_prepare;
+        display_class->manage = gdm_legacy_display_manage;
+
+        g_type_class_add_private (klass, sizeof (GdmLegacyDisplayPrivate));
+}
+
+static void
+gdm_legacy_display_init (GdmLegacyDisplay *legacy_display)
+{
+
+        legacy_display->priv = GDM_LEGACY_DISPLAY_GET_PRIVATE (legacy_display);
+}
+
+GdmDisplay *
+gdm_legacy_display_new (int display_number)
+{
+        GObject *object;
+        char    *x11_display;
+
+        x11_display = g_strdup_printf (":%d", display_number);
+        object = g_object_new (GDM_TYPE_LEGACY_DISPLAY,
+                               "x11-display-number", display_number,
+                               "x11-display-name", x11_display,
+                               NULL);
+        g_free (x11_display);
+
+        return GDM_DISPLAY (object);
+}
diff --git a/daemon/gdm-legacy-display.h b/daemon/gdm-legacy-display.h
new file mode 100644
index 0000000..050a14e
--- /dev/null
+++ b/daemon/gdm-legacy-display.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann jhu edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#ifndef __GDM_LEGACY_DISPLAY_H
+#define __GDM_LEGACY_DISPLAY_H
+
+#include <glib-object.h>
+#include "gdm-display.h"
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_LEGACY_DISPLAY         (gdm_legacy_display_get_type ())
+#define GDM_LEGACY_DISPLAY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplay))
+#define GDM_LEGACY_DISPLAY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayClass))
+#define GDM_IS_LEGACY_DISPLAY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_LEGACY_DISPLAY))
+#define GDM_IS_LEGACY_DISPLAY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_LEGACY_DISPLAY))
+#define GDM_LEGACY_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayClass))
+
+typedef struct GdmLegacyDisplayPrivate GdmLegacyDisplayPrivate;
+
+typedef struct
+{
+        GdmDisplay               parent;
+        GdmLegacyDisplayPrivate *priv;
+} GdmLegacyDisplay;
+
+typedef struct
+{
+        GdmDisplayClass   parent_class;
+
+} GdmLegacyDisplayClass;
+
+GType               gdm_legacy_display_get_type                (void);
+GdmDisplay *        gdm_legacy_display_new                     (int display_number);
+
+
+G_END_DECLS
+
+#endif /* __GDM_LEGACY_DISPLAY_H */
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index de2feb7..94a15dd 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -36,6 +36,7 @@
 
 #include "gdm-display-store.h"
 #include "gdm-local-display.h"
+#include "gdm-legacy-display.h"
 
 #define GDM_LOCAL_DISPLAY_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
GDM_TYPE_LOCAL_DISPLAY_FACTORY, GdmLocalDisplayFactoryPrivate))
 
@@ -218,19 +219,26 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact
                                                     GError                **error)
 {
         gboolean         ret;
-        GdmDisplay      *display;
-        guint32          num;
+        GdmDisplay      *display = NULL;
         const char      *seat_id;
 
         g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
 
         ret = FALSE;
 
-        num = take_next_display_number (factory);
+        g_debug ("GdmLocalDisplayFactory: Creating transient display");
 
-        g_debug ("GdmLocalDisplayFactory: Creating transient display %d", num);
+#ifdef WITH_SYSTEMD
+        display = gdm_local_display_new ();
+#endif
+
+        if (display == NULL) {
+                guint32 num;
 
-        display = gdm_local_display_new (num);
+                num = take_next_display_number (factory);
+
+                display = gdm_legacy_display_new (num);
+        }
 
         seat_id = get_seat_of_transient_display (factory);
         g_object_set (display,
@@ -355,8 +363,7 @@ create_display (GdmLocalDisplayFactory *factory,
                 gboolean                initial)
 {
         GdmDisplayStore *store;
-        GdmDisplay      *display;
-        guint32          num;
+        GdmDisplay      *display = NULL;
 
         /* Ensure we don't create the same display more than once */
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
@@ -367,9 +374,20 @@ create_display (GdmLocalDisplayFactory *factory,
 
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
 
-        num = take_next_display_number (factory);
 
-        display = gdm_local_display_new (num);
+#ifdef WITH_SYSTEMD
+        if (g_strcmp0 (seat_id, "seat0") == 0) {
+                display = gdm_local_display_new ();
+        }
+#endif
+
+        if (display == NULL) {
+                guint32 num;
+
+                num = take_next_display_number (factory);
+
+                display = gdm_legacy_display_new (num);
+        }
 
         g_object_set (display, "seat-id", seat_id, NULL);
         g_object_set (display, "is-initial", initial, NULL);
diff --git a/daemon/gdm-local-display.c b/daemon/gdm-local-display.c
index 505a1b3..d79212d 100644
--- a/daemon/gdm-local-display.c
+++ b/daemon/gdm-local-display.c
@@ -41,7 +41,6 @@
 #include "gdm-launch-environment.h"
 #include "gdm-local-display.h"
 #include "gdm-local-display-glue.h"
-#include "gdm-server.h"
 #include "gdm-settings-direct.h"
 #include "gdm-settings-keys.h"
 
@@ -50,8 +49,6 @@
 struct GdmLocalDisplayPrivate
 {
         GdmDBusLocalDisplay *skeleton;
-
-        GdmServer           *server;
 };
 
 static void     gdm_local_display_class_init   (GdmLocalDisplayClass *klass);
@@ -84,7 +81,6 @@ gdm_local_display_finalize (GObject *object)
         GdmLocalDisplay *display = GDM_LOCAL_DISPLAY (object);
 
         g_clear_object (&display->priv->skeleton);
-        g_clear_object (&display->priv->server);
 
         G_OBJECT_CLASS (gdm_local_display_parent_class)->finalize (object);
 }
@@ -94,29 +90,26 @@ gdm_local_display_prepare (GdmDisplay *display)
 {
         GdmLocalDisplay *self = GDM_LOCAL_DISPLAY (display);
         GdmLaunchEnvironment *launch_environment;
-        char          *display_name;
         char          *seat_id;
         gboolean       doing_initial_setup = FALSE;
 
-        display_name = NULL;
         seat_id = NULL;
 
         g_object_get (self,
-                      "x11-display-name", &display_name,
                       "seat-id", &seat_id,
                       "doing-initial-setup", &doing_initial_setup,
                       NULL);
 
         if (!doing_initial_setup) {
-                launch_environment = gdm_create_greeter_launch_environment (display_name,
+                launch_environment = gdm_create_greeter_launch_environment (NULL,
                                                                             seat_id,
                                                                             NULL,
                                                                             TRUE);
         } else {
-                launch_environment = gdm_create_initial_setup_launch_environment (display_name,
-                                                                            seat_id,
-                                                                            NULL,
-                                                                            TRUE);
+                launch_environment = gdm_create_initial_setup_launch_environment (NULL,
+                                                                                seat_id,
+                                                                                NULL,
+                                                                                TRUE);
         }
 
         g_object_set (self, "launch-environment", launch_environment, NULL);
@@ -126,103 +119,11 @@ gdm_local_display_prepare (GdmDisplay *display)
 }
 
 static void
-on_server_ready (GdmServer       *server,
-                 GdmLocalDisplay *self)
-{
-        gboolean ret;
-
-        ret = gdm_display_connect (GDM_DISPLAY (self));
-
-        if (!ret) {
-                g_debug ("GdmDisplay: could not connect to display");
-                gdm_display_unmanage (GDM_DISPLAY (self));
-        } else {
-                g_debug ("GdmDisplay: connected to display");
-                g_object_set (G_OBJECT (self), "status", GDM_DISPLAY_MANAGED, NULL);
-        }
-}
-
-static void
-on_server_exited (GdmServer  *server,
-                  int         exit_code,
-                  GdmDisplay *self)
-{
-        g_debug ("GdmDisplay: server exited with code %d\n", exit_code);
-
-        gdm_display_unmanage (GDM_DISPLAY (self));
-}
-
-static void
-on_server_died (GdmServer  *server,
-                int         signal_number,
-                GdmDisplay *self)
-{
-        g_debug ("GdmDisplay: server died with signal %d, (%s)",
-                 signal_number,
-                 g_strsignal (signal_number));
-
-        gdm_display_unmanage (GDM_DISPLAY (self));
-}
-
-static void
 gdm_local_display_manage (GdmDisplay *display)
 {
         GdmLocalDisplay *self = GDM_LOCAL_DISPLAY (display);
-        char            *display_name;
-        char            *auth_file;
-        char            *seat_id;
-        gboolean         is_initial;
-        gboolean         res;
-        gboolean         disable_tcp;
-
-        g_object_get (G_OBJECT (self),
-                      "x11-display-name", &display_name,
-                      "x11-authority-file", &auth_file,
-                      "seat-id", &seat_id,
-                      "is-initial", &is_initial,
-                      NULL);
-
-        self->priv->server = gdm_server_new (display_name, seat_id, auth_file, is_initial);
-
-        g_free (display_name);
-        g_free (auth_file);
-        g_free (seat_id);
-
-        disable_tcp = TRUE;
-        if (gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disable_tcp)) {
-                g_object_set (self->priv->server,
-                              "disable-tcp", disable_tcp,
-                              NULL);
-        }
-
-        g_signal_connect (self->priv->server,
-                          "exited",
-                          G_CALLBACK (on_server_exited),
-                          self);
-        g_signal_connect (self->priv->server,
-                          "died",
-                          G_CALLBACK (on_server_died),
-                          self);
-        g_signal_connect (self->priv->server,
-                          "ready",
-                          G_CALLBACK (on_server_ready),
-                          self);
-
-        res = gdm_server_start (self->priv->server);
-        if (! res) {
-                g_warning (_("Could not start the X "
-                             "server (your graphical environment) "
-                             "due to an internal error. "
-                             "Please contact your system administrator "
-                             "or check your syslog to diagnose. "
-                             "In the meantime this display will be "
-                             "disabled.  Please restart GDM when "
-                             "the problem is corrected."));
-                gdm_display_unmanage (GDM_DISPLAY (self));
-        }
-
-        g_debug ("GdmDisplay: Started X server");
 
+        g_object_set (G_OBJECT (self), "status", GDM_DISPLAY_MANAGED, NULL);
 }
 
 static void
@@ -248,17 +149,11 @@ gdm_local_display_init (GdmLocalDisplay *local_display)
 }
 
 GdmDisplay *
-gdm_local_display_new (int display_number)
+gdm_local_display_new (void)
 {
         GObject *object;
-        char    *x11_display;
-
-        x11_display = g_strdup_printf (":%d", display_number);
-        object = g_object_new (GDM_TYPE_LOCAL_DISPLAY,
-                               "x11-display-number", display_number,
-                               "x11-display-name", x11_display,
-                               NULL);
-        g_free (x11_display);
+
+        object = g_object_new (GDM_TYPE_LOCAL_DISPLAY, NULL);
 
         return GDM_DISPLAY (object);
 }
diff --git a/daemon/gdm-local-display.h b/daemon/gdm-local-display.h
index 9ece9be..dec22f5 100644
--- a/daemon/gdm-local-display.h
+++ b/daemon/gdm-local-display.h
@@ -49,7 +49,7 @@ typedef struct
 } GdmLocalDisplayClass;
 
 GType               gdm_local_display_get_type                (void);
-GdmDisplay *        gdm_local_display_new                     (int display_number);
+GdmDisplay *        gdm_local_display_new                     (void);
 
 
 G_END_DECLS
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 1d5f576..393eb3f 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1481,17 +1481,22 @@ on_display_status_changed (GdmDisplay *display,
                            GdmManager *manager)
 {
         int         status;
+        int         display_number = -1;
 #ifdef WITH_PLYMOUTH
         gboolean    display_is_local = FALSE;
         gboolean    quit_plymouth = FALSE;
 
-        g_object_get (display, "is-local", &display_is_local, NULL);
+        g_object_get (display,
+                      "is-local", &display_is_local,
+                      "x11-display-number", &display_number,
+                      NULL);
         quit_plymouth = display_is_local && manager->priv->plymouth_is_running;
 #endif
 
         status = gdm_display_get_status (display);
 
         switch (status) {
+                case GDM_DISPLAY_PREPARED:
                 case GDM_DISPLAY_MANAGED:
 #ifdef WITH_PLYMOUTH
                         if (quit_plymouth) {
@@ -1499,7 +1504,10 @@ on_display_status_changed (GdmDisplay *display,
                                 manager->priv->plymouth_is_running = FALSE;
                         }
 #endif
-                        set_up_greeter_session (manager, display);
+                        if ((display_number == -1 && status == GDM_DISPLAY_PREPARED) ||
+                            (display_number != -1 && status == GDM_DISPLAY_MANAGED)) {
+                                set_up_greeter_session (manager, display);
+                        }
                         break;
                 case GDM_DISPLAY_FAILED:
                 case GDM_DISPLAY_UNMANAGED:
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index f53cc4c..bfad133 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2546,6 +2546,9 @@ gdm_session_start_session (GdmSession *self,
                            const char *service_name)
 {
         GdmSessionConversation *conversation;
+        GdmSessionDisplayMode   display_mode;
+        gboolean                is_x11 = TRUE;
+        gboolean                run_launcher = FALSE;
         char             *command;
         char             *program;
 
@@ -2562,25 +2565,21 @@ gdm_session_start_session (GdmSession *self,
 
         stop_all_other_conversations (self, conversation, FALSE);
 
+        display_mode = gdm_session_get_display_mode (self);
+#ifdef ENABLE_WAYLAND_SUPPORT
+        is_x11 = !gdm_session_is_wayland_session (self);
+#endif
+
+        if (is_x11 && display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED) {
+                run_launcher = TRUE;
+        }
+
         if (self->priv->selected_program == NULL) {
-                GdmSessionDisplayMode display_mode;
-                gboolean              is_x11 = TRUE;
-                gboolean              run_launcher = FALSE;
                 gboolean              allow_remote_connections = FALSE;
                 gboolean              run_xsession_script;
 
                 command = get_session_command (self);
 
-                display_mode = gdm_session_get_display_mode (self);
-
-#ifdef ENABLE_WAYLAND_SUPPORT
-                is_x11 = !gdm_session_is_wayland_session (self);
-#endif
-
-                if (is_x11 && display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED) {
-                        run_launcher = TRUE;
-                }
-
                 run_xsession_script = !gdm_session_bypasses_xsession (self);
 
                 if (self->priv->display_is_local) {
@@ -2604,7 +2603,12 @@ gdm_session_start_session (GdmSession *self,
 
                 g_free (command);
         } else {
-                program = g_strdup (self->priv->selected_program);
+                if (run_launcher) {
+                        program = g_strdup_printf (LIBEXECDIR "/gdm-x-session \"%s\"",
+                                                   self->priv->selected_program);
+                } else {
+                        program = g_strdup (self->priv->selected_program);
+                }
         }
 
         set_up_session_environment (self);
@@ -2901,7 +2905,7 @@ gdm_session_get_display_mode (GdmSession *self)
          * reuse VT
          */
         if (self->priv->is_program_session) {
-                return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
+                return GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED;
         }
 
         /* user based X sessions start on a new VT now and are managed


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