X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-device.c;h=51b15358baa07684819d7c6717e46454ed1bd266;hb=d1148ed10a474ccc949113a8ec06e7e29c4c7cb0;hp=bbd370fbff75dc9721e6dc5bdae57795bbcb1a41;hpb=4bba9156da3e1df2cee24d10d7cd88c776ef4179;p=elogind.git diff --git a/src/login/logind-device.c b/src/login/logind-device.c index bbd370fbf..51b15358b 100644 --- a/src/login/logind-device.c +++ b/src/login/logind-device.c @@ -6,16 +6,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -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"); }