touchpad: clean up tap bits on destroy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-03-25 12:14:39 +10:00
parent 67d1943ca4
commit e49a9888bf
3 changed files with 17 additions and 0 deletions

View file

@ -607,3 +607,14 @@ tp_init_tap(struct tp_dispatch *tp)
return 0;
}
void
tp_destroy_tap(struct tp_dispatch *tp)
{
if (tp->tap.source) {
libinput_remove_source(tp->device->base.seat->libinput, tp->tap.source);
tp->tap.source = NULL;
}
if (tp->tap.timer_fd > -1)
close(tp->tap.timer_fd);
}

View file

@ -690,6 +690,8 @@ tp_destroy(struct evdev_dispatch *dispatch)
struct tp_dispatch *tp =
(struct tp_dispatch*)dispatch;
tp_destroy_tap(tp);
if (tp->filter)
tp->filter->interface->destroy(tp->filter);
free(tp->touches);
@ -760,6 +762,7 @@ tp_init(struct tp_dispatch *tp,
tp->base.interface = &tp_interface;
tp->device = device;
tp->tap.timer_fd = -1;
if (tp_init_slots(tp, device) != 0)
return -1;

View file

@ -155,4 +155,7 @@ tp_tap_handle_timeout(struct tp_dispatch *tp, uint32_t time);
int
tp_init_tap(struct tp_dispatch *tp);
void
tp_destroy_tap(struct tp_dispatch *tp);
#endif