fallback_destroy,
NULL, /* device_added */
NULL, /* device_removed */
+ NULL, /* device_suspended */
+ NULL, /* device_resumed */
fallback_tag_device,
};
if (dev == &device->base)
continue;
+ /* Notify existing device d about addition of device device */
if (d->dispatch->interface->device_added)
d->dispatch->interface->device_added(d, device);
+ /* Notify new device device about existing device d */
if (device->dispatch->interface->device_added)
device->dispatch->interface->device_added(device, d);
+
+ /* Notify new device device if existing device d is suspended */
+ if (d->suspended && device->dispatch->interface->device_suspended)
+ device->dispatch->interface->device_suspended(device, d);
}
notify_added_device(&device->base);
}
}
+void
+evdev_notify_suspended_device(struct evdev_device *device)
+{
+ struct libinput_device *it;
+
+ if (device->suspended)
+ return;
+
+ list_for_each(it, &device->base.seat->devices_list, link) {
+ struct evdev_device *d = (struct evdev_device*)it;
+ if (it == &device->base)
+ continue;
+
+ if (d->dispatch->interface->device_suspended)
+ d->dispatch->interface->device_suspended(d, device);
+ }
+
+ device->suspended = 1;
+}
+
+void
+evdev_notify_resumed_device(struct evdev_device *device)
+{
+ struct libinput_device *it;
+
+ if (!device->suspended)
+ return;
+
+ list_for_each(it, &device->base.seat->devices_list, link) {
+ struct evdev_device *d = (struct evdev_device*)it;
+ if (it == &device->base)
+ continue;
+
+ if (d->dispatch->interface->device_resumed)
+ d->dispatch->interface->device_resumed(d, device);
+ }
+
+ device->suspended = 0;
+}
+
int
evdev_device_suspend(struct evdev_device *device)
{
+ evdev_notify_suspended_device(device);
+
if (device->source) {
libinput_remove_source(device->base.seat->libinput,
device->source);
memset(device->hw_key_mask, 0, sizeof(device->hw_key_mask));
+ evdev_notify_resumed_device(device);
+
return 0;
}
enum evdev_device_tags tags;
int is_mt;
+ int suspended;
struct {
struct motion_filter *filter;
void (*device_removed)(struct evdev_device *device,
struct evdev_device *removed_device);
+ /* A device was suspended */
+ void (*device_suspended)(struct evdev_device *device,
+ struct evdev_device *suspended_device);
+
+ /* A device was resumed */
+ void (*device_resumed)(struct evdev_device *device,
+ struct evdev_device *resumed_device);
+
/* Tag device with one of EVDEV_TAG */
void (*tag_device)(struct evdev_device *device,
struct udev_device *udev_device);
evdev_device_resume(struct evdev_device *device);
void
+evdev_notify_suspended_device(struct evdev_device *device);
+
+void
+evdev_notify_resumed_device(struct evdev_device *device);
+
+void
evdev_keyboard_notify_key(struct evdev_device *device,
uint32_t time,
int key,