chiark / gitweb /
logind: if a user is sitting in front of the computer and can shutdown the machine...
[elogind.git] / src / login / logind-seat.c
index 3dc529b2b9bd5ff1c054b0458a0246c42f9d1d12..4a4d40adca770c076525f6db31dc58d223eaa812 100644 (file)
@@ -246,10 +246,15 @@ int seat_set_active(Seat *s, Session *session) {
         old_active = s->active;
         s->active = session;
 
+        if (old_active)
+                session_device_pause_all(old_active);
+
         seat_apply_acls(s, old_active);
 
-        if (session && session->started)
+        if (session && session->started) {
                 session_send_changed(session, "Active\0");
+                session_device_resume_all(session);
+        }
 
         if (!session || session->started)
                 seat_send_changed(s, "ActiveSession\0");
@@ -420,6 +425,21 @@ int seat_attach_session(Seat *s, Session *session) {
         return 0;
 }
 
+void seat_complete_switch(Seat *s) {
+        Session *session;
+
+        assert(s);
+
+        /* if no session-switch is pending or if it got canceled, do nothing */
+        if (!s->pending_switch)
+                return;
+
+        session = s->pending_switch;
+        s->pending_switch = NULL;
+
+        seat_set_active(s, session);
+}
+
 bool seat_has_vts(Seat *s) {
         assert(s);