diff --git a/protocol/wayland.xml b/protocol/wayland.xml index e1d11cbb..1db72d9e 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -66,7 +66,7 @@ server will always announce an object before the object sends out events. --> - + diff --git a/src/scanner.c b/src/scanner.c index 4cce8083..c03597cb 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -230,19 +230,27 @@ start_element(void *data, const char *element_name, const char **atts) else if (strcmp(type, "fd") == 0) arg->type = FD; else if (strcmp(type, "new_id") == 0) { - if (interface_name == NULL) - fail(ctx, "no interface name given"); arg->type = NEW_ID; arg->interface_name = strdup(interface_name); } else if (strcmp(type, "object") == 0) { - if (interface_name == NULL) - fail(ctx, "no interface name given"); arg->type = OBJECT; arg->interface_name = strdup(interface_name); } else { fail(ctx, "unknown type"); } + switch (arg->type) { + case NEW_ID: + case OBJECT: + if (interface_name == NULL) + fail(ctx, "no interface name given"); + break; + default: + if (interface_name != NULL) + fail(ctx, "interface no allowed"); + break; + } + wl_list_insert(ctx->message->arg_list.prev, &arg->link); ctx->message->arg_count++; } else if (strcmp(element_name, "enum") == 0) {