Commit 70861874 authored by Ray Strode's avatar Ray Strode

gdm-wayland-session,gdm-x-session: register after delay

Right now gdm-x-session registers with GDM as soon as the
X server is started, and gdm-wayland-session registers as
soon as the session is started.

Ideally registration wouldn't happen until the session
says things started successfully.

This commit inches us toward that ideal but adding a little
timeout before proceeding with registration.

A future commit will add a new xsession file key to allow
us to know whether or not the session manager of the session
supports doing registration.
parent 9f7fc717
......@@ -454,6 +454,21 @@ on_sigterm (State *state)
return G_SOURCE_CONTINUE;
}
static gboolean
on_registration_delay_complete (State *state)
{
gboolean ret;
ret = register_display (state, state->cancellable);
if (!ret) {
g_printerr ("Unable to register display with display manager\n");
g_main_loop_quit (state->main_loop);
}
return G_SOURCE_REMOVE;
}
int
main (int argc,
char **argv)
......@@ -528,13 +543,7 @@ main (int argc,
goto out;
}
ret = register_display (state, state->cancellable);
if (!ret) {
g_printerr ("Unable to register display with display manager\n");
exit_status = EX_SOFTWARE;
goto out;
}
g_timeout_add_seconds (2, (GSourceFunc) on_registration_delay_complete, state);
g_main_loop_run (state->main_loop);
......
......@@ -810,6 +810,21 @@ on_sigterm (State *state)
return G_SOURCE_CONTINUE;
}
static gboolean
on_registration_delay_complete (State *state)
{
gboolean ret;
ret = register_display (state, state->cancellable);
if (!ret) {
g_printerr ("Unable to register display with display manager\n");
g_main_loop_quit (state->main_loop);
}
return G_SOURCE_REMOVE;
}
int
main (int argc,
char **argv)
......@@ -896,14 +911,6 @@ main (int argc,
goto out;
}
ret = register_display (state, state->cancellable);
if (!ret) {
g_printerr ("Unable to register display with display manager\n");
exit_status = EX_SOFTWARE;
goto out;
}
ret = spawn_session (state, run_script, state->cancellable);
if (!ret) {
......@@ -912,6 +919,8 @@ main (int argc,
goto out;
}
g_timeout_add_seconds (2, (GSourceFunc) on_registration_delay_complete, state);
g_main_loop_run (state->main_loop);
/* Only use exit status of session if we're here because it exit */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment