[gdm] daemon: clean up greeter when unused
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] daemon: clean up greeter when unused
- Date: Wed, 15 Jun 2011 13:59:45 +0000 (UTC)
commit 15a3f0c699fe1e8583a33d744edfbb0801ab92bf
Author: Ray Strode <rstrode redhat com>
Date: Thu May 12 16:36:39 2011 -0400
daemon: clean up greeter when unused
When user switching GDM needs to show a transient greeter for
the user to pick a name from the list and jump to that session.
After the user has been jumped to the selected session we don't
really have a use for the greeter session. Historically, we've
kept it around anyway, though, because X by default jumps back
to the VT it started on when it exits, and we don't want the
user to get thrown to an empty VT after they log out.
This commit changes X to get started with the "-novtswitch"
option, so that it doesn't do the undesirable switch-on-exit
thing.
This allows us to clean up the useless greeter following user
switches.
Based on work by Josselin Mouette <joss debian org>
https://bugzilla.gnome.org/show_bug.cgi?id=618047
configure.ac | 13 +++++
daemon/gdm-server.c | 8 +++-
daemon/gdm-simple-slave.c | 15 ++++--
gui/libgdmgreeter/gdm-greeter-client.c | 94 ++++++++++++++++----------------
gui/libgdmgreeter/gdm-greeter-client.h | 6 +--
5 files changed, 78 insertions(+), 58 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ecb7e1e..d54f0f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -276,6 +276,11 @@ AC_ARG_WITH(at-spi-registryd-directory,
AT_SPI_REGISTRYD_DIR=$with_at_spi_registryd_directory
AC_SUBST(AT_SPI_REGISTRYD_DIR)
+AC_ARG_WITH(vt-switch-workaround,
+ AS_HELP_STRING([--with-vt-switch-workaround],
+ [Try to workaround missing -novtswitch option for X @<:@default=nor@:>@])],,
+ [with_vt_switch_workaround="no"])
+
# Allow configuration of default PATH
#
withval=""
@@ -923,6 +928,14 @@ AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes)
AC_SUBST(WITH_CONSOLE_KIT)
dnl ---------------------------------------------------------------------------
+dnl - Check for vt switch support
+dnl ---------------------------------------------------------------------------
+
+if test "x$with_vt_switch_workaround" != "xno" ; then
+ AC_DEFINE(WITH_VT_SWITCH_WORKAROUND, 1, [Define to enable workaround for missing -novtswitch feature])
+fi
+
+dnl ---------------------------------------------------------------------------
dnl - Check for D-Bus
dnl ---------------------------------------------------------------------------
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index 7135ffa..8dacdb5 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -52,6 +52,12 @@
extern char **environ;
+#ifdef WITH_VT_SWITCH_WORKAROUND
+#define X_SERVER_COMMAND_LINE X_SERVER " -br -verbose -logverbose 7"
+#else
+#define X_SERVER_COMMAND_LINE X_SERVER " -br -verbose -logverbose 7 -novtswitch"
+#endif
+
#define GDM_SERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SERVER, GdmServerPrivate))
/* These are the servstat values, also used as server
@@ -941,7 +947,7 @@ gdm_server_init (GdmServer *server)
server->priv = GDM_SERVER_GET_PRIVATE (server);
server->priv->pid = -1;
- server->priv->command = g_strdup (X_SERVER " -br -verbose -logverbose 7");
+ server->priv->command = g_strdup (X_SERVER_COMMAND_LINE);
server->priv->log_dir = g_strdup (LOGDIR);
add_ready_handler (server);
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 7b9d7d8..55c0f19 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -463,12 +463,17 @@ start_session_timeout (GdmSimpleSlave *slave)
if (migrated) {
destroy_session (slave);
- /* We don't stop the slave here because
- when Xorg exits it switches to the VT it was
- started from. That interferes with fast
- user switching. */
+#ifdef WITH_VT_SWITCH_WORKAROUND
+ /* If the X server doesn't support -novtswitch, then when the
+ * user logs out from their session later, they're going to get thrown
+ * back to the VT the greeter is currently running on. We keep the
+ * greeter alive here, so when that happens the user doesn't see
+ * a blank VT or some confusing thing.
+ */
queue_greeter_reset (slave);
-
+#else
+ gdm_slave_stopped (GDM_SLAVE (slave));
+#endif
goto out;
}
diff --git a/gui/libgdmgreeter/gdm-greeter-client.c b/gui/libgdmgreeter/gdm-greeter-client.c
index cb1ce00..c712d2b 100644
--- a/gui/libgdmgreeter/gdm-greeter-client.c
+++ b/gui/libgdmgreeter/gdm-greeter-client.c
@@ -54,6 +54,7 @@ struct GdmGreeterClientPrivate
enum {
PROP_0,
+ PROP_DISPLAY_IS_LOCAL
};
enum {
@@ -95,6 +96,13 @@ gdm_greeter_client_error_quark (void)
return error_quark;
}
+/**
+ * gdm_greeter_get_display_is_local:
+ *
+ * @client: a #GdmGreeterClient
+ *
+ * Returns: %TRUE if display is local display
+ */
gboolean
gdm_greeter_client_get_display_is_local (GdmGreeterClient *client)
{
@@ -643,7 +651,8 @@ send_get_display_id (GdmGreeterClient *client,
return ret;
}
-char *
+
+static char *
gdm_greeter_client_call_get_display_id (GdmGreeterClient *client)
{
char *display_id;
@@ -779,9 +788,20 @@ client_dbus_filter_function (DBusConnection *connection,
return DBUS_HANDLER_RESULT_HANDLED;
}
+/**
+ * gdm_greeter_client_connect:
+ *
+ * @client: a #GdmGreeterClient
+ *
+ * Initiates a connection to GDM daemon "slave" process.
+ *
+ * This function should be called before doing other calls.
+ *
+ * Returns: %TRUE if connected, or %FALSE if unavailable
+ */
gboolean
-gdm_greeter_client_start (GdmGreeterClient *client,
- GError **error)
+gdm_greeter_client_connect (GdmGreeterClient *client,
+ GError **error)
{
gboolean ret;
DBusError local_error;
@@ -833,61 +853,35 @@ gdm_greeter_client_start (GdmGreeterClient *client,
return ret;
}
-void
-gdm_greeter_client_stop (GdmGreeterClient *client)
-{
- g_return_if_fail (GDM_IS_GREETER_CLIENT (client));
-
-}
-
static void
-gdm_greeter_client_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+gdm_greeter_client_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
-gdm_greeter_client_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gdm_greeter_client_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
+ GdmGreeterClient *self;
+
+ self = GDM_GREETER_CLIENT (object);
+
switch (prop_id) {
+ case PROP_DISPLAY_IS_LOCAL:
+ g_value_set_boolean (value, self->priv->display_is_local);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
-static GObject *
-gdm_greeter_client_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmGreeterClient *greeter_client;
-
- greeter_client = GDM_GREETER_CLIENT (G_OBJECT_CLASS (gdm_greeter_client_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (greeter_client);
-}
-
-static void
-gdm_greeter_client_dispose (GObject *object)
-{
- g_debug ("GdmGreeterClient: Disposing greeter_client");
-
- G_OBJECT_CLASS (gdm_greeter_client_parent_class)->dispose (object);
-}
-
static void
gdm_greeter_client_class_init (GdmGreeterClientClass *klass)
{
@@ -895,8 +889,6 @@ gdm_greeter_client_class_init (GdmGreeterClientClass *klass)
object_class->get_property = gdm_greeter_client_get_property;
object_class->set_property = gdm_greeter_client_set_property;
- object_class->constructor = gdm_greeter_client_constructor;
- object_class->dispose = gdm_greeter_client_dispose;
object_class->finalize = gdm_greeter_client_finalize;
g_type_class_add_private (klass, sizeof (GdmGreeterClientPrivate));
@@ -1032,6 +1024,14 @@ gdm_greeter_client_class_init (GdmGreeterClientClass *klass)
g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_STRING);
+
+ g_object_class_install_property (object_class,
+ PROP_DISPLAY_IS_LOCAL,
+ g_param_spec_boolean ("display-is-local",
+ "display is local",
+ "display is local",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
static void
diff --git a/gui/libgdmgreeter/gdm-greeter-client.h b/gui/libgdmgreeter/gdm-greeter-client.h
index d0eaf58..9b2be8d 100644
--- a/gui/libgdmgreeter/gdm-greeter-client.h
+++ b/gui/libgdmgreeter/gdm-greeter-client.h
@@ -87,14 +87,10 @@ GQuark gdm_greeter_client_error_quark (void);
GdmGreeterClient * gdm_greeter_client_new (void);
-gboolean gdm_greeter_client_start (GdmGreeterClient *client,
+gboolean gdm_greeter_client_connect (GdmGreeterClient *client,
GError **error);
-void gdm_greeter_client_stop (GdmGreeterClient *client);
-
gboolean gdm_greeter_client_get_display_is_local (GdmGreeterClient *client);
-char * gdm_greeter_client_call_get_display_id (GdmGreeterClient *client);
-
void gdm_greeter_client_call_start_conversation (GdmGreeterClient *client,
const char *service_name);
void gdm_greeter_client_call_begin_auto_login (GdmGreeterClient *client,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]