mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
Add wl_resource_init and use it in libwayland implementations of data sharing and SHM
This commit adds a wl_resource_init function for initializing wl_resource structures similar to wl_client_add_object. From this commit forward, wl_resource structures should not be initialized manually, but should use wl_resource_init. In the event of a change to the wl_resource structure, this allows us to protect against regressions by filling in added fields with reasonable defaults. In this way, while changing wl_object or wl_resource still constitutes an ABI break, compositors following this rule will only need to be recompiled in order to properly link against the new version. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
ca5b1946cb
commit
bedc3432ff
4 changed files with 27 additions and 35 deletions
|
|
@ -190,6 +190,22 @@ struct wl_resource {
|
|||
void *data;
|
||||
};
|
||||
|
||||
static inline void
|
||||
wl_resource_init(struct wl_resource *resource,
|
||||
const struct wl_interface *interface,
|
||||
const void *implementation, uint32_t id, void *data)
|
||||
{
|
||||
resource->object.id = id;
|
||||
resource->object.interface = interface;
|
||||
resource->object.implementation = implementation;
|
||||
|
||||
wl_signal_init(&resource->destroy_signal);
|
||||
|
||||
resource->destroy = NULL;
|
||||
resource->client = NULL;
|
||||
resource->data = data;
|
||||
}
|
||||
|
||||
struct wl_buffer {
|
||||
struct wl_resource resource;
|
||||
int32_t width, height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue