[PATCH libinput v2 1/2] evdev: Add a remove callback to the evdev_dispatch_interface

Hans de Goede hdegoede at redhat.com
Tue Dec 9 01:04:00 PST 2014


Hi,

On 09-12-14 00:35, Peter Hutterer wrote:
> On Mon, Dec 08, 2014 at 10:46:43AM +0100, Hans de Goede wrote:
>> Some dispatchers may want to do some cleanup at remove time, rather then at
>> destroy time.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   src/evdev-mt-touchpad.c | 1 +
>>   src/evdev.c             | 4 ++++
>>   src/evdev.h             | 3 +++
>>   3 files changed, 8 insertions(+)
>>
>> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
>> index ad6b377..5af0062 100644
>> --- a/src/evdev-mt-touchpad.c
>> +++ b/src/evdev-mt-touchpad.c
>> @@ -863,6 +863,7 @@ tp_tag_device(struct evdev_device *device,
>>
>>   static struct evdev_dispatch_interface tp_interface = {
>>   	tp_process,
>> +	NULL, /* remove */
>>   	tp_destroy,
>>   	tp_device_added,
>>   	tp_device_removed,
>> diff --git a/src/evdev.c b/src/evdev.c
>> index fbfbcd3..4490562 100644
>> --- a/src/evdev.c
>> +++ b/src/evdev.c
>> @@ -737,6 +737,7 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
>>
>>   struct evdev_dispatch_interface fallback_interface = {
>>   	fallback_process,
>> +	NULL, /* remove */
>>   	fallback_destroy,
>>   	NULL, /* device_added */
>>   	NULL, /* device_removed */
>> @@ -2039,6 +2040,9 @@ evdev_device_remove(struct evdev_device *device)
>>   			d->dispatch->interface->device_removed(d, device);
>>   	}
>>
>> +	if (device->dispatch->interface->remove)
>> +		device->dispatch->interface->remove(device->dispatch);
>> +
>>   	evdev_device_suspend(device);
>
> I wonder, logically wouldn't it make more sense to suspend first and then
> call the remove callback?

I agree, fixed and pushed both patches.

Regards,

Hans


More information about the wayland-devel mailing list