[gdm] launch-environment: add session-type property



commit cafb4c402e41d4adc3124e443d98c10e98924aa2
Author: Ray Strode <rstrode redhat com>
Date:   Wed Feb 18 14:52:50 2015 -0500

    launch-environment: add session-type property
    
    The session-type property is analagous to the
    sd_login session type.  It can be either "x11" or "wayland".
    
    This helps us decide whether to start a wayland
    session or an X session.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744764

 daemon/gdm-launch-environment.c |   46 ++++++++++++++++++++++++++++++++++++++-
 daemon/gdm-launch-environment.h |    1 +
 daemon/gdm-legacy-display.c     |    1 +
 daemon/gdm-local-display.c      |    1 +
 daemon/gdm-xdmcp-display.c      |    1 +
 5 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c
index a11aa9f..d35e125 100644
--- a/daemon/gdm-launch-environment.c
+++ b/daemon/gdm-launch-environment.c
@@ -69,6 +69,7 @@ struct GdmLaunchEnvironmentPrivate
         char           *runtime_dir;
 
         char           *session_id;
+        char           *session_type;
         char           *x11_display_name;
         char           *x11_display_seat_id;
         char           *x11_display_device;
@@ -80,6 +81,7 @@ struct GdmLaunchEnvironmentPrivate
 enum {
         PROP_0,
         PROP_VERIFICATION_MODE,
+        PROP_SESSION_TYPE,
         PROP_X11_DISPLAY_NAME,
         PROP_X11_DISPLAY_SEAT_ID,
         PROP_X11_DISPLAY_DEVICE,
@@ -505,6 +507,14 @@ gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment)
 
         gdm_session_start_conversation (launch_environment->priv->session, "gdm-launch-environment");
         gdm_session_select_program (launch_environment->priv->session, launch_environment->priv->command);
