Re: [PATCH wayland 6/6] scanner: Generate macros for getting the 'since' version of an event

2014-05-09 Thread Kristian Høgsberg
On Thu, May 08, 2014 at 11:39:49PM +0200, Jonas Ådahl wrote:
 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.

Yeah, that's a little more readable I guess.  This and previous patches
applied, thanks.

Kristian

 
 Signed-off-by: Jonas Ådahl jad...@gmail.com
 ---
  src/scanner.c | 13 +
  1 file changed, 13 insertions(+)
 
 diff --git a/src/scanner.c b/src/scanner.c
 index 28fadb0..80c466e 100644
 --- a/src/scanner.c
 +++ b/src/scanner.c
 @@ -579,6 +579,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);
 +
 + printf(\n);
 +}
 +
 +static void
  emit_type(struct arg *a)
  {
   switch (a-type) {
 @@ -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);
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH wayland 6/6] scanner: Generate macros for getting the 'since' version of an event

2014-05-08 Thread Jonas Ådahl
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 jad...@gmail.com
---
 src/scanner.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/scanner.c b/src/scanner.c
index 28fadb0..80c466e 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -579,6 +579,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);
+
+   printf(\n);
+}
+
+static void
 emit_type(struct arg *a)
 {
switch (a-type) {
@@ -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);
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel