Drop libinput_event_get_target()
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 19 Dec 2013 01:42:55 +0000 (11:42 +1000)
committerJonas Ådahl <jadahl@gmail.com>
Tue, 21 Jan 2014 21:50:58 +0000 (22:50 +0100)
Replaced by specific accessor functions for context, seat and device. This
obsoletes the internal target as well, we just direcly ref the element we need
to instead of temporarily storing it in the target.

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

index 5c9126c..e668140 100644 (file)
@@ -51,7 +51,6 @@ struct libinput_source {
 struct libinput_event {
        enum libinput_event_type type;
        struct libinput_device *device;
-       union libinput_event_target target;
 };
 
 struct libinput_event_added_device {
@@ -118,12 +117,6 @@ libinput_event_get_type(struct libinput_event *event)
        return event->type;
 }
 
-LIBINPUT_EXPORT union libinput_event_target
-libinput_event_get_target(struct libinput_event *event)
-{
-       return event->target;
-}
-
 LIBINPUT_EXPORT struct libinput*
 libinput_event_get_context(struct libinput_event *event)
 {
@@ -427,10 +420,10 @@ libinput_event_destroy(struct libinput_event *event)
        case LIBINPUT_EVENT_CLASS_BASE:
                break;
        case LIBINPUT_EVENT_CLASS_SEAT:
-               libinput_seat_unref(event->target.seat);
+               libinput_seat_unref(event->device->seat);
                break;
        case LIBINPUT_EVENT_CLASS_DEVICE:
-               libinput_device_unref(event->target.device);
+               libinput_device_unref(event->device);
                break;
        }
 
@@ -577,12 +570,10 @@ libinput_dispatch(struct libinput *libinput)
 static void
 init_event_base(struct libinput_event *event,
                struct libinput_device *device,
-               enum libinput_event_type type,
-               union libinput_event_target target)
+               enum libinput_event_type type)
 {
        event->type = type;
        event->device = device;
-       event->target = target;
 }
 
 static void
@@ -591,8 +582,7 @@ post_base_event(struct libinput_device *device,
                struct libinput_event *event)
 {
        struct libinput *libinput = device->seat->libinput;
-       init_event_base(event, device, type,
-                       (union libinput_event_target) { .libinput = libinput });
+       init_event_base(event, device, type);
        libinput_post_event(libinput, event);
 }
 
@@ -601,8 +591,7 @@ post_device_event(struct libinput_device *device,
                  enum libinput_event_type type,
                  struct libinput_event *event)
 {
-       init_event_base(event, device, type,
-                       (union libinput_event_target) { .device = device });
+       init_event_base(event, device, type);
        libinput_post_event(device->seat->libinput, event);
 }
 
@@ -825,10 +814,10 @@ libinput_post_event(struct libinput *libinput,
        case LIBINPUT_EVENT_CLASS_BASE:
                break;
        case LIBINPUT_EVENT_CLASS_SEAT:
-               libinput_seat_ref(event->target.seat);
+               libinput_seat_ref(event->device->seat);
                break;
        case LIBINPUT_EVENT_CLASS_DEVICE:
-               libinput_device_ref(event->target.device);
+               libinput_device_ref(event->device);
                break;
        }
 
index 4b1ec6e..5f85992 100644 (file)
@@ -141,12 +141,6 @@ struct libinput;
 struct libinput_device;
 struct libinput_seat;
 
-union libinput_event_target {
-       struct libinput *libinput;
-       struct libinput_seat *seat;
-       struct libinput_device *device;
-};
-
 struct libinput_event;
 struct libinput_event_added_device;
 struct libinput_event_removed_device;
@@ -223,22 +217,6 @@ libinput_event_get_type(struct libinput_event *event);
 /**
  * @ingroup event
  *
- * Get get the target union of the event.
- *
- * The valid union member depends on the event type. For global events not
- * related to some seat or device, the target is a libinput struct pointer.
- * For events associated with a seat, the target is a libinput_seat pointer
- * and for events associated with a device, the target is a libinput_device
- * pointer.
- *
- * @param event An event retrieved by libinput_get_event().
- */
-union libinput_event_target
-libinput_event_get_target(struct libinput_event *event);
-
-/**
- * @ingroup event
- *
  * Get the libinput context from the event.
  *
  * @param event The libinput event