From 2f9379552c1165bdc7c49019901d67fb0bb3072a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 14:17:43 +0200 Subject: [PATCH] Don't use members of wl_resource When we switch to only including core wayland headers, wl_resource will be an opaque type. Use the getters and setter functions instead. Task-number: QTBUG-70553 Change-Id: I7d84d48a4ee3586f231a331cd15716686dcee775 Reviewed-by: Paul Olav Tvete --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 ++-- tests/auto/wayland/shared/mockcompositor.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index ec1341e8ac1..f2e2d24de5e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -506,7 +506,7 @@ bool Scanner::process() printf(" %s *%s_object;\n", interfaceName, interfaceNameStripped); printf(" struct ::wl_resource *handle;\n"); printf("\n"); - printf(" struct ::wl_client *client() const { return handle->client; }\n"); + printf(" struct ::wl_client *client() const { return wl_resource_get_client(handle); }\n"); printf(" int version() const { return wl_resource_get_version(handle); }\n"); printf("\n"); printf(" static Resource *fromResource(struct ::wl_resource *resource);\n"); @@ -806,7 +806,7 @@ bool Scanner::process() printf(" if (Q_UNLIKELY(!resource))\n"); printf(" return nullptr;\n"); printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData()); - printf(" return static_cast(resource->data);\n"); + printf(" return static_cast(wl_resource_get_user_data(resource));\n"); printf(" return nullptr;\n"); printf(" }\n"); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 077b8ee05de..797c05c44ec 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -400,7 +400,7 @@ void Compositor::dispatchEvents(int timeout) static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) { - Compositor *compositor = static_cast(compositorResource->data); + Compositor *compositor = static_cast(wl_resource_get_user_data(compositorResource)); compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); } @@ -425,18 +425,18 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_ static void unregisterResourceCallback(wl_listener *listener, void *data) { struct wl_resource *resource = reinterpret_cast(data); - wl_list_remove(&resource->link); + wl_list_remove(wl_resource_get_link(resource)); delete listener; } void registerResource(wl_list *list, wl_resource *resource) { - wl_list_insert(list, &resource->link); + wl_list_insert(list, wl_resource_get_link(resource)); wl_listener *listener = new wl_listener; listener->notify = unregisterResourceCallback; - wl_signal_add(&resource->destroy_signal, listener); + wl_resource_add_destroy_listener(resource, listener); } QVector Compositor::surfaces() const