summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connection.c16
-rw-r--r--src/wayland-client.c2
-rw-r--r--src/wayland-private.h7
-rw-r--r--src/wayland-server.c2
-rw-r--r--tests/connection-test.c6
-rw-r--r--tests/os-wrappers-test.c2
6 files changed, 23 insertions, 12 deletions
diff --git a/src/connection.c b/src/connection.c
index e6c2b64..b952da1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -801,7 +801,8 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
}
static void
-convert_arguments_to_ffi(const char *signature, union wl_argument *args,
+convert_arguments_to_ffi(const char *signature, uint32_t flags,
+ union wl_argument *args,
int count, ffi_type **ffi_types, void** ffi_args)
{
int i;
@@ -834,8 +835,13 @@ convert_arguments_to_ffi(const char *signature, union wl_argument *args,
ffi_args[i] = &args[i].o;
break;
case 'n':
- ffi_types[i] = &ffi_type_uint32;
- ffi_args[i] = &args[i].n;
+ if (flags & WL_CLOSURE_INVOKE_CLIENT) {
+ ffi_types[i] = &ffi_type_pointer;
+ ffi_args[i] = &args[i].o;
+ } else {
+ ffi_types[i] = &ffi_type_uint32;
+ ffi_args[i] = &args[i].n;
+ }
break;
case 'a':
ffi_types[i] = &ffi_type_pointer;
@@ -855,7 +861,7 @@ convert_arguments_to_ffi(const char *signature, union wl_argument *args,
void
-wl_closure_invoke(struct wl_closure *closure,
+wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
struct wl_object *target, void (*func)(void), void *data)
{
int count;
@@ -870,7 +876,7 @@ wl_closure_invoke(struct wl_closure *closure,
ffi_types[1] = &ffi_type_pointer;
ffi_args[1] = ⌖
- convert_arguments_to_ffi(closure->message->signature, closure->args,
+ convert_arguments_to_ffi(closure->message->signature, flags, closure->args,
count, ffi_types + 2, ffi_args + 2);
ffi_prep_cif(&cif, FFI_DEFAULT_ABI,
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 3ead2ac..c5ad96d 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -836,7 +836,7 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
if (wl_debug)
wl_closure_print(closure, &proxy->object, false);
- wl_closure_invoke(closure, &proxy->object,
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_CLIENT, &proxy->object,
proxy->object.implementation[opcode],
proxy->user_data);
}
diff --git a/src/wayland-private.h b/src/wayland-private.h
index f0c9010..4b757a1 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -129,8 +129,13 @@ wl_connection_demarshal(struct wl_connection *connection,
int
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects);
+enum wl_closure_invoke_flag {
+ WL_CLOSURE_INVOKE_CLIENT = (1 << 0),
+ WL_CLOSURE_INVOKE_SERVER = (1 << 1)
+};
+
void
-wl_closure_invoke(struct wl_closure *closure,
+wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
struct wl_object *target, void (*func)(void), void *data);
int
wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 2f3ddc9..aaecf29 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -277,7 +277,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
if (wl_debug)
wl_closure_print(closure, object, false);
- wl_closure_invoke(closure, object,
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, object,
object->implementation[opcode], client);
wl_closure_destroy(closure);
diff --git a/tests/connection-test.c b/tests/connection-test.c
index 1ac88d2..d5b3a99 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -338,7 +338,7 @@ demarshal(struct marshal_data *data, const char *format,
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
assert(closure);
- wl_closure_invoke(closure, &object, func, data);
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_destroy(closure);
}
@@ -418,7 +418,7 @@ marshal_demarshal(struct marshal_data *data,
object.id = msg[0];
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
- wl_closure_invoke(closure, &object, func, data);
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_destroy(closure);
}
@@ -505,7 +505,7 @@ marshal_helper(const char *format, void *handler, ...)
assert(closure);
done = 0;
- wl_closure_invoke(closure, &object, handler, &done);
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, handler, &done);
wl_closure_destroy(closure);
assert(done);
}
diff --git a/tests/os-wrappers-test.c b/tests/os-wrappers-test.c
index 515fd81..ce6fda6 100644
--- a/tests/os-wrappers-test.c
+++ b/tests/os-wrappers-test.c
@@ -252,7 +252,7 @@ marshal_demarshal(struct marshal_data *data,
object.id = msg[0];
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
- wl_closure_invoke(closure, &object, func, data);
+ wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_destroy(closure);
}