From ed1acbbd7c76e806daf17a700a36b773a08917e6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 1 Jun 2023 14:58:40 +1000 Subject: [PATCH] eis: expose eis_device_get_context() and eis_seat_get_context() For frame events on a device it's likely that we want to use eis_now() which takes the context. So let's make this easy enough to access without having to carry extra variables in the caller. And the same for the seat as well. --- src/libeis-device.c | 2 +- src/libeis-device.h | 1 - src/libeis-seat.c | 6 ++++++ src/libeis.h | 12 ++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/libeis-device.c b/src/libeis-device.c index 6302b58..83dc2d9 100644 --- a/src/libeis-device.c +++ b/src/libeis-device.c @@ -92,7 +92,7 @@ eis_device_new_keymap(struct eis_device *device, return keymap; } -struct eis * +_public_ struct eis * eis_device_get_context(struct eis_device *device) { return eis_client_get_context(eis_device_get_client(device)); diff --git a/src/libeis-device.h b/src/libeis-device.h index d623c55..3584222 100644 --- a/src/libeis-device.h +++ b/src/libeis-device.h @@ -108,7 +108,6 @@ struct eis_xkb_modifiers { }; OBJECT_DECLARE_GETTER(eis_device, id, object_id_t); -OBJECT_DECLARE_GETTER(eis_device, context, struct eis *); OBJECT_DECLARE_GETTER(eis_device, proto_object, const struct brei_object *); OBJECT_DECLARE_GETTER(eis_device, interface, const struct eis_device_interface *); OBJECT_DECLARE_GETTER(eis_device, pointer_interface, const struct eis_pointer_interface *); diff --git a/src/libeis-seat.c b/src/libeis-seat.c index c3bf7fe..3d2e1e9 100644 --- a/src/libeis-seat.c +++ b/src/libeis-seat.c @@ -125,6 +125,12 @@ eis_seat_get_interface(struct eis_seat *seat) return &interface; } +_public_ struct eis * +eis_seat_get_context(struct eis_seat *seat) +{ + return eis_client_get_context(eis_seat_get_client(seat)); +} + _public_ struct eis_seat * eis_client_new_seat(struct eis_client *client, const char *name) { diff --git a/src/libeis.h b/src/libeis.h index 27fdfc4..3c52760 100644 --- a/src/libeis.h +++ b/src/libeis.h @@ -723,6 +723,18 @@ eis_seat_add(struct eis_seat *seat); void eis_seat_remove(struct eis_seat *seat); +/** + * @ingroup libeis-seat + */ +struct eis * +eis_seat_get_context(struct eis_seat *seat); + +/** + * @ingroup libeis-device + */ +struct eis * +eis_device_get_context(struct eis_device *device); + /** * @ingroup libeis-device */