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

@ -375,6 +375,7 @@ wl_message_size_extra(const struct wl_message *message)
switch (message->signature[i]) {
case 's':
case 'o':
case 'n':
extra += sizeof (void *);
break;
case 'a':
@ -574,7 +575,7 @@ wl_connection_demarshal(struct wl_connection *connection,
struct wl_map *objects,
const struct wl_message *message)
{
uint32_t *p, *next, *end, length;
uint32_t *p, *next, *end, length, **id;
int *fd;
char *extra, **s;
unsigned int i, count, extra_space;
@ -690,8 +691,12 @@ wl_connection_demarshal(struct wl_connection *connection,
p++;
break;
case 'n':
closure->types[i] = &ffi_type_uint32;
closure->args[i] = p;
closure->types[i] = &ffi_type_pointer;
id = (uint32_t **) extra;
extra += sizeof *id;
closure->args[i] = id;
*id = p;
object = wl_map_lookup(objects, *p);
if (object != NULL) {
printf("not a new object (%d), "