summaryrefslogtreecommitdiff
path: root/daemon/gdm-display.c
diff options
context:
space:
mode:
authorIain Lane <iainl@gnome.org>2019-05-07 16:00:14 +0100
committerIain Lane <iain@orangesquash.org.uk>2019-05-29 15:53:35 +0000
commit1c061b84ffc3e874da825982d18d970556ff74bb (patch)
tree64f56c787fdfa6e2a205ea726d589fad546da300 /daemon/gdm-display.c
parent9496f639715b1b8e31b2b0a5bd37a8b6761249b3 (diff)
downloadgdm-1c061b84ffc3e874da825982d18d970556ff74bb.tar.gz
Allow sessions to register with GDM
Recording when sessions start, for Wayland → Xorg fallback or transitioning to the user session, is currently done with timeouts. This isn't ideal, because on some very slow machines the timeout can be hit before the session has had a chance to fail: if gnome-session takes more than 3 seconds to fail then the session will be considered to have exited rather than failed, and so we don't do Xorg fallback. We can do this more reliably if we allow sessions to optionally register themselves with GDM. Then we will know when they've started, so can shut down the greeter or fall back to Xorg as appropriate. The mechanism is that they specify X-GDM-SessionRegisters=true in their file, and then call RegsterSession on the DisplayManager interface on the bus (added in the previous commit) to say that they've started up. If X-GDM-SessionRegisters is missing or false, GDM will call the same method for them after 10 seconds. Closes: #483
Diffstat (limited to 'daemon/gdm-display.c')
-rw-r--r--daemon/gdm-display.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 843a3641..8c106222 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -66,7 +66,6 @@ typedef struct _GdmDisplayPrivate
char *x11_display_name;
int status;
time_t creation_time;
- GTimer *server_timer;
char *x11_cookie;
gsize x11_cookie_size;
@@ -600,8 +599,6 @@ gdm_display_manage (GdmDisplay *self)
}
}
- g_timer_start (priv->server_timer);
-
if (g_strcmp0 (priv->session_class, "greeter") == 0) {
if (GDM_DISPLAY_GET_CLASS (self)->manage != NULL) {
GDM_DISPLAY_GET_CLASS (self)->manage (self);
@@ -673,7 +670,6 @@ gboolean
gdm_display_unmanage (GdmDisplay *self)
{
GdmDisplayPrivate *priv;
- gdouble elapsed;
g_return_val_if_fail (GDM_IS_DISPLAY (self), FALSE);
@@ -683,8 +679,6 @@ gdm_display_unmanage (GdmDisplay *self)
gdm_display_disconnect (self);
- g_timer_stop (priv->server_timer);
-
if (priv->user_access_file != NULL) {
gdm_display_access_file_close (priv->user_access_file);
g_object_unref (priv->user_access_file);
@@ -697,9 +691,8 @@ gdm_display_unmanage (GdmDisplay *self)
priv->access_file = NULL;
}
- elapsed = g_timer_elapsed (priv->server_timer, NULL);
- if (elapsed < 3) {
- g_warning ("GdmDisplay: display lasted %lf seconds", elapsed);
+ if (!priv->session_registered) {
+ g_warning ("GdmDisplay: Session never registered, failing");
_gdm_display_set_status (self, GDM_DISPLAY_FAILED);
} else {
_gdm_display_set_status (self, GDM_DISPLAY_UNMANAGED);
@@ -1408,7 +1401,6 @@ gdm_display_init (GdmDisplay *self)
priv = gdm_display_get_instance_private (self);
priv->creation_time = time (NULL);
- priv->server_timer = g_timer_new ();
}
static void
@@ -1446,10 +1438,6 @@ gdm_display_finalize (GObject *object)
g_object_unref (priv->user_access_file);
}
- if (priv->server_timer != NULL) {
- g_timer_destroy (priv->server_timer);
- }
-
G_OBJECT_CLASS (gdm_display_parent_class)->finalize (object);
}