summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesús González <jgonzalez@gdr-sistemas.com>2015-02-13 11:47:09 +0100
committerJesús González <jgonzalez@gdr-sistemas.com>2015-02-13 11:47:09 +0100
commit27a369121fa4fc2146dbc5653139b06ff6301ab2 (patch)
treec054e9bb409215f1b2f7dfdbc8a3a8cceda74dec /src
parent850aad05441d414e9bdc9cd80cd8e8bca8bede2b (diff)
parent7b6a695d2b5eb47c41d468cbceca256833f0a790 (diff)
downloadlightdm-27a369121fa4fc2146dbc5653139b06ff6301ab2.tar.gz
Merged changes from parent branch.
Fixed "lock-seat-after-vt-switch" test to expect X server reuse by the new greeter instead of X server reinitiation.
Diffstat (limited to 'src')
-rw-r--r--src/lightdm.c25
-rw-r--r--src/login1.c1
-rw-r--r--src/seat.c48
-rw-r--r--src/seat.h6
-rw-r--r--src/session.c7
-rw-r--r--src/session.h2
6 files changed, 89 insertions, 0 deletions
diff --git a/src/lightdm.c b/src/lightdm.c
index 48a44ab5..8c52d1e1 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -1081,6 +1081,31 @@ static void
login1_active_session_changed_cb (Login1Seat *login1_seat, const gchar *login1_session_id)
{
g_debug ("Seat %s changes active session to %s", login1_seat_get_id (login1_seat), login1_session_id);
+
+ Seat *seat;
+ seat = display_manager_get_seat (display_manager, login1_seat_get_id (login1_seat));
+
+ if (seat)
+ {
+ Session *active_session;
+ active_session = seat_get_expected_active_session (seat);
+
+ if (g_strcmp0 (login1_session_id, session_get_login1_session_id (active_session)) == 0)
+ {
+ // Session is already active
+ g_debug ("Session %s is already active", login1_session_id);
+ return;
+ }
+
+ active_session = seat_find_session_by_login1_id (seat, login1_session_id);
+ if (active_session != NULL)
+ {
+ g_debug ("Activating session %s", login1_session_id);
+ seat_set_externally_activated_session (seat, active_session);
+ return;
+
+ }
+ }
}
static gboolean
diff --git a/src/login1.c b/src/login1.c
index 8e8340de..af8e8a8e 100644
--- a/src/login1.c
+++ b/src/login1.c
@@ -140,6 +140,7 @@ seat_properties_changed_cb (GDBusConnection *connection,
{
g_variant_get (result, "(v)", &value);
update_property (seat, name, value);
+ g_variant_unref (value);
g_variant_unref (result);
}
}
diff --git a/src/seat.c b/src/seat.c
index d2de0c64..cc2ddbd4 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -272,6 +272,54 @@ seat_get_next_session (Seat *seat)
return seat->priv->next_session;
}
+/**
+ * Obtains the active session which lightdm expects to be active.
+ *
+ * This function is different from seat_get_active_session() in that the
+ * later (in the case of xlocal seats) dynamically finds the session that is
+ * really active (based on the active VT), whereas this function returns the
+ * session that lightdm activated last by itself, which may not be the actual
+ * active session (i.e. VT changes).
+ */
+Session *
+seat_get_expected_active_session (Seat *seat)
+{
+ g_return_val_if_fail (seat != NULL, NULL);
+ return seat->priv->active_session;
+}
+
+/**
+ * Sets the active session which lightdm expects to be active.
+ *
+ * This function is different from seat_set_active_session() in that the
+ * later performs an actual session activation, whereas this function just
+ * updates the active session after the session has been activated by some
+ * means external to lightdm (i.e. VT changes).
+ */
+void
+seat_set_externally_activated_session (Seat *seat, Session *session)
+{
+ g_return_if_fail (seat != NULL);
+ if (seat->priv->active_session)
+ g_object_unref (seat->priv->active_session);
+ seat->priv->active_session = g_object_ref (session);
+}
+
+Session *
+seat_find_session_by_login1_id (Seat *seat, const gchar *login1_session_id)
+{
+ GList *session_link;
+
+ for (session_link = seat->priv->sessions; session_link; session_link = session_link->next)
+ {
+ Session *session = session_link->data;
+ if (g_strcmp0 (login1_session_id, session_get_login1_session_id (session)) == 0)
+ return session;
+ }
+
+ return NULL;
+}
+
gboolean
seat_get_can_switch (Seat *seat)
{
diff --git a/src/seat.h b/src/seat.h
index f8781ef5..e8d2bc6f 100644
--- a/src/seat.h
+++ b/src/seat.h
@@ -93,6 +93,12 @@ Session *seat_get_active_session (Seat *seat);
Session *seat_get_next_session (Seat *seat);
+void seat_set_externally_activated_session (Seat *seat, Session *session);
+
+Session *seat_get_expected_active_session (Seat *seat);
+
+Session *seat_find_session_by_login1_id (Seat *seat, const gchar *login1_session_id);
+
gboolean seat_get_can_switch (Seat *seat);
gboolean seat_get_allow_guest (Seat *seat);
diff --git a/src/session.c b/src/session.c
index 66d138d8..26d0ce97 100644
--- a/src/session.c
+++ b/src/session.c
@@ -653,6 +653,13 @@ session_get_username (Session *session)
}
const gchar *
+session_get_login1_session_id (Session *session)
+{
+ g_return_val_if_fail (session != NULL, NULL);
+ return session->priv->login1_session_id;
+}
+
+const gchar *
session_get_console_kit_cookie (Session *session)
{
g_return_val_if_fail (session != NULL, NULL);
diff --git a/src/session.h b/src/session.h
index 513fd12d..c62303e6 100644
--- a/src/session.h
+++ b/src/session.h
@@ -115,6 +115,8 @@ gboolean session_get_is_started (Session *session);
const gchar *session_get_username (Session *session);
+const gchar *session_get_login1_session_id (Session *session);
+
const gchar *session_get_console_kit_cookie (Session *session);
void session_respond (Session *session, struct pam_response *response);