X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-device.c;h=51b15358baa07684819d7c6717e46454ed1bd266;hb=90527fbb2c48ffda5c6d8f232f8993a90b2632a4;hp=828e1efe4a2b79d01a5a63a432d8c2f9fd1ba435;hpb=5430f7f2bc7330f3088b894166bf3524a067e3d8;p=elogind.git diff --git a/src/login/logind-device.c b/src/login/logind-device.c index 828e1efe4..51b15358b 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"); }