mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
Track protocol object versions inside wl_proxy.
This provides a standardized mechanism for tracking protocol object versions in client code. The wl_display object is created with version 1. Every time an object is created from within wl_registry_bind, it gets the bound version. Every other time an object is created, it simply inherits it's version from the parent object that created it. (comments and minor reformatting added by Derek Foreman <derekf@osg.samsung.com>) Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Second trivial commit squashed into this one: Authored by Derek Foreman <derekf@osg.samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com> (it's literally one of code and a lot of comments) This sets wl_display's version (for proxy version query purposes) to 0. Any proxy created with unversioned API (this happens when a client compiled with old headers links against new wayland) will inherit this 0. This gives us a way for new libraries linked by old clients to realize they can't know a proxy's version. wl_display's version being unqueryable (always returning 0) is an acceptable side effect, since it's a special object you can't bind specific versions of anyway. Second half: Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
c6437817dd
commit
557032e36c
3 changed files with 173 additions and 15 deletions
|
|
@ -956,6 +956,14 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
|
|||
interface->name, interface->name, interface->name,
|
||||
interface->name);
|
||||
|
||||
printf("static inline uint32_t\n"
|
||||
"%s_get_version(struct %s *%s)\n"
|
||||
"{\n"
|
||||
"\treturn wl_proxy_get_version((struct wl_proxy *) %s);\n"
|
||||
"}\n\n",
|
||||
interface->name, interface->name, interface->name,
|
||||
interface->name);
|
||||
|
||||
has_destructor = 0;
|
||||
has_destroy = 0;
|
||||
wl_list_for_each(m, message_list, link) {
|
||||
|
|
@ -1027,21 +1035,31 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
|
|||
|
||||
printf(")\n"
|
||||
"{\n");
|
||||
if (ret) {
|
||||
if (ret && ret->interface_name == NULL) {
|
||||
/* an arg has type ="new_id" but interface is not
|
||||
* provided, such as in wl_registry.bind */
|
||||
printf("\tstruct wl_proxy *%s;\n\n"
|
||||
"\t%s = wl_proxy_marshal_constructor("
|
||||
"\t%s = wl_proxy_marshal_constructor_versioned("
|
||||
"(struct wl_proxy *) %s,\n"
|
||||
"\t\t\t %s_%s, ",
|
||||
"\t\t\t %s_%s, interface, version",
|
||||
ret->name, ret->name,
|
||||
interface->name,
|
||||
interface->uppercase_name,
|
||||
m->uppercase_name);
|
||||
|
||||
if (ret->interface_name == NULL)
|
||||
printf("interface");
|
||||
else
|
||||
printf("&%s_interface", ret->interface_name);
|
||||
} else if (ret) {
|
||||
/* Normal factory case, an arg has type="new_id" and
|
||||
* an interface is provided */
|
||||
printf("\tstruct wl_proxy *%s;\n\n"
|
||||
"\t%s = wl_proxy_marshal_constructor("
|
||||
"(struct wl_proxy *) %s,\n"
|
||||
"\t\t\t %s_%s, &%s_interface",
|
||||
ret->name, ret->name,
|
||||
interface->name,
|
||||
interface->uppercase_name,
|
||||
m->uppercase_name,
|
||||
ret->interface_name);
|
||||
} else {
|
||||
/* No args have type="new_id" */
|
||||
printf("\twl_proxy_marshal((struct wl_proxy *) %s,\n"
|
||||
"\t\t\t %s_%s",
|
||||
interface->name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue