diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-21 12:15:31 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-21 12:15:31 -0400 |
commit | 7dc36984af4b70018e4c70a39cf19172693d33fc (patch) | |
tree | c3f93ac831ea516b92016429a98f5a239324c9d5 | |
parent | bfea3d6befdb688d5354e6f15a9400ea637febf9 (diff) | |
parent | 4c2500c2e2abc380f34e3222d31222fd103015a5 (diff) |
Merge remote-tracking branch 'bnf/buffer.release'
-rw-r--r-- | protocol/wayland.xml | 3 | ||||
-rw-r--r-- | wayland/wayland-server.h | 3 | ||||
-rw-r--r-- | wayland/wayland-shm.c | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/protocol/wayland.xml b/protocol/wayland.xml index acaa706..fd54245 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -144,6 +144,9 @@ <!-- Destroy a buffer. This will invalidate the object id. --> <request name="destroy" type="destructor"/> + + <!-- Sent when an attached buffer is no longer used by the compositor. --> + <event name="release"/> </interface> <interface name="wl_shell" version="1"> diff --git a/wayland/wayland-server.h b/wayland/wayland-server.h index d1c655a..1fd16eb 100644 --- a/wayland/wayland-server.h +++ b/wayland/wayland-server.h @@ -134,9 +134,10 @@ struct wl_resource { struct wl_buffer { struct wl_resource resource; - struct wl_compositor *compositor; + struct wl_client *client; struct wl_visual *visual; int32_t width, height; + uint32_t busy_count; void *user_data; }; diff --git a/wayland/wayland-shm.c b/wayland/wayland-shm.c index cdd7874..90d2fcf 100644 --- a/wayland/wayland-shm.c +++ b/wayland/wayland-shm.c @@ -80,20 +80,21 @@ const static struct wl_buffer_interface shm_buffer_interface = { }; static struct wl_shm_buffer * -wl_shm_buffer_init(struct wl_shm *shm, uint32_t id, +wl_shm_buffer_init(struct wl_shm *shm, struct wl_client *client, uint32_t id, int32_t width, int32_t height, int32_t stride, struct wl_visual *visual, void *data) { struct wl_shm_buffer *buffer; - buffer = malloc(sizeof *buffer); + buffer = calloc(1, sizeof *buffer); if (buffer == NULL) return NULL; buffer->buffer.width = width; buffer->buffer.height = height; buffer->buffer.visual = visual; + buffer->buffer.client = client; buffer->stride = stride; buffer->data = data; @@ -147,7 +148,7 @@ shm_create_buffer(struct wl_client *client, struct wl_shm *shm, return; } - buffer = wl_shm_buffer_init(shm, id, + buffer = wl_shm_buffer_init(shm, client, id, width, height, stride, visual, data); if (buffer == NULL) { |