From b569272a7aab562901341def944514d29b3a8ac0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 19 Dec 2013 11:42:55 +1000 Subject: [PATCH] Drop libinput_event_get_target() 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 --- src/libinput.c | 25 +++++++------------------ src/libinput.h | 22 ---------------------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/src/libinput.c b/src/libinput.c index 5c9126cf..e668140a 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -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; } diff --git a/src/libinput.h b/src/libinput.h index 4b1ec6e8..5f859926 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -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; @@ -220,22 +214,6 @@ libinput_event_destroy(struct libinput_event *event); enum libinput_event_type 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 * -- 2.34.1