Allocate client proxy automatically for new objects

When the server send a new object ID, the client used to have to allocate
the proxy manually and without type-safety.  We now allocate the proxy
in a client-side post-processing step on the incoming closure.
This commit is contained in:
Kristian Høgsberg 2012-06-28 22:01:58 -04:00
parent c30ad0d9da
commit 9de9e39f87
4 changed files with 57 additions and 4 deletions

View file

@ -178,6 +178,25 @@ wl_resource_post_error(struct wl_resource *resource,
WL_DISPLAY_ERROR, resource, code, buffer);
}
static void
deref_new_objects(struct wl_closure *closure)
{
const char *signature;
int i;
signature = closure->message->signature;
for (i = 0; signature[i]; i++) {
switch (signature[i]) {
case 'n':
closure->args[i + 2] = *(uint32_t **) closure->args[i + 2];
closure->types[i] = &ffi_type_uint32;
break;
}
}
}
static int
wl_client_connection_data(int fd, uint32_t mask, void *data)
{
@ -247,6 +266,8 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
break;
}
deref_new_objects(closure);
if (wl_debug)
wl_closure_print(closure, object, false);