[PATCH 6/7] Add wl_arguments forms of wl_resource_post_event and wl_resource_queue_event
Jason Ekstrand
jason at jlekstrand.net
Fri Feb 1 08:09:47 PST 2013
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/wayland-server.c | 47 ++++++++++++++++++++++++++++++++++++-----------
src/wayland-server.h | 4 ++++
2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/src/wayland-server.c b/src/wayland-server.c
index e45b880..dcbe0c2 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -113,16 +113,14 @@ destroy_client(void *data)
}
WL_EXPORT void
-wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
+wl_resource_post_event_a(struct wl_resource *resource, uint32_t opcode,
+ union wl_argument *args)
{
struct wl_closure *closure;
struct wl_object *object = &resource->object;
- va_list ap;
- va_start(ap, opcode);
- closure = wl_closure_vmarshal(object, opcode, ap,
- &object->interface->events[opcode]);
- va_end(ap);
+ closure = wl_closure_marshal(object, opcode, args,
+ &object->interface->events[opcode]);
if (closure == NULL)
return;
@@ -137,19 +135,31 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
wl_closure_destroy(closure);
}
-
WL_EXPORT void
-wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
+wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
{
- struct wl_closure *closure;
+ union wl_argument args[WL_CLOSURE_MAX_ARGS];
struct wl_object *object = &resource->object;
va_list ap;
va_start(ap, opcode);
- closure = wl_closure_vmarshal(object, opcode, ap,
- &object->interface->events[opcode]);
+ wl_argument_from_va_list(object->interface->events[opcode].signature,
+ args, WL_CLOSURE_MAX_ARGS, ap);
va_end(ap);
+ wl_resource_post_event_a(resource, opcode, args);
+}
+
+WL_EXPORT void
+wl_resource_queue_event_a(struct wl_resource *resource, uint32_t opcode,
+ union wl_argument *args)
+{
+ struct wl_closure *closure;
+ struct wl_object *object = &resource->object;
+
+ closure = wl_closure_marshal(object, opcode, args,
+ &object->interface->events[opcode]);
+
if (closure == NULL)
return;
@@ -164,6 +174,21 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
}
WL_EXPORT void
+wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
+{
+ union wl_argument args[WL_CLOSURE_MAX_ARGS];
+ struct wl_object *object = &resource->object;
+ va_list ap;
+
+ va_start(ap, opcode);
+ wl_argument_from_va_list(object->interface->events[opcode].signature,
+ args, WL_CLOSURE_MAX_ARGS, ap);
+ va_end(ap);
+
+ wl_resource_queue_event_a(resource, opcode, args);
+}
+
+WL_EXPORT void
wl_resource_post_error(struct wl_resource *resource,
uint32_t code, const char *msg, ...)
{
diff --git a/src/wayland-server.h b/src/wayland-server.h
index c7369eb..15a5834 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -386,8 +386,12 @@ struct wl_seat {
* - type=new_id: (struct wl_object *) or (struct wl_resource *)
* - type=object: (struct wl_object *) or (struct wl_resource *)
*/
+void wl_resource_post_event_a(struct wl_resource *resource,
+ uint32_t opcode, union wl_argument *args);
void wl_resource_post_event(struct wl_resource *resource,
uint32_t opcode, ...);
+void wl_resource_queue_event_a(struct wl_resource *resource,
+ uint32_t opcode, union wl_argument *args);
void wl_resource_queue_event(struct wl_resource *resource,
uint32_t opcode, ...);
--
1.8.1
More information about the wayland-devel
mailing list