return value ? atoi (value) : 0;
}
+const gchar *
+seat_get_name (Seat *seat)
+{
+ const gchar *name;
+
+ name = seat_get_string_property (seat, "xdg-seat");
+ if (name)
+ return name;
+
+ return "seat0";
+}
+
void
seat_set_can_switch (Seat *seat, gboolean can_switch)
{
session_lock (seat->priv->active_session);
g_object_unref (seat->priv->active_session);
}
+
+ session_activate (session);
seat->priv->active_session = g_object_ref (session);
}
Process *script;
gboolean result = FALSE;
- script = process_new ();
+ script = process_new (NULL, NULL);
process_set_command (script, script_name);
g_object_unref (seat->priv->session_to_activate);
seat->priv->session_to_activate = NULL;
}
+ else if (session != seat->priv->active_session)
+ {
+ /* Multiple sessions can theoretically be on the same VT (especially
+ if using Mir). If a new session appears on an existing active VT,
+ logind will mark it as active, while ConsoleKit will re-mark the
+ oldest session as active. In either case, that may not be the
+ session that we want to be active. So let's be explicit and
+ re-activate the correct session whenever a new session starts.
+ There's no harm to do this in seats that enforce separate VTs. */
+ session_activate (seat->priv->active_session);
+ }
}
static Session *
}
static Session *
-create_guest_session (Seat *seat)
+create_guest_session (Seat *seat, const gchar *session_name)
{
- const gchar *session_name, *guest_wrapper;
+ const gchar *guest_wrapper;
gchar *sessions_dir, **argv;
SessionConfig *session_config;
Session *session;
- session_name = seat_get_string_property (seat, "user-session");
+ if (!session_name)
+ session_name = seat_get_string_property (seat, "guest-session");
+ if (!session_name)
+ session_name = seat_get_string_property (seat, "user-session");
sessions_dir = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
session_config = find_session_config (seat, sessions_dir, session_name);
g_free (sessions_dir);
/* Get the session to use */
if (greeter_get_guest_authenticated (greeter))
{
- session = create_guest_session (seat);
+ session = create_guest_session (seat, session_name);
if (!session)
return FALSE;
session_set_pam_service (session, AUTOLOGIN_SERVICE);
return TRUE;
}
- session = create_guest_session (seat);
+ session = create_guest_session (seat, session_name);
if (!session)
return FALSE;
if (autologin_timeout == 0 || autologin_in_background)
{
if (autologin_guest)
- session = create_guest_session (seat);
+ session = create_guest_session (seat, NULL);
else if (autologin_username != NULL)
session = create_user_session (seat, autologin_username, TRUE);