<div dir="ltr"><div><div>Remi,<br></div>While this would probably be nice, your approach isn't going to work. The version provided in wl_interface is the version that was compiled into libwayland, not the version requested when the global was bound. In order to get this correct, it requires a bit more tracking. I did implement this a while ago but it never got merged. You can find it here:<br><br><a href="http://lists.freedesktop.org/archives/wayland-devel/2014-April/014004.html">http://lists.freedesktop.org/archives/wayland-devel/2014-April/014004.html</a><br><br></div>--Jason Ekstrand<br><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 5, 2014 at 2:02 AM, Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:remi@remlab.net" target="_blank">remi@remlab.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In some scenarii, a component will obtain a reference to a proxy<br>
object created by another component. It may then be necessary to<br>
check the interface version of the proxy object at run-time to<br>
determine if a certain interface request is supported by the proxy<br>
object.<br>
<br>
For instance, a media player GUI can pass a wl_surface to a video<br>
playback library. If the video is rotated, the library will want to<br>
use wl_surface.set_buffer_transform, which is only available in<br>
version 2 of wl_surface.<br>
<br>
Signed-off-by: Rémi Denis-Courmont <<a href="mailto:remi@remlab.net">remi@remlab.net</a>><br>
---<br>
src/wayland-client.c | 13 +++++++++++++<br>
src/wayland-client.h | 1 +<br>
2 files changed, 14 insertions(+)<br>
<br>
diff --git a/src/wayland-client.c b/src/wayland-client.c<br>
index b0f77b9..51216ae 100644<br>
--- a/src/wayland-client.c<br>
+++ b/src/wayland-client.c<br>
@@ -1721,6 +1721,19 @@ wl_proxy_get_class(struct wl_proxy *proxy)<br>
return proxy->object.interface->name;<br>
}<br>
<br>
+/** Get the interface version of a proxy object<br>
+ *<br>
+ * \param proxy The proxy object<br>
+ * \return The interface version of the object associated with the proxy<br>
+ *<br>
+ * \memberof wl_proxy<br>
+ */<br>
+WL_EXPORT uint32_t<br>
+wl_proxy_get_version(struct wl_proxy *proxy)<br>
+{<br>
+ return proxy->object.interface->version;<br>
+}<br>
+<br>
/** Assign a proxy to an event queue<br>
*<br>
* \param proxy The proxy object<br>
diff --git a/src/wayland-client.h b/src/wayland-client.h<br>
index 0801a81..60d87e6 100644<br>
--- a/src/wayland-client.h<br>
+++ b/src/wayland-client.h<br>
@@ -146,6 +146,7 @@ void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);<br>
void *wl_proxy_get_user_data(struct wl_proxy *proxy);<br>
uint32_t wl_proxy_get_id(struct wl_proxy *proxy);<br>
const char *wl_proxy_get_class(struct wl_proxy *proxy);<br>
+uint32_t wl_proxy_get_version(struct wl_proxy *proxy);<br>
void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue);<br>
<br>
#include "wayland-client-protocol.h"<br>
<span class=""><font color="#888888">--<br>
2.1.1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div></div></div></div></div>