summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-03-09 00:05:42 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-03-22 14:24:24 +0100
commit6084b3da7bd66418e90e833cdd32a73eb64b8e1a (patch)
treed73dea7a2db4da343d96042835a19d83e888e692
parentdc3eb7d56c9b8aadec89c7003c7ffa2ae4ebe368 (diff)
wayland-shm: Do no expect wl_shm* in wl_shm_buffer_createshm-in-egl
This is an ulgy hack, but the example compositor needs it currently.
-rw-r--r--wayland/wayland-server.h2
-rw-r--r--wayland/wayland-shm.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/wayland/wayland-server.h b/wayland/wayland-server.h
index c517228..6be1163 100644
--- a/wayland/wayland-server.h
+++ b/wayland/wayland-server.h
@@ -269,7 +269,7 @@ int32_t
wl_shm_buffer_get_stride(struct wl_buffer *buffer);
struct wl_buffer *
-wl_shm_buffer_create(struct wl_shm *shm, int width, int height,
+wl_shm_buffer_create(int width, int height,
int stride, struct wl_visual *visual,
void *data);
diff --git a/wayland/wayland-shm.c b/wayland/wayland-shm.c
index c38ce07..daf5abe 100644
--- a/wayland/wayland-shm.c
+++ b/wayland/wayland-shm.c
@@ -38,6 +38,8 @@ struct wl_shm {
const struct wl_shm_callbacks *callbacks;
};
+static struct wl_shm *shm_global;
+
enum buffer_allocation {
BUFFER_MAPPED,
BUFFER_ALLOCATED
@@ -193,6 +195,8 @@ wl_shm_init(struct wl_display *display,
if (!shm)
return NULL;
+ shm_global = shm;
+
shm->object.interface = &wl_shm_interface;
shm->object.implementation = (void (**)(void)) &shm_interface;
wl_display_add_object(display, &shm->object);
@@ -213,7 +217,7 @@ wl_shm_destroy(struct wl_shm *shm)
/* FIXME: remove this (allow compositors to execute requests locally) */
WL_EXPORT struct wl_buffer *
-wl_shm_buffer_create(struct wl_shm *shm, int width, int height,
+wl_shm_buffer_create(int width, int height,
int stride, struct wl_visual *visual,
void *data)
{
@@ -227,7 +231,7 @@ wl_shm_buffer_create(struct wl_shm *shm, int width, int height,
memcpy(pixels, data, stride * height);
- buffer = wl_shm_buffer_init(shm, id,
+ buffer = wl_shm_buffer_init(shm_global, id,
width, height, stride, visual,
BUFFER_ALLOCATED, pixels);