void
plymouth_deactivate (void)
{
+ g_debug ("Deactivating Plymouth");
is_active = FALSE;
plymouth_run_command ("deactivate", NULL);
}
void
plymouth_quit (gboolean retain_splash)
{
+ if (retain_splash)
+ g_debug ("Quitting Plymouth; retaining splash");
+ else
+ g_debug ("Quitting Plymouth");
+
have_pinged = TRUE;
is_running = FALSE;
if (retain_splash)
/* VT we are running on */
gint vt;
- /* TRUE if waiting for X server to start before stopping Plymouth */
- gboolean stopping_plymouth;
-
/* File to log to */
gchar *log_file;
g_debug ("Stopping Unity seat, compositor terminated");
- if (seat->priv->stopping_plymouth)
- {
- g_debug ("Stopping Plymouth, compositor failed to start");
- plymouth_quit (FALSE);
- seat->priv->stopping_plymouth = FALSE;
- }
-
seat_stop (SEAT (seat));
}
close (fd);
}
}
-
- if (seat->priv->stopping_plymouth)
- {
- seat->priv->stopping_plymouth = FALSE;
- plymouth_quit (TRUE);
- }
}
static void
gint active_vt = vt_get_active ();
if (active_vt >= vt_get_min ())
{
- g_debug ("Compositor will replace Plymouth");
- SEAT_UNITY (seat)->priv->stopping_plymouth = TRUE;
SEAT_UNITY (seat)->priv->vt = active_vt;
- plymouth_deactivate ();
+ plymouth_quit (TRUE);
}
else
g_debug ("Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
}
+ if (plymouth_get_is_active ())
+ plymouth_quit (FALSE);
if (SEAT_UNITY (seat)->priv->vt < 0)
SEAT_UNITY (seat)->priv->vt = vt_get_unused ();
if (SEAT_UNITY (seat)->priv->vt < 0)
return TRUE;
}
+static void
+x_server_stopped_cb (XServerLocal *x_server, Seat *seat)
+{
+ gint vt;
+
+ /* Can re-use the VT */
+ vt = display_server_get_vt (DISPLAY_SERVER (x_server));
+ if (vt > 0)
+ vt_unref (vt);
+
+ g_signal_handlers_disconnect_matched (x_server, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, x_server_stopped_cb, NULL);
+}
+
static DisplayServer *
seat_unity_create_display_server (Seat *seat)
{
if (command)
x_server_local_set_command (x_server, command);
+ if (SEAT_UNITY (seat)->priv->use_vt_switching)
+ {
+ gint vt;
+
+ vt = vt_get_unused ();
+ vt_ref (vt);
+ x_server_local_set_vt (x_server, vt);
+ g_signal_connect (x_server, "stopped", G_CALLBACK (x_server_stopped_cb), seat);
+ }
+
layout = seat_get_string_property (seat, "xserver-layout");
if (layout)
x_server_local_set_layout (x_server, layout);
#include "seat-xlocal.h"
#include "configuration.h"
#include "x-server-local.h"
+#include "plymouth.h"
#include "vt.h"
G_DEFINE_TYPE (SeatXLocal, seat_xlocal, SEAT_TYPE);
SEAT_CLASS (seat_xlocal_parent_class)->setup (seat);
}
+static gboolean
+seat_xlocal_start (Seat *seat)
+{
+
+ return SEAT_CLASS (seat_xlocal_parent_class)->start (seat);
+}
+
+static void
+x_server_ready_cb (XServerLocal *x_server, Seat *seat)
+{
+ /* Quit Plymouth */
+ plymouth_quit (TRUE);
+}
+
+static void
+x_server_transition_plymouth_cb (XServerLocal *x_server, Seat *seat)
+{
+ /* Quit Plymouth if we didn't do the transition */
+ if (plymouth_get_is_running ())
+ plymouth_quit (FALSE);
+
+ g_signal_handlers_disconnect_matched (x_server, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, x_server_transition_plymouth_cb, NULL);
+}
+
+static void
+x_server_stopped_cb (XServerLocal *x_server, Seat *seat)
+{
+ gint vt;
+
+ /* Can re-use the VT */
+ vt = display_server_get_vt (DISPLAY_SERVER (x_server));
+ if (vt > 0)
+ vt_unref (vt);
+
+ g_signal_handlers_disconnect_matched (x_server, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, x_server_stopped_cb, NULL);
+}
+
static DisplayServer *
seat_xlocal_create_display_server (Seat *seat)
{
XServerLocal *x_server;
const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
gboolean allow_tcp;
- gint port = 0;
+ gint vt = -1, port = 0;
- g_debug ("Starting local X display");
+ if (vt > 0)
+ g_debug ("Starting local X display on VT %d", vt);
+ else
+ g_debug ("Starting local X display");
x_server = x_server_local_new ();
if (command)
x_server_local_set_command (x_server, command);
+ /* If Plymouth is running, stop it */
+ if (plymouth_get_is_active () && plymouth_has_active_vt ())
+ {
+ gint active_vt = vt_get_active ();
+ if (active_vt >= vt_get_min ())
+ {
+ vt = active_vt;
+ g_signal_connect (x_server, "ready", G_CALLBACK (x_server_ready_cb), seat);
+ g_signal_connect (x_server, "stopped", G_CALLBACK (x_server_transition_plymouth_cb), seat);
+ plymouth_deactivate ();
+ }
+ else
+ g_debug ("Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
+ }
+ if (plymouth_get_is_active ())
+ plymouth_quit (FALSE);
+ if (vt < 0)
+ vt = vt_get_unused ();
+ if (vt >= 0)
+ {
+ vt_ref (vt);
+ x_server_local_set_vt (x_server, vt);
+ g_signal_connect (x_server, "stopped", G_CALLBACK (x_server_stopped_cb), seat);
+ }
+
layout = seat_get_string_property (seat, "xserver-layout");
if (layout)
x_server_local_set_layout (x_server, layout);
SeatClass *seat_class = SEAT_CLASS (klass);
seat_class->setup = seat_xlocal_setup;
+ seat_class->start = seat_xlocal_start;
seat_class->create_display_server = seat_xlocal_create_display_server;
seat_class->create_greeter_session = seat_xlocal_create_greeter_session;
seat_class->create_session = seat_xlocal_create_session;
#include "configuration.h"
#include "process.h"
#include "vt.h"
-#include "plymouth.h"
struct XServerLocalPrivate
{
/* VT to run on */
gint vt;
-
- /* TRUE if holding a reference to the VT */
- gboolean have_vt_ref;
-
- /* TRUE if replacing Plymouth */
- gboolean replacing_plymouth;
+
+ /* Background to set */
+ gchar *background;
};
G_DEFINE_TYPE (XServerLocal, x_server_local, X_SERVER_TYPE);
display_server_set_name (DISPLAY_SERVER (self), name);
g_free (name);
- /* Replace Plymouth if it is running */
- if (plymouth_get_is_active () && plymouth_has_active_vt ())
- {
- gint active_vt = vt_get_active ();
- if (active_vt >= vt_get_min ())
- {
- g_debug ("X server %s will replace Plymouth", x_server_get_address (X_SERVER (self)));
- self->priv->replacing_plymouth = TRUE;
- self->priv->vt = active_vt;
- plymouth_deactivate ();
- }
- else
- g_debug ("Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
- }
- if (self->priv->vt < 0)
- self->priv->vt = vt_get_unused ();
- if (self->priv->vt >= 0)
- {
- vt_ref (self->priv->vt);
- self->priv->have_vt_ref = TRUE;
- }
-
return self;
}
server->priv->command = g_strdup (command);
}
+void
+x_server_local_set_vt (XServerLocal *server, gint vt)
+{
+ g_return_if_fail (server != NULL);
+ server->priv->vt = vt;
+}
+
void
x_server_local_set_config (XServerLocal *server, const gchar *path)
{
x_server_set_authority (X_SERVER (server), NULL);
}
+void
+x_server_local_set_background (XServerLocal *server, const gchar *background)
+{
+ g_return_if_fail (server != NULL);
+ g_free (server->priv->background);
+ server->priv->background = g_strdup (background);
+}
+
void
x_server_local_set_mir_id (XServerLocal *server, const gchar *id)
{
g_return_if_fail (server != NULL);
g_free (server->priv->mir_id);
server->priv->mir_id = g_strdup (id);
-
- if (server->priv->have_vt_ref)
- {
- vt_unref (server->priv->vt);
- server->priv->have_vt_ref = FALSE;
- }
- server->priv->vt = -1;
}
const gchar *x_server_local_get_mir_id (XServerLocal *server)
server->priv->got_signal = TRUE;
g_debug ("Got signal from X server :%d", x_server_get_display_number (X_SERVER (server)));
- if (server->priv->replacing_plymouth)
- {
- g_debug ("Stopping Plymouth, X server is ready");
- server->priv->replacing_plymouth = FALSE;
- plymouth_quit (TRUE);
- }
-
// FIXME: Check return value
DISPLAY_SERVER_CLASS (x_server_local_parent_class)->start (DISPLAY_SERVER (server));
}
server->priv->authority_file = NULL;
}
- if (server->priv->have_vt_ref)
- {
- vt_unref (server->priv->vt);
- server->priv->have_vt_ref = FALSE;
- }
-
- if (server->priv->replacing_plymouth && plymouth_get_is_running ())
- {
- g_debug ("Stopping Plymouth, X server failed to start");
- server->priv->replacing_plymouth = FALSE;
- plymouth_quit (FALSE);
- }
-
DISPLAY_SERVER_CLASS (x_server_local_parent_class)->stop (DISPLAY_SERVER (server));
}
if (server->priv->vt >= 0)
g_string_append_printf (command, " vt%d -novtswitch", server->priv->vt);
- if (server->priv->replacing_plymouth)
- g_string_append (command, " -background none");
+ if (server->priv->background)
+ g_string_append_printf (command, " -background %s", server->priv->background);
+
process_set_command (server->priv->x_server_process, command->str);
g_string_free (command, TRUE);
g_free (self->priv->mir_id);
g_free (self->priv->mir_socket);
g_free (self->priv->authority_file);
- if (self->priv->have_vt_ref)
- vt_unref (self->priv->vt);
+ g_free (self->priv->background);
G_OBJECT_CLASS (x_server_local_parent_class)->finalize (object);
}
void x_server_local_set_command (XServerLocal *server, const gchar *command);
+void x_server_local_set_vt (XServerLocal *server, gint vt);
+
void x_server_local_set_config (XServerLocal *server, const gchar *path);
void x_server_local_set_layout (XServerLocal *server, const gchar *layout);
void x_server_local_set_xdmcp_key (XServerLocal *server, const gchar *key);
+void x_server_local_set_background (XServerLocal *server, const gchar *background);
+
void x_server_local_set_mir_id (XServerLocal *server, const gchar *id);
const gchar *x_server_local_get_mir_id (XServerLocal *server);
# Check if Plymouth is running
#?PLYMOUTH PING ACTIVE=TRUE
#?PLYMOUTH HAS-ACTIVE-VT=TRUE
-#?PLYMOUTH DEACTIVATE
+#?PLYMOUTH QUIT RETAIN-SPLASH=TRUE
# System compositor starts
#?UNITY-SYSTEM-COMPOSITOR START VT=7
#?*UNITY-SYSTEM-COMPOSITOR READY
-# Plymouth quits but keeps image in framebuffer
-#?PLYMOUTH QUIT RETAIN-SPLASH=TRUE
-
# X server starts
#?XSERVER-0 START MIR-ID=0