diff options
Diffstat (limited to 'src/login/logind-device.c')
-rw-r--r-- | src/login/logind-device.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/login/logind-device.c b/src/login/logind-device.c index 828e1efe4a..51b15358ba 100644 --- a/src/login/logind-device.c +++ b/src/login/logind-device.c @@ -65,22 +65,32 @@ void device_free(Device *d) { } void device_detach(Device *d) { + Seat *s; assert(d); - if (d->seat) - LIST_REMOVE(Device, devices, d->seat->devices, d); + if (!d->seat) + return; - seat_add_to_gc_queue(d->seat); + s = d->seat; + LIST_REMOVE(Device, devices, d->seat->devices, d); d->seat = NULL; + + seat_add_to_gc_queue(s); + seat_send_changed(s, "CanGraphical\0"); } void device_attach(Device *d, Seat *s) { assert(d); assert(s); + if (d->seat == s) + return; + if (d->seat) device_detach(d); d->seat = s; LIST_PREPEND(Device, devices, s->devices, d); + + seat_send_changed(s, "CanGraphical\0"); } |