Update to latest Wayland version

This commit is contained in:
Paul Olav Tvete 2011-03-02 15:35:37 +01:00
parent 27207edfca
commit b667ca007e
4 changed files with 13 additions and 134 deletions

View File

@ -36,7 +36,6 @@ struct wl_client;
struct wl_display; struct wl_display;
struct wl_compositor; struct wl_compositor;
struct wl_drm;
struct wl_shm; struct wl_shm;
struct wl_buffer; struct wl_buffer;
struct wl_shell; 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_display_interface;
extern const struct wl_interface wl_compositor_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_shm_interface;
extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_buffer_interface;
extern const struct wl_interface wl_shell_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; 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 #define WL_SHM_CREATE_BUFFER 0
static inline struct wl_shm * static inline struct wl_shm *

View File

@ -44,16 +44,9 @@ struct wl_global_listener {
struct wl_list link; struct wl_list link;
}; };
struct wl_listener {
void (**implementation)(void);
void *data;
struct wl_list link;
};
struct wl_proxy { struct wl_proxy {
struct wl_object object; struct wl_object object;
struct wl_display *display; struct wl_display *display;
struct wl_list listener_list;
void *user_data; void *user_data;
}; };
@ -78,7 +71,6 @@ struct wl_display {
uint32_t id, id_count, next_range; uint32_t id, id_count, next_range;
uint32_t mask; uint32_t mask;
struct wl_hash_table *objects; struct wl_hash_table *objects;
struct wl_listener listener;
struct wl_list global_listener_list; struct wl_list global_listener_list;
struct wl_visual *argb_visual; struct wl_visual *argb_visual;
@ -147,9 +139,9 @@ wl_proxy_create_for_id(struct wl_display *display,
return NULL; return NULL;
proxy->object.interface = interface; proxy->object.interface = interface;
proxy->object.implementation = NULL;
proxy->object.id = id; proxy->object.id = id;
proxy->display = display; proxy->display = display;
wl_list_init(&proxy->listener_list);
wl_hash_table_insert(display->objects, proxy->object.id, proxy); wl_hash_table_insert(display->objects, proxy->object.id, proxy);
return proxy; return proxy;
@ -166,11 +158,6 @@ wl_proxy_create(struct wl_proxy *factory,
WL_EXPORT void WL_EXPORT void
wl_proxy_destroy(struct wl_proxy *proxy) 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); wl_hash_table_remove(proxy->display->objects, proxy->object.id);
free(proxy); free(proxy);
} }
@ -179,15 +166,13 @@ WL_EXPORT int
wl_proxy_add_listener(struct wl_proxy *proxy, wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data) void (**implementation)(void), void *data)
{ {
struct wl_listener *listener; if (proxy->object.implementation) {
fprintf(stderr, "proxy already has listener\n");
listener = malloc(sizeof *listener);
if (listener == NULL)
return -1; return -1;
}
listener->implementation = (void (**)(void)) implementation; proxy->object.implementation = implementation;
listener->data = data; proxy->user_data = data;
wl_list_insert(proxy->listener_list.prev, &listener->link);
return 0; return 0;
} }
@ -393,13 +378,13 @@ wl_display_connect(const char *name)
display->proxy.object.interface = &wl_display_interface; display->proxy.object.interface = &wl_display_interface;
display->proxy.object.id = 1; display->proxy.object.id = 1;
display->proxy.display = display; display->proxy.display = display;
wl_list_init(&display->proxy.listener_list);
wl_list_init(&display->sync_list); wl_list_init(&display->sync_list);
wl_list_init(&display->frame_list); wl_list_init(&display->frame_list);
display->listener.implementation = (void(**)(void)) &display_listener; display->proxy.object.implementation =
wl_list_insert(display->proxy.listener_list.prev, &display->listener.link); (void(**)(void)) &display_listener;
display->proxy.user_data = display;
display->connection = wl_connection_create(display->fd, display->connection = wl_connection_create(display->fd,
connection_update, connection_update,
@ -473,7 +458,6 @@ handle_event(struct wl_display *display,
uint32_t id, uint32_t opcode, uint32_t size) uint32_t id, uint32_t opcode, uint32_t size)
{ {
uint32_t p[32]; uint32_t p[32];
struct wl_listener *listener;
struct wl_proxy *proxy; struct wl_proxy *proxy;
struct wl_closure *closure; struct wl_closure *closure;
const struct wl_message *message; const struct wl_message *message;
@ -484,7 +468,7 @@ handle_event(struct wl_display *display,
else else
proxy = wl_hash_table_lookup(display->objects, id); proxy = wl_hash_table_lookup(display->objects, id);
if (proxy == NULL) { if (proxy == NULL || proxy->object.implementation == NULL) {
wl_connection_consume(display->connection, size); wl_connection_consume(display->connection, size);
return; return;
} }
@ -496,10 +480,9 @@ handle_event(struct wl_display *display,
if (wl_debug) if (wl_debug)
wl_closure_print(closure, &proxy->object); wl_closure_print(closure, &proxy->object);
wl_list_for_each(listener, &proxy->listener_list, link) wl_closure_invoke(closure, &proxy->object,
wl_closure_invoke(closure, &proxy->object, proxy->object.implementation[opcode],
listener->implementation[opcode], proxy->user_data);
listener->data);
wl_closure_destroy(closure); wl_closure_destroy(closure);
} }

View File

@ -55,22 +55,6 @@ WL_EXPORT const struct wl_interface wl_compositor_interface = {
0, NULL, 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[] = { static const struct wl_message shm_requests[] = {
{ "create_buffer", "nhiiuo" }, { "create_buffer", "nhiiuo" },
}; };

View File

@ -36,7 +36,6 @@ struct wl_client;
struct wl_display; struct wl_display;
struct wl_compositor; struct wl_compositor;
struct wl_drm;
struct wl_shm; struct wl_shm;
struct wl_buffer; struct wl_buffer;
struct wl_shell; struct wl_shell;
@ -51,7 +50,6 @@ struct wl_visual;
extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_display_interface;
extern const struct wl_interface wl_compositor_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_shm_interface;
extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_buffer_interface;
extern const struct wl_interface wl_shell_interface; extern const struct wl_interface wl_shell_interface;
@ -86,23 +84,6 @@ struct wl_compositor_interface {
uint32_t id); 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 { struct wl_shm_interface {
void (*create_buffer)(struct wl_client *client, void (*create_buffer)(struct wl_client *client,
struct wl_shm *shm, struct wl_shm *shm,