summaryrefslogtreecommitdiff
path: root/daemon/gdm-session.c
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2015-02-17 12:49:39 -0500
committerRay Strode <rstrode@redhat.com>2015-02-18 17:34:16 -0500
commit3402c71e4db08337e7a537cdd85a31eea1d5ff20 (patch)
tree3981fb167093265e9c4f81d226322205546a2bbd /daemon/gdm-session.c
parentb7dbef1ab135ffc2c04c759fce3a3311b4975e44 (diff)
downloadgdm-3402c71e4db08337e7a537cdd85a31eea1d5ff20.tar.gz
session: add session-type property
This property tells us whether or not the display will be wayland. We currently try to autodetect the situation, but fail to for program sessions. This provides a way to override detection. https://bugzilla.gnome.org/show_bug.cgi?id=744764
Diffstat (limited to 'daemon/gdm-session.c')
-rw-r--r--daemon/gdm-session.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 23501fbe..ef5731f6 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -110,6 +110,7 @@ struct _GdmSessionPrivate
GPid session_pid;
/* object lifetime scope */
+ char *session_type;
char *display_name;
char *display_hostname;
char *display_device;
@@ -139,6 +140,7 @@ enum {
PROP_DISPLAY_HOSTNAME,
PROP_DISPLAY_IS_LOCAL,
PROP_DISPLAY_IS_INITIAL,
+ PROP_SESSION_TYPE,
PROP_DISPLAY_DEVICE,
PROP_DISPLAY_SEAT_ID,
PROP_DISPLAY_X11_AUTHORITY_FILE,
@@ -172,6 +174,8 @@ enum {
#ifdef ENABLE_WAYLAND_SUPPORT
static gboolean gdm_session_is_wayland_session (GdmSession *self);
#endif
+static void set_session_type (GdmSession *self,
+ const char *session_type);
static guint signals [LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (GdmSession,
@@ -2418,17 +2422,9 @@ static void
send_session_type (GdmSession *self,
GdmSessionConversation *conversation)
{
- const char *session_type = "x11";
-
-#ifdef ENABLE_WAYLAND_SUPPORT
- if (gdm_session_is_wayland_session (self)) {
- session_type = "wayland";
- }
-#endif
-
gdm_dbus_worker_call_set_environment_variable (conversation->worker_proxy,
"XDG_SESSION_TYPE",
- session_type,
+ self->priv->session_type? : "x11",
NULL, NULL, NULL);
}
@@ -2574,7 +2570,7 @@ gdm_session_start_session (GdmSession *self,
display_mode = gdm_session_get_display_mode (self);
#ifdef ENABLE_WAYLAND_SUPPORT
- is_x11 = !gdm_session_is_wayland_session (self);
+ is_x11 = g_strcmp0 (self->priv->session_type, "wayland") != 0;
#endif
if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED ||
@@ -2905,7 +2901,7 @@ gdm_session_get_display_mode (GdmSession *self)
/* Wayland sessions are for now assumed to run in a
* mutter-launch-like environment, so we allocate
* a new VT for them. */
- if (gdm_session_is_wayland_session (self)) {
+ if (g_strcmp0 (self->priv->session_type, "wayland") == 0) {
return GDM_SESSION_DISPLAY_MODE_NEW_VT;
}
#endif
@@ -2965,10 +2961,18 @@ gdm_session_select_session (GdmSession *self,
{
GHashTableIter iter;
gpointer key, value;
+ gboolean is_wayland_session = FALSE;
g_free (self->priv->selected_session);
self->priv->selected_session = g_strdup (text);
+#ifdef ENABLE_WAYLAND_SUPPORT
+ is_wayland_session = gdm_session_is_wayland_session (self);
+ if (is_wayland_session) {
+ set_session_type (self, "wayland");
+ }
+#endif
+
g_hash_table_iter_init (&iter, self->priv->conversations);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GdmSessionConversation *conversation;
@@ -3069,6 +3073,14 @@ set_conversation_environment (GdmSession *self,
}
static void
+set_session_type (GdmSession *self,
+ const char *session_type)
+{
+ g_free (self->priv->session_type);
+ self->priv->session_type = g_strdup (session_type);
+}
+
+static void
gdm_session_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -3079,6 +3091,9 @@ gdm_session_set_property (GObject *object,
self = GDM_SESSION (object);
switch (prop_id) {
+ case PROP_SESSION_TYPE:
+ set_session_type (self, g_value_get_string (value));
+ break;
case PROP_DISPLAY_NAME:
set_display_name (self, g_value_get_string (value));
break;
@@ -3129,6 +3144,9 @@ gdm_session_get_property (GObject *object,
self = GDM_SESSION (object);
switch (prop_id) {
+ case PROP_SESSION_TYPE:
+ g_value_set_string (value, self->priv->session_type);
+ break;
case PROP_DISPLAY_NAME:
g_value_set_string (value, self->priv->display_name);
break;
@@ -3513,6 +3531,13 @@ gdm_session_class_init (GdmSessionClass *session_class)
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_DISPLAY_NAME,
g_param_spec_string ("display-name",
"display name",