struct libinput_event {
enum libinput_event_type type;
struct libinput_device *device;
- union libinput_event_target target;
};
struct libinput_event_added_device {
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)
{
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;
}
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
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);
}
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);
}
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;
}
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;
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
*