compositor-drm: destroy evdev driver properly when finishing compositor

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
This commit is contained in:
Tiago Vignatti 2011-12-18 23:52:18 +02:00
parent 0db1d5f551
commit c349e1d0b0
3 changed files with 34 additions and 0 deletions

View File

@ -772,11 +772,15 @@ static void
drm_destroy(struct wlsc_compositor *ec) drm_destroy(struct wlsc_compositor *ec)
{ {
struct drm_compositor *d = (struct drm_compositor *) ec; struct drm_compositor *d = (struct drm_compositor *) ec;
struct wlsc_input_device *input, *next;
wlsc_compositor_shutdown(ec); wlsc_compositor_shutdown(ec);
gbm_device_destroy(d->gbm); gbm_device_destroy(d->gbm);
tty_destroy(d->tty); tty_destroy(d->tty);
wl_list_for_each_safe(input, next, &ec->input_device_list, link)
evdev_input_destroy(input);
free(d); free(d);
} }

View File

@ -377,6 +377,9 @@ void
evdev_input_add_devices(struct wlsc_compositor *c, evdev_input_add_devices(struct wlsc_compositor *c,
struct udev *udev, const char *seat); struct udev *udev, const char *seat);
void
evdev_input_destroy(struct wlsc_input_device *input_base);
enum { enum {
TTY_ENTER_VT, TTY_ENTER_VT,
TTY_LEAVE_VT TTY_LEAVE_VT

View File

@ -537,3 +537,30 @@ evdev_input_add_devices(struct wlsc_compositor *c,
c->input_device = &input->base.input_device; c->input_device = &input->base.input_device;
} }
static void
evdev_remove_devices(struct wlsc_input_device *input_base)
{
struct evdev_input *input = (struct evdev_input *) input_base;
struct evdev_input_device *device, *next;
wl_list_for_each_safe(device, next, &input->devices_list, link) {
fprintf(stderr, "evdev input device: removed: %s\n", device->devnode);
wl_event_source_remove(device->source);
wl_list_remove(&device->link);
close(device->fd);
free(device->devnode);
free(device);
}
}
void
evdev_input_destroy(struct wlsc_input_device *input_base)
{
struct evdev_input *input = (struct evdev_input *) input_base;
evdev_remove_devices(input_base);
wl_list_remove(&input->base.link);
free(input->seat_id);
free(input);
}