Skip to content

Commit

Permalink
wayland-server: Add functions to wl_global
Browse files Browse the repository at this point in the history
When using a wl_global, a server may need to retrieve the associated
wl_interface and user data.

Add a couple of convenient functions wl_global_get_interface() and
wl_global_get_user_data() for this purpose.

Signed-off-by: Olivier Fourdan <[email protected]>
Reviewed-by: Yong Bakos <[email protected]>
Reviewed-by: Pekka Paalanen <[email protected]>
  • Loading branch information
ofourdan authored and ppaalanen committed Jan 24, 2017
1 parent d915447 commit 65b773e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wayland-server-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ wl_display_set_global_filter(struct wl_display *display,
wl_display_global_filter_func_t filter,
void *data);

const struct wl_interface *
wl_global_get_interface(const struct wl_global *global);

void *
wl_global_get_user_data(const struct wl_global *global);

struct wl_client *
wl_client_create(struct wl_display *display, int fd);

Expand Down
12 changes: 12 additions & 0 deletions src/wayland-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,18 @@ wl_global_destroy(struct wl_global *global)
free(global);
}

WL_EXPORT const struct wl_interface *
wl_global_get_interface(const struct wl_global *global)
{
return global->interface;
}

WL_EXPORT void *
wl_global_get_user_data(const struct wl_global *global)
{
return global->data;
}

/** Get the current serial number
*
* \param display The display object
Expand Down

0 comments on commit 65b773e

Please sign in to comment.