[waffle] [PATCH] wayland: Wrap wl_proxy_marshal_constructor_versioned v2

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 15 22:04:52 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Fixes build failure due to wl_proxy_marshal_constructor_versioned being
unresolved when building against current wayland.

This API was introduced in wayland 1.9.91 by commit 557032e3 ("Track
protocol object versions inside wl_proxy."). The waffle code doesn't
reference wl_proxy_marshal_constructor_versioned directly but
indirectly via wayland-scanner.

v2:
* Add paragraph about how wl_proxy_marshal_constructor_versioned was
  introduced. (Emil Velikov)
* Only resolve wl_proxy_marshal_constructor_versioned with wayland >=
  1.9.91.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

v3:
* Always resolve wl_proxy_marshal_constructor_versioned, yet do not
error out if it's missing.

Cc: Jason Ekstrand <jason at jlekstrand.net>
Cc: Chad Versace <chad.versace at intel.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---

Gents, I've taken the liberty to update Michel patch with what I have in 
mind. Why ? I'm wondering if some of the things mentioned are not 
getting across, and as we all know 'a patch speaks a thousand words'

-Emil

 src/waffle/wayland/wayland_wrapper.c | 8 ++++++++
 src/waffle/wayland/wayland_wrapper.h | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/waffle/wayland/wayland_wrapper.c b/src/waffle/wayland/wayland_wrapper.c
index 6ffd5a9..d08e3b5 100644
--- a/src/waffle/wayland/wayland_wrapper.c
+++ b/src/waffle/wayland/wayland_wrapper.c
@@ -106,6 +106,14 @@ wayland_wrapper_init(void)
     RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
     RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
     RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
+
+#define OPTIONAL_WL_CLIENT_SYMBOL(S)                            \
+    wfl_##S = (__typeof__(wfl_##S))dlsym(dl_wl_client, #S);
+
+    // Introduced with Wayland 1.10. Used over wl_proxy_marshal_constructor
+    OPTIONAL_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
+
+#undef OPTIONAL_WL_CLIENT_SYMBOL
 #undef RETRIEVE_WL_CLIENT_SYMBOL
 
 error:
diff --git a/src/waffle/wayland/wayland_wrapper.h b/src/waffle/wayland/wayland_wrapper.h
index 40a581a..3282587 100644
--- a/src/waffle/wayland/wayland_wrapper.h
+++ b/src/waffle/wayland/wayland_wrapper.h
@@ -75,6 +75,13 @@ struct wl_proxy *
                                     const struct wl_interface *interface,
                                     ...);
 
+struct wl_proxy *
+(*wfl_wl_proxy_marshal_constructor_versioned)(struct wl_proxy *proxy,
+					      uint32_t opcode,
+					      const struct wl_interface *interface,
+					      uint32_t version,
+					      ...);
+
 #ifdef _WAYLAND_CLIENT_H
 #error Do not include wayland-client.h ahead of wayland_wrapper.h
 #endif
@@ -92,3 +99,4 @@ struct wl_proxy *
 #define wl_proxy_add_listener (*wfl_wl_proxy_add_listener)
 #define wl_proxy_marshal (*wfl_wl_proxy_marshal)
 #define wl_proxy_marshal_constructor (*wfl_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned (*wfl_wl_proxy_marshal_constructor_versioned)
-- 
2.8.0



More information about the waffle mailing list