wayland-server: Add wl_global_create/destroy()

This patch introduces wl_global_create() and wl_global_destroy() as
replacements for wl_display_add_global() and wl_display_remove_global().
The add/remove_global API did not allow a compositor to indicate
the implemented version of a global, it just took the version from
the interface meta data.  The problem is that the meta data
(which lives in libwayland-server.so) can get out of sync with a
compositor implementation.  The compositor will then advertise a
higher version of a global than what it actually implements.

The new API lets a compositor pass in a version when it registers
a global, which solves the problem.  The add/remove API is deprecated
with this patch and will be removed.
This commit is contained in:
Kristian Høgsberg 2013-07-08 18:45:41 -04:00
parent 40fc79d5b0
commit 4cffa0fd61
2 changed files with 60 additions and 17 deletions

View file

@ -99,14 +99,6 @@ void wl_display_flush_clients(struct wl_display *display);
typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
uint32_t version, uint32_t id);
struct wl_global *wl_display_add_global(struct wl_display *display,
const struct wl_interface *interface,
void *data,
wl_global_bind_func_t bind);
void wl_display_remove_global(struct wl_display *display,
struct wl_global *global);
uint32_t wl_display_get_serial(struct wl_display *display);
uint32_t wl_display_next_serial(struct wl_display *display);
@ -115,6 +107,12 @@ void wl_display_add_destroy_listener(struct wl_display *display,
struct wl_listener *wl_display_get_destroy_listener(struct wl_display *display,
wl_notify_func_t notify);
struct wl_global *wl_global_create(struct wl_display *display,
const struct wl_interface *interface,
int version,
void *data, wl_global_bind_func_t bind);
void wl_global_destroy(struct wl_global *global);
struct wl_client *wl_client_create(struct wl_display *display, int fd);
void wl_client_destroy(struct wl_client *client);
void wl_client_flush(struct wl_client *client);
@ -213,6 +211,16 @@ wl_client_new_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation, void *data) WL_DEPRECATED;
struct wl_global *
wl_display_add_global(struct wl_display *display,
const struct wl_interface *interface,
void *data,
wl_global_bind_func_t bind) WL_DEPRECATED;
void
wl_display_remove_global(struct wl_display *display,
struct wl_global *global) WL_DEPRECATED;
#endif
/*