Drop capability events
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 9 Jan 2014 03:12:23 +0000 (13:12 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 10 Jan 2014 01:08:40 +0000 (11:08 +1000)
We don't really support devices changing capabilities at runtime. The kernel
has no ability to tell us when this happens on an already-opened device and
the few devices that can literally change physical capabilities (e.g. the
wiimote) open up extra kernel devices instead of modifying the existing one.

Thus, we don't need to notify about devices changing capabilities.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev.c
src/libinput-private.h
src/libinput.c
src/libinput.h

index 8ee8a168d46f9d38f92c668cd92f06fcbe778c3d..43e6a107ba40b9a44eb175af06e15b21814de4c4 100644 (file)
@@ -574,23 +574,6 @@ evdev_configure_device(struct evdev_device *device)
        return 0;
 }
 
-static void
-register_device_capabilities(struct evdev_device *device)
-{
-       if (device->seat_caps & EVDEV_DEVICE_POINTER) {
-               device_register_capability(&device->base,
-                                          LIBINPUT_DEVICE_CAP_POINTER);
-       }
-       if (device->seat_caps & EVDEV_DEVICE_KEYBOARD) {
-               device_register_capability(&device->base,
-                                          LIBINPUT_DEVICE_CAP_KEYBOARD);
-       }
-       if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
-               device_register_capability(&device->base,
-                                          LIBINPUT_DEVICE_CAP_TOUCH);
-       }
-}
-
 struct evdev_device *
 evdev_device_create(struct libinput_seat *seat,
                    const char *devnode,
@@ -644,7 +627,6 @@ evdev_device_create(struct libinput_seat *seat,
 
        list_insert(seat->devices_list.prev, &device->base.link);
        notify_added_device(&device->base);
-       register_device_capabilities(device);
 
        return device;
 
@@ -698,19 +680,6 @@ evdev_device_has_capability(struct evdev_device *device,
 void
 evdev_device_remove(struct evdev_device *device)
 {
-       if (device->seat_caps & EVDEV_DEVICE_POINTER) {
-               device_unregister_capability(&device->base,
-                                            LIBINPUT_DEVICE_CAP_POINTER);
-       }
-       if (device->seat_caps & EVDEV_DEVICE_KEYBOARD) {
-               device_unregister_capability(&device->base,
-                                            LIBINPUT_DEVICE_CAP_KEYBOARD);
-       }
-       if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
-               device_unregister_capability(&device->base,
-                                            LIBINPUT_DEVICE_CAP_TOUCH);
-       }
-
        if (device->source)
                libinput_remove_source(device->base.seat->libinput,
                                       device->source);
index 5e11bb96b1f830f844ca307c1572fc27ad1c48db..3414388fac07e103b95bbab8e9af297af71e20c0 100644 (file)
@@ -118,14 +118,6 @@ notify_added_device(struct libinput_device *device);
 void
 notify_removed_device(struct libinput_device *device);
 
-void
-device_register_capability(struct libinput_device *device,
-                          enum libinput_device_capability capability);
-
-void
-device_unregister_capability(struct libinput_device *device,
-                            enum libinput_device_capability capability);
-
 void
 keyboard_notify_key(struct libinput_device *device,
                    uint32_t time,
index 7d564278f297a2742a088074c461f3f3e4d5717a..d3aca8b95980247ca8088c48719e7d43dc6c3e8b 100644 (file)
@@ -72,16 +72,6 @@ struct libinput_event_removed_device {
        struct libinput_device *device;
 };
 
-struct libinput_event_device_register_capability {
-       struct libinput_event base;
-       enum libinput_device_capability capability;
-};
-
-struct libinput_event_device_unregister_capability {
-       struct libinput_event base;
-       enum libinput_device_capability capability;
-};
-
 struct libinput_event_keyboard_key {
        struct libinput_event base;
        uint32_t time;
@@ -168,20 +158,6 @@ libinput_event_removed_device_get_device(
        return event->device;
 }
 
-LIBINPUT_EXPORT enum libinput_device_capability
-libinput_event_device_register_capability_get_capability(
-       struct libinput_event_device_register_capability *event)
-{
-       return event->capability;
-}
-
-LIBINPUT_EXPORT enum libinput_device_capability
-libinput_event_device_unregister_capability_get_capability(
-       struct libinput_event_device_unregister_capability *event)
-{
-       return event->capability;
-}
-
 LIBINPUT_EXPORT uint32_t
 libinput_event_keyboard_key_get_time(
        struct libinput_event_keyboard_key *event)
@@ -448,8 +424,6 @@ libinput_event_get_class(struct libinput_event *event)
        case LIBINPUT_EVENT_REMOVED_DEVICE:
                return LIBINPUT_EVENT_CLASS_BASE;
 
-       case LIBINPUT_EVENT_DEVICE_REGISTER_CAPABILITY:
-       case LIBINPUT_EVENT_DEVICE_UNREGISTER_CAPABILITY:
        case LIBINPUT_EVENT_KEYBOARD_KEY:
        case LIBINPUT_EVENT_POINTER_MOTION:
        case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
@@ -720,40 +694,6 @@ notify_removed_device(struct libinput_device *device)
                        &removed_device_event->base);
 }
 
-void
-device_register_capability(struct libinput_device *device,
-                          enum libinput_device_capability capability)
-{
-       struct libinput_event_device_register_capability *capability_event;
-
-       capability_event = malloc(sizeof *capability_event);
-
-       *capability_event = (struct libinput_event_device_register_capability) {
-               .capability = capability,
-       };
-
-       post_device_event(device,
-                         LIBINPUT_EVENT_DEVICE_REGISTER_CAPABILITY,
-                         &capability_event->base);
-}
-
-void
-device_unregister_capability(struct libinput_device *device,
-                            enum libinput_device_capability capability)
-{
-       struct libinput_event_device_unregister_capability *capability_event;
-
-       capability_event = malloc(sizeof *capability_event);
-
-       *capability_event = (struct libinput_event_device_unregister_capability) {
-               .capability = capability,
-       };
-
-       post_device_event(device,
-                         LIBINPUT_EVENT_DEVICE_UNREGISTER_CAPABILITY,
-                         &capability_event->base);
-}
-
 void
 keyboard_notify_key(struct libinput_device *device,
                    uint32_t time,
index d1c6746a54090434c82500a89e21d2c0ce038ce0..bb4f950c3213a3345e0b22e909fd82bc20eb685e 100644 (file)
@@ -128,9 +128,6 @@ enum libinput_event_type {
        LIBINPUT_EVENT_ADDED_DEVICE,
        LIBINPUT_EVENT_REMOVED_DEVICE,
 
-       LIBINPUT_EVENT_DEVICE_REGISTER_CAPABILITY = 200,
-       LIBINPUT_EVENT_DEVICE_UNREGISTER_CAPABILITY,
-
        LIBINPUT_EVENT_KEYBOARD_KEY = 300,
 
        LIBINPUT_EVENT_POINTER_MOTION = 400,
@@ -156,8 +153,6 @@ struct libinput_event_added_seat;
 struct libinput_event_removed_seat;
 struct libinput_event_added_device;
 struct libinput_event_removed_device;
-struct libinput_event_device_register_capability;
-struct libinput_event_device_unregister_capability;
 struct libinput_event_keyboard_key;
 struct libinput_event_pointer_motion;
 struct libinput_event_pointer_motion_absolute;
@@ -274,22 +269,6 @@ struct libinput_device *
 libinput_event_removed_device_get_device(
        struct libinput_event_removed_device *event);
 
-/**
- * @defgroup event_device_register_capability Register device capability event
- */
-
-enum libinput_device_capability
-libinput_event_device_register_capability_get_capability(
-       struct libinput_event_device_register_capability *event);
-
-/**
- * @defgroup event_device_unregister_capability Register device capability event
- */
-
-enum libinput_device_capability
-libinput_event_device_unregister_capability_get_capability(
-       struct libinput_event_device_unregister_capability *event);
-
 /**
  * @defgroup event_keyboard_key Keyboard key event
  */