mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 10:08:05 +02:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
60d46e6bd7
commit
b569272a7a
2 changed files with 7 additions and 40 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue