Commit 35be5a7c authored by Jonas Ådahl's avatar Jonas Ådahl Committed by Kristian Høgsberg
Browse files

scanner: Generate macros for getting the 'since' version of an event

This could be useful for compositors who need to be able to not send
events if the client bound a version lower than the newest provided.

Event version numbers are exposed as
[INTERFACE_NAME]_[EVENT_NAME]_SINCE_VERSION for example wl_output.scale
will have the version macro WL_OUTPUT_SCALE_SINCE_VERSION.
Signed-off-by: Jonas Ådahl's avatarJonas Ådahl <>
parent e2b12184
......@@ -578,6 +578,18 @@ emit_opcodes(struct wl_list *message_list, struct interface *interface)
static void
emit_opcode_versions(struct wl_list *message_list, struct interface *interface)
struct message *m;
wl_list_for_each(m, message_list, link)
printf("#define %s_%s_SINCE_VERSION\t%d\n",
interface->uppercase_name, m->uppercase_name, m->since);
static void
emit_type(struct arg *a)
......@@ -1004,6 +1016,7 @@ emit_header(struct protocol *protocol, int server)
if (server) {
emit_structs(&i->request_list, i);
emit_opcodes(&i->event_list, i);
emit_opcode_versions(&i->event_list, i);
emit_event_wrappers(&i->event_list, i);
} else {
emit_structs(&i->event_list, i);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment