mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
Generate client side marshal stubs from protocol spec
This commit is contained in:
parent
5fcd0aa58e
commit
3862e43779
5 changed files with 165 additions and 180 deletions
125
wayland-client.c
125
wayland-client.c
|
|
@ -202,6 +202,23 @@ wl_proxy_create_for_global(struct wl_display *display,
|
|||
return proxy;
|
||||
}
|
||||
|
||||
WL_EXPORT struct wl_proxy *
|
||||
wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
|
||||
{
|
||||
struct wl_proxy *proxy;
|
||||
|
||||
proxy = malloc(sizeof *proxy);
|
||||
if (proxy == NULL)
|
||||
return NULL;
|
||||
|
||||
proxy->base.interface = interface;
|
||||
proxy->base.id = wl_display_allocate_id(factory->display);
|
||||
proxy->display = factory->display;
|
||||
wl_hash_table_insert(factory->display->objects, proxy->base.id, proxy);
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
static int
|
||||
wl_proxy_add_listener(struct wl_proxy *proxy, void (**implementation)(void), void *data)
|
||||
{
|
||||
|
|
@ -218,7 +235,7 @@ wl_proxy_add_listener(struct wl_proxy *proxy, void (**implementation)(void), voi
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
WL_EXPORT void
|
||||
wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -248,24 +265,6 @@ wl_shell_add_listener(struct wl_shell *shell,
|
|||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_shell_move(struct wl_shell *shell,
|
||||
struct wl_surface *surface, struct wl_input_device *device,
|
||||
uint32_t time)
|
||||
{
|
||||
wl_proxy_marshal(&shell->proxy,
|
||||
WL_SHELL_MOVE, surface, device, time);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_shell_resize(struct wl_shell *shell,
|
||||
struct wl_surface *surface, struct wl_input_device *device,
|
||||
uint32_t time, uint32_t edges)
|
||||
{
|
||||
wl_proxy_marshal(&shell->proxy,
|
||||
WL_SHELL_RESIZE, surface, device, time, edges);
|
||||
}
|
||||
|
||||
WL_EXPORT int
|
||||
wl_drm_add_listener(struct wl_drm *drm,
|
||||
const struct wl_drm_listener *listener,
|
||||
|
|
@ -275,40 +274,6 @@ wl_drm_add_listener(struct wl_drm *drm,
|
|||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_drm_authenticate(struct wl_drm *drm, uint32_t id)
|
||||
{
|
||||
wl_proxy_marshal(&drm->proxy, WL_DRM_AUTHENTICATE, id);
|
||||
}
|
||||
|
||||
WL_EXPORT struct wl_buffer *
|
||||
wl_drm_create_buffer(struct wl_drm *drm, uint32_t name,
|
||||
int32_t width, int32_t height,
|
||||
uint32_t stride, struct wl_visual *visual)
|
||||
{
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
buffer = malloc(sizeof *buffer);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
buffer->proxy.base.interface = &wl_buffer_interface;
|
||||
buffer->proxy.base.id = wl_display_allocate_id(drm->proxy.display);
|
||||
buffer->proxy.display = drm->proxy.display;
|
||||
wl_hash_table_insert(drm->proxy.display->objects,
|
||||
drm->proxy.base.id, buffer);
|
||||
wl_proxy_marshal(&drm->proxy, WL_DRM_CREATE_BUFFER,
|
||||
buffer, name, width, height, stride, visual);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_buffer_destroy(struct wl_buffer *buffer)
|
||||
{
|
||||
wl_proxy_marshal(&buffer->proxy, WL_BUFFER_DESTROY);
|
||||
}
|
||||
|
||||
static void
|
||||
add_visual(struct wl_display *display, struct wl_global *global)
|
||||
{
|
||||
|
|
@ -610,60 +575,6 @@ wl_compositor_add_listener(struct wl_compositor *compositor,
|
|||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
WL_EXPORT struct wl_surface *
|
||||
wl_compositor_create_surface(struct wl_compositor *compositor)
|
||||
{
|
||||
struct wl_surface *surface;
|
||||
|
||||
surface = malloc(sizeof *surface);
|
||||
if (surface == NULL)
|
||||
return NULL;
|
||||
|
||||
surface->proxy.base.interface = &wl_surface_interface;
|
||||
surface->proxy.base.id = wl_display_allocate_id(compositor->proxy.display);
|
||||
surface->proxy.display = compositor->proxy.display;
|
||||
wl_hash_table_insert(compositor->proxy.display->objects,
|
||||
surface->proxy.base.id, surface);
|
||||
wl_proxy_marshal(&compositor->proxy,
|
||||
WL_COMPOSITOR_CREATE_SURFACE, surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_compositor_commit(struct wl_compositor *compositor, uint32_t key)
|
||||
{
|
||||
wl_proxy_marshal(&compositor->proxy, WL_COMPOSITOR_COMMIT, key);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_surface_destroy(struct wl_surface *surface)
|
||||
{
|
||||
wl_proxy_marshal(&surface->proxy, WL_SURFACE_DESTROY);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer)
|
||||
{
|
||||
wl_proxy_marshal(&surface->proxy, WL_SURFACE_ATTACH, buffer);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_surface_map(struct wl_surface *surface,
|
||||
int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal(&surface->proxy,
|
||||
WL_SURFACE_MAP, x, y, width, height);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_surface_damage(struct wl_surface *surface,
|
||||
int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal(&surface->proxy,
|
||||
WL_SURFACE_DAMAGE, x, y, width, height);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_surface_set_user_data(struct wl_surface *surface, void *user_data)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue