summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHalton Huo <halton.huo@sun.com>2009-09-11 18:48:01 +0800
committerHalton Huo <halton.huo@sun.com>2009-09-11 18:48:01 +0800
commitac5fc4f2e649c5fa243a031ade4128a0544eb096 (patch)
tree73b99b8c026dace551f0a4987a95f7b11a72e6a7
parent1f20b75ad274d4a339690315caba866a2f3596fe (diff)
downloadgdm-ac5fc4f2e649c5fa243a031ade4128a0544eb096.tar.gz
Add display-type property when open a new session from GdmSessionWorker.
Corresponding ConsoleKit multi-seat commit is 6a432264767b3e8383270c349899926ca2d326be This allow the user session can inherit display-type property from login window session. It is very useful for dynamic usage like Sunray to get right sessions list which it only care about. Without this change, the user session won't have the right display-type property, hence can not get the right results for specific display-type. For example: 1) Sunray will create a login window session $/usr/sbin/ck-seat-tool -a --display-type=Sunray display=:11 2) If we run $/usr/bin/ck-list-sessions -f session-id,x11-display,display-type 'Session11' ':11' 'Sunray' 'SessionSeat1Local' ':0' 'Local' 3) If user get login, the login session Session11 will be removed, a new user session Session12 will be created. Without this commit, Session12 do not display-type $/usr/bin/ck-list-sessions -f session-id,x11-display,display-type 'Session12' ':11' '' 'SessionSeat1Local' ':0' 'Local' With this commit, Session12 inherit display-type from Session11, that is what we want. $/usr/bin/ck-list-sessions -f session-id,x11-display,display-type 'Session12' ':11' 'Sunray' 'SessionSeat1Local' ':0' 'Local' The display-type property is typically passed as following sequence: 1) console-kit-daemon init and create a static seat "Seat1" and create a un-open session "SessionSeat1Local", stay unmanaged status 2) gdm-binary init and send "Manage" for "Seat1" 3) console-kit-daemon go through all un-open sessions for "Seat1", and send out "OpenSessionRequest" for that session with property display-type. 4) gdm-binary receive "OpenSessionRequest" for given session, 4.1) Create a GdmDisplay with property display-type. 4.2) Spwan a gdm-simple-slave process. 4.3) Create GdmSimpleSlave with property display-type by quering GdmDisplay. 4.4) Create a GdmSessionDirect with property display-type. 4.5) Sqawn gdm-session-worker process, the properties includs display-type are get from "Setup" or "SetupForUser". 5) When user sucessfully logged in, GdmSessionWorker will create a user session by call "OpenSessionWithParameters" with property display-type 6) console-kit-daemon remove "OpenSessionWithParameters", then create a new session "Session1" with property display-type.
-rw-r--r--common/gdm-marshal.list2
-rw-r--r--daemon/ck-connector.c1
-rw-r--r--daemon/gdm-display.c38
-rw-r--r--daemon/gdm-display.h3
-rw-r--r--daemon/gdm-display.xml3
-rw-r--r--daemon/gdm-local-display-factory.c12
-rw-r--r--daemon/gdm-product-slave.c4
-rw-r--r--daemon/gdm-session-direct.c44
-rw-r--r--daemon/gdm-session-direct.h1
-rw-r--r--daemon/gdm-session-worker.c24
-rw-r--r--daemon/gdm-simple-slave.c3
-rw-r--r--daemon/gdm-slave.c43
-rw-r--r--daemon/test-session.c1
13 files changed, 175 insertions, 4 deletions
diff --git a/common/gdm-marshal.list b/common/gdm-marshal.list
index 0a9b4e64..d6578fd4 100644
--- a/common/gdm-marshal.list
+++ b/common/gdm-marshal.list
@@ -5,4 +5,4 @@ VOID:STRING,STRING
VOID:UINT,UINT
VOID:STRING,INT
VOID:DOUBLE
-VOID:STRING,STRING,POINTER,STRING,POINTER
+VOID:STRING,STRING,STRING,POINTER,STRING,POINTER
diff --git a/daemon/ck-connector.c b/daemon/ck-connector.c
index 14f0527b..8f6a4079 100644
--- a/daemon/ck-connector.c
+++ b/daemon/ck-connector.c
@@ -81,6 +81,7 @@ static struct {
{ "session", DBUS_TYPE_STRING },
{ "remote-host-name", DBUS_TYPE_STRING },
{ "session-type", DBUS_TYPE_STRING },
+ { "display-type", DBUS_TYPE_STRING },
{ "is-local", DBUS_TYPE_BOOLEAN },
{ "is-dynamic", DBUS_TYPE_BOOLEAN },
{ "unix-user", DBUS_TYPE_INT32 },
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 24be2455..da60e5f8 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -58,6 +58,7 @@ struct GdmDisplayPrivate
char *x11_command;
int x11_display_number;
char *x11_display_name;
+ char *x11_display_type;
int status;
time_t creation_time;
GTimer *slave_timer;
@@ -88,6 +89,7 @@ enum {
PROP_REMOTE_HOSTNAME,
PROP_X11_DISPLAY_NUMBER,
PROP_X11_DISPLAY_NAME,
+ PROP_X11_DISPLAY_TYPE,
PROP_X11_COOKIE,
PROP_X11_AUTHORITY_FILE,
PROP_IS_LOCAL,
@@ -797,6 +799,20 @@ gdm_display_get_x11_display_name (GdmDisplay *display,
}
gboolean
+gdm_display_get_x11_display_type (GdmDisplay *display,
+ char **type,
+ GError **error)
+{
+ g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
+
+ if (type != NULL) {
+ *type = g_strdup (display->priv->x11_display_type);
+ }
+
+ return TRUE;
+}
+
+gboolean
gdm_display_is_local (GdmDisplay *display,
gboolean *local,
GError **error)
@@ -904,6 +920,14 @@ _gdm_display_set_x11_display_name (GdmDisplay *display,
}
static void
+_gdm_display_set_x11_display_type (GdmDisplay *display,
+ const char *display_type)
+{
+ g_free (display->priv->x11_display_type);
+ display->priv->x11_display_type = g_strdup (display_type);
+}
+
+static void
_gdm_display_set_x11_cookie (GdmDisplay *display,
const char *x11_cookie)
{
@@ -982,6 +1006,9 @@ gdm_display_set_property (GObject *object,
case PROP_X11_DISPLAY_NAME:
_gdm_display_set_x11_display_name (self, g_value_get_string (value));
break;
+ case PROP_X11_DISPLAY_TYPE:
+ _gdm_display_set_x11_display_type (self, g_value_get_string (value));
+ break;
case PROP_X11_COOKIE:
_gdm_display_set_x11_cookie (self, g_value_get_string (value));
break;
@@ -1041,6 +1068,9 @@ gdm_display_get_property (GObject *object,
case PROP_X11_DISPLAY_NAME:
g_value_set_string (value, self->priv->x11_display_name);
break;
+ case PROP_X11_DISPLAY_TYPE:
+ g_value_set_string (value, self->priv->x11_display_type);
+ break;
case PROP_X11_COOKIE:
g_value_set_string (value, self->priv->x11_cookie);
break;
@@ -1209,6 +1239,13 @@ gdm_display_class_init (GdmDisplayClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
+ PROP_X11_DISPLAY_TYPE,
+ g_param_spec_string ("x11-display-type",
+ "x11-display-type",
+ "x11-display-type",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
PROP_SEAT_ID,
g_param_spec_string ("seat-id",
"seat id",
@@ -1315,6 +1352,7 @@ gdm_display_finalize (GObject *object)
g_free (display->priv->session_id);
g_free (display->priv->remote_hostname);
g_free (display->priv->x11_display_name);
+ g_free (display->priv->x11_display_type);
g_free (display->priv->x11_cookie);
g_free (display->priv->slave_command);
diff --git a/daemon/gdm-display.h b/daemon/gdm-display.h
index d615af88..492aa5fb 100644
--- a/daemon/gdm-display.h
+++ b/daemon/gdm-display.h
@@ -114,6 +114,9 @@ gboolean gdm_display_get_x11_display_number (GdmDisplay *disp
gboolean gdm_display_get_x11_display_name (GdmDisplay *display,
char **x11_display,
GError **error);
+gboolean gdm_display_get_x11_display_type (GdmDisplay *display,
+ char **type,
+ GError **error);
gboolean gdm_display_get_seat_id (GdmDisplay *display,
char **seat_id,
GError **error);
diff --git a/daemon/gdm-display.xml b/daemon/gdm-display.xml
index 65e26b5f..945939a1 100644
--- a/daemon/gdm-display.xml
+++ b/daemon/gdm-display.xml
@@ -10,6 +10,9 @@
<method name="GetX11DisplayName">
<arg name="name" direction="out" type="s"/>
</method>
+ <method name="GetX11DisplayType">
+ <arg name="type" direction="out" type="s"/>
+ </method>
<method name="GetX11DisplayNumber">
<arg name="number" direction="out" type="i"/>
</method>
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 2a28c14a..6512f9b3 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -508,7 +508,8 @@ strrep (char* in, char** out, char* old, char* new)
static void
seat_open_session_request (DBusGProxy *seat_proxy,
const char *ssid,
- const char *type,
+ const char *session_type,
+ const char *display_template_name,
GHashTable *display_variables,
const char *display_type,
GHashTable *parameters,
@@ -610,6 +611,8 @@ seat_open_session_request (DBusGProxy *seat_proxy,
if (IS_STR_SET (comm))
g_object_set (display, "x11-command", comm, NULL);
g_free (comm);
+ if (IS_STR_SET (display_template_name))
+ g_object_set (display, "x11-display-type", display_template_name, NULL);
g_object_set (display, "use-auth", use_auth, NULL);
g_signal_connect (display,
@@ -764,9 +767,11 @@ manage_static_sessions_per_seat (GdmLocalDisplayFactory *factory,
return;
}
- dbus_g_object_register_marshaller (gdm_marshal_VOID__STRING_STRING_POINTER_STRING_POINTER,
+ dbus_g_object_register_marshaller (gdm_marshal_VOID__STRING_STRING_STRING_POINTER_STRING_POINTER,
G_TYPE_NONE,
- DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING,
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
GDM_DBUS_TYPE_G_STRING_STRING_HASHTABLE,
G_TYPE_STRING,
GDM_DBUS_TYPE_G_STRING_STRING_HASHTABLE,
@@ -775,6 +780,7 @@ manage_static_sessions_per_seat (GdmLocalDisplayFactory *factory,
"OpenSessionRequest",
DBUS_TYPE_G_OBJECT_PATH,
G_TYPE_STRING,
+ G_TYPE_STRING,
GDM_DBUS_TYPE_G_STRING_STRING_HASHTABLE,
G_TYPE_STRING,
GDM_DBUS_TYPE_G_STRING_STRING_HASHTABLE,
diff --git a/daemon/gdm-product-slave.c b/daemon/gdm-product-slave.c
index 2af3a46d..c767b538 100644
--- a/daemon/gdm-product-slave.c
+++ b/daemon/gdm-product-slave.c
@@ -800,6 +800,7 @@ create_new_session (GdmProductSlave *slave)
gboolean display_is_local;
char *display_id;
char *display_name;
+ char *display_type;
char *display_hostname;
char *display_device;
char *display_x11_authority_file;
@@ -809,6 +810,7 @@ create_new_session (GdmProductSlave *slave)
g_object_get (slave,
"display-id", &display_id,
"display-name", &display_name,
+ "display-type", &display_type,
"display-hostname", &display_hostname,
"display-is-local", &display_is_local,
"display-x11-authority-file", &display_x11_authority_file,
@@ -819,12 +821,14 @@ create_new_session (GdmProductSlave *slave)
slave->priv->session = gdm_session_direct_new (display_id,
display_name,
+ display_type,
display_hostname,
display_device,
display_x11_authority_file,
display_is_local);
g_free (display_id);
g_free (display_name);
+ g_free (display_type);
g_free (display_hostname);
g_free (display_device);
diff --git a/daemon/gdm-session-direct.c b/daemon/gdm-session-direct.c
index 1a08aede..339f335e 100644
--- a/daemon/gdm-session-direct.c
+++ b/daemon/gdm-session-direct.c
@@ -85,6 +85,7 @@ struct _GdmSessionDirectPrivate
char *id;
char *display_id;
char *display_name;
+ char *display_type;
char *display_hostname;
char *display_device;
char *display_x11_authority_file;
@@ -101,6 +102,7 @@ enum {
PROP_0,
PROP_DISPLAY_ID,
PROP_DISPLAY_NAME,
+ PROP_DISPLAY_TYPE,
PROP_DISPLAY_HOSTNAME,
PROP_DISPLAY_IS_LOCAL,
PROP_DISPLAY_DEVICE,
@@ -1298,6 +1300,7 @@ do_introspect (DBusConnection *connection,
" <signal name=\"Setup\">\n"
" <arg name=\"service_name\" type=\"s\"/>\n"
" <arg name=\"x11_display_name\" type=\"s\"/>\n"
+ " <arg name=\"x11_display_type\" type=\"s\"/>\n"
" <arg name=\"display_device\" type=\"s\"/>\n"
" <arg name=\"hostname\" type=\"s\"/>\n"
" <arg name=\"x11_authority_file\" type=\"s\"/>\n"
@@ -1305,6 +1308,7 @@ do_introspect (DBusConnection *connection,
" <signal name=\"SetupForUser\">\n"
" <arg name=\"service_name\" type=\"s\"/>\n"
" <arg name=\"x11_display_name\" type=\"s\"/>\n"
+ " <arg name=\"x11_display_type\" type=\"s\"/>\n"
" <arg name=\"display_device\" type=\"s\"/>\n"
" <arg name=\"hostname\" type=\"s\"/>\n"
" <arg name=\"x11_authority_file\" type=\"s\"/>\n"
@@ -1687,6 +1691,7 @@ send_setup (GdmSessionDirect *session,
DBusMessage *message;
DBusMessageIter iter;
const char *display_name;
+ const char *display_type;
const char *display_device;
const char *display_hostname;
const char *display_x11_authority_file;
@@ -1698,6 +1703,11 @@ send_setup (GdmSessionDirect *session,
} else {
display_name = "";
}
+ if (session->priv->display_type != NULL) {
+ display_type = session->priv->display_type;
+ } else {
+ display_type = "";
+ }
if (session->priv->display_hostname != NULL) {
display_hostname = session->priv->display_hostname;
} else {
@@ -1723,6 +1733,7 @@ send_setup (GdmSessionDirect *session,
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &service_name);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_name);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_type);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_device);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_hostname);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_x11_authority_file);
@@ -1741,6 +1752,7 @@ send_setup_for_user (GdmSessionDirect *session,
DBusMessage *message;
DBusMessageIter iter;
const char *display_name;
+ const char *display_type;
const char *display_device;
const char *display_hostname;
const char *display_x11_authority_file;
@@ -1753,6 +1765,11 @@ send_setup_for_user (GdmSessionDirect *session,
} else {
display_name = "";
}
+ if (session->priv->display_type != NULL) {
+ display_type = session->priv->display_type;
+ } else {
+ display_type = "";
+ }
if (session->priv->display_hostname != NULL) {
display_hostname = session->priv->display_hostname;
} else {
@@ -1783,6 +1800,7 @@ send_setup_for_user (GdmSessionDirect *session,
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &service_name);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_name);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_type);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_device);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_hostname);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_x11_authority_file);
@@ -2188,6 +2206,14 @@ _gdm_session_direct_set_display_name (GdmSessionDirect *session,
}
static void
+_gdm_session_direct_set_display_type (GdmSessionDirect *session,
+ const char *type)
+{
+ g_free (session->priv->display_type);
+ session->priv->display_type = g_strdup (type);
+}
+
+static void
_gdm_session_direct_set_display_hostname (GdmSessionDirect *session,
const char *name)
{
@@ -2252,6 +2278,9 @@ gdm_session_direct_set_property (GObject *object,
case PROP_DISPLAY_NAME:
_gdm_session_direct_set_display_name (self, g_value_get_string (value));
break;
+ case PROP_DISPLAY_TYPE:
+ _gdm_session_direct_set_display_type (self, g_value_get_string (value));
+ break;
case PROP_DISPLAY_HOSTNAME:
_gdm_session_direct_set_display_hostname (self, g_value_get_string (value));
break;
@@ -2293,6 +2322,9 @@ gdm_session_direct_get_property (GObject *object,
case PROP_DISPLAY_NAME:
g_value_set_string (value, self->priv->display_name);
break;
+ case PROP_DISPLAY_TYPE:
+ g_value_set_string (value, self->priv->display_type);
+ break;
case PROP_DISPLAY_HOSTNAME:
g_value_set_string (value, self->priv->display_hostname);
break;
@@ -2334,6 +2366,9 @@ gdm_session_direct_dispose (GObject *object)
g_free (session->priv->display_name);
session->priv->display_name = NULL;
+ g_free (session->priv->display_type);
+ session->priv->display_type = NULL;
+
g_free (session->priv->display_hostname);
session->priv->display_hostname = NULL;
@@ -2486,6 +2521,13 @@ gdm_session_direct_class_init (GdmSessionDirectClass *session_class)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
+ PROP_DISPLAY_TYPE,
+ g_param_spec_string ("display-type",
+ "display type",
+ "display type",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
PROP_DISPLAY_HOSTNAME,
g_param_spec_string ("display-hostname",
"display hostname",
@@ -2537,6 +2579,7 @@ gdm_session_direct_class_init (GdmSessionDirectClass *session_class)
GdmSessionDirect *
gdm_session_direct_new (const char *display_id,
const char *display_name,
+ const char *display_type,
const char *display_hostname,
const char *display_device,
const char *display_x11_authority_file,
@@ -2547,6 +2590,7 @@ gdm_session_direct_new (const char *display_id,
session = g_object_new (GDM_TYPE_SESSION_DIRECT,
"display-id", display_id,
"display-name", display_name,
+ "display-type", display_type,
"display-hostname", display_hostname,
"display-device", display_device,
"display-x11-authority-file", display_x11_authority_file,
diff --git a/daemon/gdm-session-direct.h b/daemon/gdm-session-direct.h
index 284d902f..766aa0a2 100644
--- a/daemon/gdm-session-direct.h
+++ b/daemon/gdm-session-direct.h
@@ -50,6 +50,7 @@ GType gdm_session_direct_get_type (void);
GdmSessionDirect * gdm_session_direct_new (const char *display_id,
const char *display_name,
+ const char *display_type,
const char *display_hostname,
const char *display_device,
const char *display_x11_authority_file,
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 02f548c4..cbbf8ea6 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -112,6 +112,7 @@ struct GdmSessionWorkerPrivate
/* from Setup */
char *service;
char *x11_display_name;
+ char *x11_display_type;
char *x11_authority_file;
char *display_device;
char *hostname;
@@ -171,6 +172,7 @@ open_ck_session (GdmSessionWorker *worker)
int res;
DBusError error;
const char *display_name;
+ const char *display_type;
const char *display_device;
const char *display_hostname;
gboolean is_local;
@@ -180,6 +182,11 @@ open_ck_session (GdmSessionWorker *worker)
} else {
display_name = "";
}
+ if (worker->priv->x11_display_type != NULL) {
+ display_type = worker->priv->x11_display_type;
+ } else {
+ display_type = "";
+ }
if (worker->priv->hostname != NULL) {
display_hostname = worker->priv->hostname;
} else {
@@ -216,6 +223,7 @@ open_ck_session (GdmSessionWorker *worker)
dbus_error_init (&error);
res = ck_connector_open_session_with_parameters (worker->priv->ckc,
&error,
+ "display-type", &display_type,
"unix-user", &pwent->pw_uid,
"x11-display", &display_name,
"x11-display-device", &display_device,
@@ -2372,6 +2380,7 @@ on_setup (GdmSessionWorker *worker,
DBusError error;
const char *service;
const char *x11_display_name;
+ const char *x11_display_type;
const char *x11_authority_file;
const char *console;
const char *hostname;
@@ -2387,6 +2396,7 @@ on_setup (GdmSessionWorker *worker,
&error,
DBUS_TYPE_STRING, &service,
DBUS_TYPE_STRING, &x11_display_name,
+ DBUS_TYPE_STRING, &x11_display_type,
DBUS_TYPE_STRING, &console,
DBUS_TYPE_STRING, &hostname,
DBUS_TYPE_STRING, &x11_authority_file,
@@ -2394,6 +2404,7 @@ on_setup (GdmSessionWorker *worker,
if (res) {
worker->priv->service = g_strdup (service);
worker->priv->x11_display_name = g_strdup (x11_display_name);
+ worker->priv->x11_display_type = g_strdup (x11_display_type);
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
worker->priv->display_device = g_strdup (console);
worker->priv->hostname = g_strdup (hostname);
@@ -2414,6 +2425,7 @@ on_setup_for_user (GdmSessionWorker *worker,
DBusError error;
const char *service;
const char *x11_display_name;
+ const char *x11_display_type;
const char *x11_authority_file;
const char *console;
const char *hostname;
@@ -2430,6 +2442,7 @@ on_setup_for_user (GdmSessionWorker *worker,
&error,
DBUS_TYPE_STRING, &service,
DBUS_TYPE_STRING, &x11_display_name,
+ DBUS_TYPE_STRING, &x11_display_type,
DBUS_TYPE_STRING, &console,
DBUS_TYPE_STRING, &hostname,
DBUS_TYPE_STRING, &x11_authority_file,
@@ -2438,6 +2451,7 @@ on_setup_for_user (GdmSessionWorker *worker,
if (res) {
worker->priv->service = g_strdup (service);
worker->priv->x11_display_name = g_strdup (x11_display_name);
+ worker->priv->x11_display_type = g_strdup (x11_display_type);
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
worker->priv->display_device = g_strdup (console);
worker->priv->hostname = g_strdup (hostname);
@@ -2712,6 +2726,16 @@ gdm_session_worker_finalize (GObject *object)
gdm_session_worker_unwatch_child (worker);
+ if (worker->priv->x11_display_name != NULL) {
+ g_free (worker->priv->x11_display_name);
+ worker->priv->x11_display_name = NULL;
+ }
+
+ if (worker->priv->x11_display_type != NULL) {
+ g_free (worker->priv->x11_display_type);
+ worker->priv->x11_display_type = NULL;
+ }
+
if (worker->priv->username != NULL) {
g_free (worker->priv->username);
worker->priv->username = NULL;
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index b7de4bce..11f798f5 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -588,6 +588,7 @@ create_new_session (GdmSimpleSlave *slave)
gboolean display_is_local;
char *display_id;
char *display_name;
+ char *display_type;
char *display_hostname;
char *display_device;
char *display_x11_authority_file;
@@ -597,6 +598,7 @@ create_new_session (GdmSimpleSlave *slave)
g_object_get (slave,
"display-id", &display_id,
"display-name", &display_name,
+ "display-type", &display_type,
"display-hostname", &display_hostname,
"display-is-local", &display_is_local,
"display-x11-authority-file", &display_x11_authority_file,
@@ -609,6 +611,7 @@ create_new_session (GdmSimpleSlave *slave)
slave->priv->session = gdm_session_direct_new (display_id,
display_name,
+ display_type,
display_hostname,
display_device,
display_x11_authority_file,
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index 513fcf9a..47b1419a 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -79,6 +79,7 @@ struct GdmSlavePrivate
/* cached display values */
char *display_id;
char *display_name;
+ char *display_type;
int display_number;
char *display_hostname;
gboolean display_is_local;
@@ -100,6 +101,7 @@ enum {
PROP_0,
PROP_DISPLAY_ID,
PROP_DISPLAY_NAME,
+ PROP_DISPLAY_TYPE,
PROP_DISPLAY_NUMBER,
PROP_DISPLAY_HOSTNAME,
PROP_DISPLAY_IS_LOCAL,
@@ -588,6 +590,24 @@ gdm_slave_real_start (GdmSlave *slave)
error = NULL;
res = dbus_g_proxy_call (slave->priv->display_proxy,
+ "GetX11DisplayType",
+ &error,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &slave->priv->display_type,
+ G_TYPE_INVALID);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get value: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get value");
+ }
+
+ return FALSE;
+ }
+
+ error = NULL;
+ res = dbus_g_proxy_call (slave->priv->display_proxy,
"GetX11DisplayNumber",
&error,
G_TYPE_INVALID,
@@ -1300,6 +1320,15 @@ _gdm_slave_set_display_name (GdmSlave *slave,
slave->priv->display_name = g_strdup (name);
}
+
+static void
+_gdm_slave_set_display_type (GdmSlave *slave,
+ const char *type)
+{
+ g_free (slave->priv->display_type);
+ slave->priv->display_type = g_strdup (type);
+}
+
static void
_gdm_slave_set_display_number (GdmSlave *slave,
int number)
@@ -1370,6 +1399,9 @@ gdm_slave_set_property (GObject *object,
case PROP_DISPLAY_NAME:
_gdm_slave_set_display_name (self, g_value_get_string (value));
break;
+ case PROP_DISPLAY_TYPE:
+ _gdm_slave_set_display_type (self, g_value_get_string (value));
+ break;
case PROP_DISPLAY_NUMBER:
_gdm_slave_set_display_number (self, g_value_get_int (value));
break;
@@ -1414,6 +1446,9 @@ gdm_slave_get_property (GObject *object,
case PROP_DISPLAY_NAME:
g_value_set_string (value, self->priv->display_name);
break;
+ case PROP_DISPLAY_TYPE:
+ g_value_set_string (value, self->priv->display_type);
+ break;
case PROP_DISPLAY_NUMBER:
g_value_set_int (value, self->priv->display_number);
break;
@@ -1523,6 +1558,13 @@ gdm_slave_class_init (GdmSlaveClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
+ PROP_DISPLAY_TYPE,
+ g_param_spec_string ("display-type",
+ "display type",
+ "display type",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
PROP_DISPLAY_NUMBER,
g_param_spec_int ("display-number",
"display number",
@@ -1614,6 +1656,7 @@ gdm_slave_finalize (GObject *object)
g_free (slave->priv->id);
g_free (slave->priv->display_id);
g_free (slave->priv->display_name);
+ g_free (slave->priv->display_type);
g_free (slave->priv->display_hostname);
g_free (slave->priv->display_seat_id);
g_free (slave->priv->display_x11_authority_file);
diff --git a/daemon/test-session.c b/daemon/test-session.c
index c6a158c9..f59ccf36 100644
--- a/daemon/test-session.c
+++ b/daemon/test-session.c
@@ -244,6 +244,7 @@ main (int argc,
g_debug ("creating instance of GdmSessionDirect object...");
session = gdm_session_direct_new ("/org/gnome/DisplayManager/Display1",
":0",
+ "",
g_get_host_name (),
ttyname (STDIN_FILENO),
getenv("XAUTHORITY"),