+
+        if (launch_environment->priv->session_type != NULL) {
+                g_object_set (G_OBJECT (launch_environment->priv->session),
+                              "session-type",
+                              launch_environment->priv->session_type,
+                              NULL);
+        }
+
         res = TRUE;
  out:
         if (local_error) {
@@ -553,6 +563,14 @@ _gdm_launch_environment_set_verification_mode (GdmLaunchEnvironment           *l
 }
 
 static void
+_gdm_launch_environment_set_session_type (GdmLaunchEnvironment *launch_environment,
+                                          const char           *session_type)
+{
+        g_free (launch_environment->priv->session_type);
+        launch_environment->priv->session_type = g_strdup (session_type);
+}
+
+static void
 _gdm_launch_environment_set_x11_display_name (GdmLaunchEnvironment *launch_environment,
                                               const char           *name)
 {
@@ -637,6 +655,9 @@ gdm_launch_environment_set_property (GObject      *object,
         case PROP_VERIFICATION_MODE:
                 _gdm_launch_environment_set_verification_mode (self, g_value_get_enum (value));
                 break;
+        case PROP_SESSION_TYPE:
+                _gdm_launch_environment_set_session_type (self, g_value_get_string (value));
+                break;
         case PROP_X11_DISPLAY_NAME:
                 _gdm_launch_environment_set_x11_display_name (self, g_value_get_string (value));
                 break;
@@ -684,6 +705,9 @@ gdm_launch_environment_get_property (GObject    *object,
         case PROP_VERIFICATION_MODE:
                 g_value_set_enum (value, self->priv->verification_mode);
                 break;
+        case PROP_SESSION_TYPE:
+                g_value_set_string (value, self->priv->session_type);
+                break;
         case PROP_X11_DISPLAY_NAME:
                 g_value_set_string (value, self->priv->x11_display_name);
                 break;
@@ -737,6 +761,13 @@ gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass)
                                                             GDM_SESSION_VERIFICATION_MODE_LOGIN,
                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
         g_object_class_install_property (object_class,
+                                         PROP_SESSION_TYPE,
+                                         g_param_spec_string ("session-type",
+                                                              NULL,
+                                                              NULL,
+                                                              NULL,
+                                                              G_PARAM_READWRITE));
+        g_object_class_install_property (object_class,
                                          PROP_X11_DISPLAY_NAME,
                                          g_param_spec_string ("x11-display-name",
                                                               "name",
@@ -890,6 +921,7 @@ gdm_launch_environment_finalize (GObject *object)
         g_free (launch_environment->priv->x11_display_hostname);
         g_free (launch_environment->priv->x11_authority_file);
         g_free (launch_environment->priv->session_id);
+        g_free (launch_environment->priv->session_type);
 
         G_OBJECT_CLASS (gdm_launch_environment_parent_class)->finalize (object);
 }
@@ -899,6 +931,7 @@ create_gnome_session_environment (const char *session_id,
                                   const char *user_name,
                                   const char *display_name,
                                   const char *seat_id,
+                                  const char *session_type,
                                   const char *display_hostname,
                                   gboolean    display_is_local)
 {
@@ -934,6 +967,7 @@ create_gnome_session_environment (const char *session_id,
         launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT,
                                            "command", command,
                                            "user-name", user_name,
+                                           "session-type", session_type,
                                            "x11-display-name", display_name,
                                            "x11-display-seat-id", seat_id,
                                            "x11-display-hostname", display_hostname,
@@ -948,13 +982,22 @@ create_gnome_session_environment (const char *session_id,
 GdmLaunchEnvironment *
 gdm_create_greeter_launch_environment (const char *display_name,
                                        const char *seat_id,
+                                       const char *session_type,
                                        const char *display_hostname,
                                        gboolean    display_is_local)
 {
-        return create_gnome_session_environment (NULL,
+        const char *session_name = NULL;
+
+        if (g_strcmp0 (session_type, "wayland") == 0)
+                session_name = "gnome-wayland";
+        else if (g_strcmp0 (session_type, "x11") == 0)
+                session_name = "gnome";
+
+        return create_gnome_session_environment (session_name,
                                                  GDM_USERNAME,
                                                  display_name,
                                                  seat_id,
+                                                 session_type,
                                                  display_hostname,
                                                  display_is_local);
 }
@@ -969,6 +1012,7 @@ gdm_create_initial_setup_launch_environment (const char *display_name,
                                                  INITIAL_SETUP_USERNAME,
                                                  display_name,
                                                  seat_id,
+                                                 NULL,
                                                  display_hostname,
                                                  display_is_local);
 }
diff --git a/daemon/gdm-launch-environment.h b/daemon/gdm-launch-environment.h
index 34070b9..3fd875c 100644
--- a/daemon/gdm-launch-environment.h
+++ b/daemon/gdm-launch-environment.h
@@ -70,6 +70,7 @@ char *                gdm_launch_environment_get_session_id     (GdmLaunchEnviro
 
 GdmLaunchEnvironment *gdm_create_greeter_launch_environment (const char *display_name,
                                                              const char *seat_id,
+                                                             const char *session_type,
                                                              const char *display_hostname,
                                                              gboolean    display_is_local);
 GdmLaunchEnvironment *gdm_create_initial_setup_launch_environment (const char *display_name,
diff --git a/daemon/gdm-legacy-display.c b/daemon/gdm-legacy-display.c
index d7a297a..6214c42 100644
--- a/daemon/gdm-legacy-display.c
+++ b/daemon/gdm-legacy-display.c
@@ -111,6 +111,7 @@ gdm_legacy_display_prepare (GdmDisplay *display)
                 launch_environment = gdm_create_greeter_launch_environment (display_name,
                                                                             seat_id,
                                                                             NULL,
+                                                                            NULL,
                                                                             TRUE);
         } else {
                 launch_environment = gdm_create_initial_setup_launch_environment (display_name,
diff --git a/daemon/gdm-local-display.c b/daemon/gdm-local-display.c
index a9762a7..50a3719 100644
--- a/daemon/gdm-local-display.c
+++ b/daemon/gdm-local-display.c
@@ -110,6 +110,7 @@ gdm_local_display_prepare (GdmDisplay *display)
                 launch_environment = gdm_create_greeter_launch_environment (NULL,
                                                                             seat_id,
                                                                             NULL,
+                                                                            NULL,
                                                                             TRUE);
         } else {
                 launch_environment = gdm_create_initial_setup_launch_environment (NULL,
diff --git a/daemon/gdm-xdmcp-display.c b/daemon/gdm-xdmcp-display.c
index b98f6b1..764bcff 100644
--- a/daemon/gdm-xdmcp-display.c
+++ b/daemon/gdm-xdmcp-display.c
@@ -168,6 +168,7 @@ gdm_xdmcp_display_prepare (GdmDisplay *display)
         if (launch_environment == NULL) {
                 launch_environment = gdm_create_greeter_launch_environment (display_name,
                                                                             seat_id,
+                                                                            NULL,
                                                                             hostname,
                                                                             FALSE);
                 g_object_set (self, "launch-environment", launch_environment, NULL);


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