summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-05-11 13:07:21 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-05-11 13:14:50 +0200
commit3d69272f9cb0f5c37ac7855ceafe6a27bbf9b1b3 (patch)
tree00de678dde75e50bff4a78252d27558361da537e
parent3c5e3d213ef264d3debb01e39378e7db8db32b6a (diff)
scanner: Add enum argument typevisual
Use it for resize edges and visual type.
-rw-r--r--protocol/wayland.xml7
-rw-r--r--wayland/scanner.c21
-rw-r--r--wayland/wayland-client.c2
3 files changed, 24 insertions, 6 deletions
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index f46a9c5..cf52439 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -151,8 +151,7 @@
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="input_device" type="object" interface="wl_input_device"/>
<arg name="time" type="uint"/>
- <!-- edges is an enum, need to get the values in here -->
- <arg name="edges" type="uint"/>
+ <arg name="edges" type="enum" enum_name="resize"/>
</request>
<request name="create_drag">
@@ -171,7 +170,7 @@
received. -->
<event name="configure">
<arg name="time" type="uint"/>
- <arg name="edges" type="uint"/>
+ <arg name="edges" type="enum" enum_name="resize"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
@@ -460,7 +459,7 @@
the 'global' events. We need something better. -->
<interface name="wl_visual" version="1">
<event name="type">
- <arg name="type" type="uint"/>
+ <arg name="type" type="enum" enum_name="type" />
</event>
<enum name="type">
diff --git a/wayland/scanner.c b/wayland/scanner.c
index b6aebdb..32bd62d 100644
--- a/wayland/scanner.c
+++ b/wayland/scanner.c
@@ -86,6 +86,7 @@ enum arg_type {
UNSIGNED,
STRING,
OBJECT,
+ ENUM,
ARRAY,
FD
};
@@ -94,6 +95,7 @@ struct arg {
char *name;
enum arg_type type;
char *interface_name;
+ char *enum_name;
struct wl_list link;
};
@@ -151,13 +153,14 @@ start_element(void *data, const char *element_name, const char **atts)
struct arg *arg;
struct enumeration *enumeration;
struct entry *entry;
- const char *name, *type, *interface_name, *value;
+ const char *name, *type, *interface_name, *enum_name, *value;
int i, version;
name = NULL;
type = NULL;
version = 0;
interface_name = NULL;
+ enum_name = NULL;
value = NULL;
for (i = 0; atts[i]; i += 2) {
if (strcmp(atts[i], "name") == 0)
@@ -170,6 +173,8 @@ start_element(void *data, const char *element_name, const char **atts)
value = atts[i + 1];
if (strcmp(atts[i], "interface") == 0)
interface_name = atts[i + 1];
+ if (strcmp(atts[i], "enum_name") == 0)
+ enum_name = atts[i + 1];
}
if (strcmp(element_name, "protocol") == 0) {
@@ -245,6 +250,16 @@ start_element(void *data, const char *element_name, const char **atts)
fail(ctx, "no interface name given");
arg->type = OBJECT;
arg->interface_name = strdup(interface_name);
+ } else if (strcmp(type, "enum") == 0) {
+ if (enum_name == NULL)
+ fail(ctx, "no enum name given");
+
+ arg->type = ENUM;
+ arg->enum_name = strdup(enum_name);
+ arg->interface_name =
+ strdup(interface_name ?
+ interface_name : ctx->interface->name);
+
} else {
fail(ctx, "unknown type");
}
@@ -309,6 +324,9 @@ emit_type(struct arg *a)
case OBJECT:
printf("struct %s *", a->interface_name);
break;
+ case ENUM:
+ printf("enum %s_%s ", a->interface_name, a->enum_name);
+ break;
case ARRAY:
printf("struct wl_array *");
break;
@@ -623,6 +641,7 @@ emit_messages(struct wl_list *message_list,
case NEW_ID:
printf("n");
break;
+ case ENUM:
case UNSIGNED:
printf("u");
break;
diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c
index 1adeeba..f8f4510 100644
--- a/wayland/wayland-client.c
+++ b/wayland/wayland-client.c
@@ -209,7 +209,7 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
}
static void
-wl_visual_type(void *data, struct wl_visual *visual, unsigned int type)
+wl_visual_type(void *data, struct wl_visual *visual, enum wl_visual_type type)
{
struct wl_display *display = data;