From 91781ad3e088303f452b325b18b2fc4a66359440 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sat, 25 Jul 2020 16:17:47 +1000 Subject: [PATCH] Drop the _ctx suffix to the main structs No proper reason, it just goes easier with the macros I'm about to implement. Signed-off-by: Peter Hutterer --- src/libei.h | 30 +++++++++++++++--------------- src/libeis.h | 32 +++++++++++++++++++------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/libei.h b/src/libei.h index eb3814a..5efb113 100644 --- a/src/libei.h +++ b/src/libei.h @@ -26,7 +26,7 @@ #include #include -struct ei_ctx; +struct ei; struct ei_device; struct ei_event; struct ei_event_client; @@ -70,7 +70,7 @@ enum ei_event_type { /** * The server has disconnected this client - all resources left to * reference this server are now obsolete. Once this event has been - * received, the @ref struct ei_ctx and all its associated resources + * received, the @ref struct ei and all its associated resources * should be released. */ EI_EVENT_DISCONNECT, @@ -98,14 +98,14 @@ enum ei_event_type { EI_EVENT_DEVICE_RESUMED, }; -struct ei_ctx * +struct ei * ei_new(void); -struct ei_ctx * -ei_ref(struct ei_ctx *ctx); +struct ei * +ei_ref(struct ei *ctx); -struct ei_ctx * -ei_unref(struct ei_ctx *ei); +struct ei * +ei_unref(struct ei *ei); /** * Connect to the libeis server via the org.freedesktop.portal @@ -113,7 +113,7 @@ ei_unref(struct ei_ctx *ei); * @return 0 on success or a negative errno on failure */ int -ei_portal_connect(struct ei_ctx *ei); +ei_portal_connect(struct ei *ei); /** * Connect to the libeis server on the org.freedesktop.Ei bus name. @@ -121,19 +121,19 @@ ei_portal_connect(struct ei_ctx *ei); * @return 0 on success or a negative errno on failure */ int -ei_dbus_connect(struct ei_ctx *ei); +ei_dbus_connect(struct ei *ei); int -ei_get_fd(struct ei_ctx *ei); +ei_get_fd(struct ei *ei); void -ei_dispatch(struct ei_ctx *ei); +ei_dispatch(struct ei *ei); struct ei_event * -ei_get_event(struct ei_ctx *ei); +ei_get_event(struct ei *ei); enum ei_event_type -ei_next_event_type(struct ei_ctx *ei); +ei_next_event_type(struct ei *ei); struct ei_event * ei_event_unref(struct ei_event *event); @@ -160,7 +160,7 @@ ei_device_unref(struct ei_device *device); * @param ei The context */ struct ei_device * -ei_device_new(struct ei_ctx *ei); +ei_device_new(struct ei *ei); /** * Set the name for this device. This is a suggestion only, the server may @@ -340,7 +340,7 @@ enum ei_keymap_source ei_device_get_keymap_source(struct ei_device *device); -struct ei_ctx * +struct ei * ei_device_get_context(struct ei_device *device); /** diff --git a/src/libeis.h b/src/libeis.h index b43c061..1e2b4c4 100644 --- a/src/libeis.h +++ b/src/libeis.h @@ -27,7 +27,7 @@ #include #include -struct eis_ctx; +struct eis; struct eis_client; struct eis_device; struct eis_event; @@ -108,39 +108,45 @@ enum eis_event_type { /** * Create a new libeis context with a refcount of 1. */ -struct eis_ctx * -eis_new(void); +struct eis * +eis_new(void *userdata); -struct eis_ctx * -eis_ref(struct eis_ctx *eis); +struct eis * +eis_ref(struct eis *eis); -struct eis_ctx * -eis_unref(struct eis_ctx *eis); +struct eis * +eis_unref(struct eis *eis); + +void * +eis_get_userdata(struct eis *eis); + +void +eis_set_userdata(struct eis *eis, void *userdata); /** * Initialize the context with org.freedesktop.portal integration. */ int -eis_portal_init(struct eis_ctx *ctx); +eis_portal_init(struct eis *ctx); /** * Initialize the context with a DBus backend on the org.freedesktop.Ei bus * name. */ int -eis_dbus_init(struct eis_ctx *ctx); +eis_dbus_init(struct eis *ctx); int -eis_get_fd(struct eis_ctx *eis); +eis_get_fd(struct eis *eis); void -eis_dispatch(struct eis_ctx *eis); +eis_dispatch(struct eis *eis); struct eis_event * -eis_get_event(struct eis_ctx *eis); +eis_get_event(struct eis *eis); enum eis_event_type -eis_next_event_type(struct eis_ctx *eis); +eis_next_event_type(struct eis *eis); struct eis_client * eis_client_ref(struct eis_client *client);