chiark / gitweb /
list: make our list macros a bit easier to use by not requring type spec on each...
[elogind.git] / src / login / logind-seat.c
index f88738ab1676c769d8d6bbb3b87be6059f75be3d..6f3299bbade725652a7bddeecdb9c5e87edae41e 100644 (file)
@@ -67,7 +67,7 @@ void seat_free(Seat *s) {
         assert(s);
 
         if (s->in_gc_queue)
-                LIST_REMOVE(Seat, gc_queue, s->manager->seat_gc_queue, s);
+                LIST_REMOVE(gc_queue, s->manager->seat_gc_queue, s);
 
         while (s->sessions)
                 session_free(s->sessions);
@@ -246,8 +246,10 @@ int seat_set_active(Seat *s, Session *session) {
         old_active = s->active;
         s->active = session;
 
-        if (old_active)
+        if (old_active) {
                 session_device_pause_all(old_active);
+                session_send_changed(old_active, "Active\0");
+        }
 
         seat_apply_acls(s, old_active);
 
@@ -413,7 +415,7 @@ int seat_attach_session(Seat *s, Session *session) {
         assert(!session->seat);
 
         session->seat = s;
-        LIST_PREPEND(Session, sessions_by_seat, s->sessions, session);
+        LIST_PREPEND(sessions_by_seat, s->sessions, session);
 
         seat_send_changed(s, "Sessions\0");
 
@@ -425,6 +427,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);
 
@@ -516,7 +533,7 @@ void seat_add_to_gc_queue(Seat *s) {
         if (s->in_gc_queue)
                 return;
 
-        LIST_PREPEND(Seat, gc_queue, s->manager->seat_gc_queue, s);
+        LIST_PREPEND(gc_queue, s->manager->seat_gc_queue, s);
         s->in_gc_queue = true;
 }