From 6ff2c78603da3ec4bade962ede039513057b0454 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 2 Mar 2011 15:35:37 +0100 Subject: Update to latest Wayland version --- src/3rdparty/wayland/wayland-client-protocol.h | 69 -------------------------- src/3rdparty/wayland/wayland-client.c | 43 +++++----------- src/3rdparty/wayland/wayland-protocol.c | 16 ------ src/3rdparty/wayland/wayland-server-protocol.h | 19 ------- 4 files changed, 13 insertions(+), 134 deletions(-) (limited to 'src') diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h index 0af6645bb..5f4a5c486 100644 --- a/src/3rdparty/wayland/wayland-client-protocol.h +++ b/src/3rdparty/wayland/wayland-client-protocol.h @@ -36,7 +36,6 @@ struct wl_client; struct wl_display; struct wl_compositor; -struct wl_drm; struct wl_shm; struct wl_buffer; struct wl_shell; @@ -74,7 +73,6 @@ wl_proxy_get_user_data(struct wl_proxy *proxy); extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_drm_interface; extern const struct wl_interface wl_shm_interface; extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_shell_interface; @@ -191,73 +189,6 @@ wl_compositor_create_surface(struct wl_compositor *compositor) return (struct wl_surface *) id; } -struct wl_drm_listener { - void (*device)(void *data, - struct wl_drm *drm, - const char *name); - void (*authenticated)(void *data, - struct wl_drm *drm); -}; - -static inline int -wl_drm_add_listener(struct wl_drm *drm, - const struct wl_drm_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) drm, - (void (**)(void)) listener, data); -} - -#define WL_DRM_AUTHENTICATE 0 -#define WL_DRM_CREATE_BUFFER 1 - -static inline struct wl_drm * -wl_drm_create(struct wl_display *display, uint32_t id) -{ - return (struct wl_drm *) - wl_proxy_create_for_id(display, &wl_drm_interface, id); -} - -static inline void -wl_drm_set_user_data(struct wl_drm *drm, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) drm, user_data); -} - -static inline void * -wl_drm_get_user_data(struct wl_drm *drm) -{ - return wl_proxy_get_user_data((struct wl_proxy *) drm); -} - -static inline void -wl_drm_destroy(struct wl_drm *drm) -{ - wl_proxy_destroy((struct wl_proxy *) drm); -} - -static inline void -wl_drm_authenticate(struct wl_drm *drm, uint32_t id) -{ - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_AUTHENTICATE, id); -} - -static inline struct wl_buffer * -wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) drm, - &wl_buffer_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual); - - return (struct wl_buffer *) id; -} - #define WL_SHM_CREATE_BUFFER 0 static inline struct wl_shm * diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c index e3198c729..ad35c30ae 100644 --- a/src/3rdparty/wayland/wayland-client.c +++ b/src/3rdparty/wayland/wayland-client.c @@ -44,16 +44,9 @@ struct wl_global_listener { struct wl_list link; }; -struct wl_listener { - void (**implementation)(void); - void *data; - struct wl_list link; -}; - struct wl_proxy { struct wl_object object; struct wl_display *display; - struct wl_list listener_list; void *user_data; }; @@ -78,7 +71,6 @@ struct wl_display { uint32_t id, id_count, next_range; uint32_t mask; struct wl_hash_table *objects; - struct wl_listener listener; struct wl_list global_listener_list; struct wl_visual *argb_visual; @@ -147,9 +139,9 @@ wl_proxy_create_for_id(struct wl_display *display, return NULL; proxy->object.interface = interface; + proxy->object.implementation = NULL; proxy->object.id = id; proxy->display = display; - wl_list_init(&proxy->listener_list); wl_hash_table_insert(display->objects, proxy->object.id, proxy); return proxy; @@ -166,11 +158,6 @@ wl_proxy_create(struct wl_proxy *factory, WL_EXPORT void wl_proxy_destroy(struct wl_proxy *proxy) { - struct wl_listener *listener, *next; - - wl_list_for_each_safe(listener, next, &proxy->listener_list, link) - free(listener); - wl_hash_table_remove(proxy->display->objects, proxy->object.id); free(proxy); } @@ -179,15 +166,13 @@ WL_EXPORT int wl_proxy_add_listener(struct wl_proxy *proxy, void (**implementation)(void), void *data) { - struct wl_listener *listener; - - listener = malloc(sizeof *listener); - if (listener == NULL) + if (proxy->object.implementation) { + fprintf(stderr, "proxy already has listener\n"); return -1; + } - listener->implementation = (void (**)(void)) implementation; - listener->data = data; - wl_list_insert(proxy->listener_list.prev, &listener->link); + proxy->object.implementation = implementation; + proxy->user_data = data; return 0; } @@ -393,13 +378,13 @@ wl_display_connect(const char *name) display->proxy.object.interface = &wl_display_interface; display->proxy.object.id = 1; display->proxy.display = display; - wl_list_init(&display->proxy.listener_list); wl_list_init(&display->sync_list); wl_list_init(&display->frame_list); - display->listener.implementation = (void(**)(void)) &display_listener; - wl_list_insert(display->proxy.listener_list.prev, &display->listener.link); + display->proxy.object.implementation = + (void(**)(void)) &display_listener; + display->proxy.user_data = display; display->connection = wl_connection_create(display->fd, connection_update, @@ -473,7 +458,6 @@ handle_event(struct wl_display *display, uint32_t id, uint32_t opcode, uint32_t size) { uint32_t p[32]; - struct wl_listener *listener; struct wl_proxy *proxy; struct wl_closure *closure; const struct wl_message *message; @@ -484,7 +468,7 @@ handle_event(struct wl_display *display, else proxy = wl_hash_table_lookup(display->objects, id); - if (proxy == NULL) { + if (proxy == NULL || proxy->object.implementation == NULL) { wl_connection_consume(display->connection, size); return; } @@ -496,10 +480,9 @@ handle_event(struct wl_display *display, if (wl_debug) wl_closure_print(closure, &proxy->object); - wl_list_for_each(listener, &proxy->listener_list, link) - wl_closure_invoke(closure, &proxy->object, - listener->implementation[opcode], - listener->data); + wl_closure_invoke(closure, &proxy->object, + proxy->object.implementation[opcode], + proxy->user_data); wl_closure_destroy(closure); } diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c index 1b00ac44c..5686f9a22 100644 --- a/src/3rdparty/wayland/wayland-protocol.c +++ b/src/3rdparty/wayland/wayland-protocol.c @@ -55,22 +55,6 @@ WL_EXPORT const struct wl_interface wl_compositor_interface = { 0, NULL, }; -static const struct wl_message drm_requests[] = { - { "authenticate", "u" }, - { "create_buffer", "nuiiuo" }, -}; - -static const struct wl_message drm_events[] = { - { "device", "s" }, - { "authenticated", "" }, -}; - -WL_EXPORT const struct wl_interface wl_drm_interface = { - "drm", 1, - ARRAY_LENGTH(drm_requests), drm_requests, - ARRAY_LENGTH(drm_events), drm_events, -}; - static const struct wl_message shm_requests[] = { { "create_buffer", "nhiiuo" }, }; diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h index 8da6b7aa7..da61042cb 100644 --- a/src/3rdparty/wayland/wayland-server-protocol.h +++ b/src/3rdparty/wayland/wayland-server-protocol.h @@ -36,7 +36,6 @@ struct wl_client; struct wl_display; struct wl_compositor; -struct wl_drm; struct wl_shm; struct wl_buffer; struct wl_shell; @@ -51,7 +50,6 @@ struct wl_visual; extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_drm_interface; extern const struct wl_interface wl_shm_interface; extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_shell_interface; @@ -86,23 +84,6 @@ struct wl_compositor_interface { uint32_t id); }; -struct wl_drm_interface { - void (*authenticate)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id); - void (*create_buffer)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id, - uint32_t name, - int width, - int height, - uint32_t stride, - struct wl_visual *visual); -}; - -#define WL_DRM_DEVICE 0 -#define WL_DRM_AUTHENTICATED 1 - struct wl_shm_interface { void (*create_buffer)(struct wl_client *client, struct wl_shm *shm, -- cgit v1.2.3