summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wayland-server.c33
-rw-r--r--src/wayland-server.h4
2 files changed, 37 insertions, 0 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 0558634..5dd6c71 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -945,6 +945,39 @@ wl_global_destroy(struct wl_global *global)
free(global);
}
+WL_EXPORT void *
+wl_global_get_data(struct wl_global *global)
+{
+ return global->data;
+}
+
+WL_EXPORT struct wl_global *
+wl_global_find(struct wl_display *display,
+ const struct wl_interface *interface, uint32_t version,
+ void *data, wl_global_bind_func_t bind)
+{
+ struct wl_global *global;
+
+ /* return with nothing if we have no search parameters */
+ if (interface == NULL && version == 0 && data == NULL && bind == NULL)
+ return NULL;
+
+ wl_list_for_each(global, &display->global_list, link) {
+ if (interface != NULL && global->interface != interface)
+ continue;
+ if (version != 0 && global->version != version)
+ continue;
+ if (data != NULL && global->data != data)
+ continue;
+ if (bind != NULL && global->bind != bind)
+ continue;
+
+ return global;
+ }
+
+ return NULL;
+}
+
/** Get the current serial number
*
* \param display The display object
diff --git a/src/wayland-server.h b/src/wayland-server.h
index af2f03d..05449dc 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -113,6 +113,10 @@ struct wl_global *wl_global_create(struct wl_display *display,
int version,
void *data, wl_global_bind_func_t bind);
void wl_global_destroy(struct wl_global *global);
+void *wl_global_get_data(struct wl_global *global);
+struct wl_global *wl_global_find(struct wl_display *display,
+ const struct wl_interface *interface, uint32_t version,
+ void *data, wl_global_bind_func_t bind);
struct wl_client *wl_client_create(struct wl_display *display, int fd);
void wl_client_destroy(struct wl_client *client);