summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-09-12 14:17:43 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-09-18 12:13:30 +0000
commit54113bb70ccc2df74c55d881b543d13fd4eb9550 (patch)
tree0ecc667fa05df3d03f266fe55a0030c2a3d181a3
parentae4326db18b99630766e73c2f873eb883db2f493 (diff)
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 <paul.tvete@qt.io>
-rw-r--r--examples/wayland/server-buffer/compositor/sharebufferextension.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp2
-rw-r--r--src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h6
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager.cpp2
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp4
-rw-r--r--src/compositor/wayland_wrapper/qwlregion_p.h2
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp2
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp4
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp8
9 files changed, 16 insertions, 16 deletions
diff --git a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp b/examples/wayland/server-buffer/compositor/sharebufferextension.cpp
index 71731ed22..ecc57b571 100644
--- a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp
+++ b/examples/wayland/server-buffer/compositor/sharebufferextension.cpp
@@ -126,7 +126,7 @@ void ShareBufferExtension::share_buffer_bind_resource(Resource *resource)
for (auto *buffer : qAsConst(m_server_buffers)) {
qDebug() << "sending" << buffer << "to client";
- struct ::wl_client *client = resource->handle->client;
+ struct ::wl_client *client = wl_resource_get_client(resource->handle);
struct ::wl_resource *buffer_resource = buffer->resourceForClient(client);
send_cross_buffer(resource->handle, buffer_resource);
}
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index aa3b49b7a..e067eeafe 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -92,7 +92,7 @@ void QWaylandKeyboardPrivate::checkFocusResource(Resource *keyboardResource)
return;
// check if new wl_keyboard resource is from the client owning the focus surface
- if (focus->resource()->client == keyboardResource->client()) {
+ if (wl_resource_get_client(focus->resource()) == keyboardResource->client()) {
sendEnter(focus, keyboardResource);
focusResource = keyboardResource;
}
diff --git a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h
index dfd42535e..63817a5e3 100644
--- a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h
+++ b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h
@@ -73,7 +73,7 @@ namespace QtWaylandServer {
xdg_shell_v5 *xdg_shell_object;
struct ::wl_resource *handle;
- struct ::wl_client *client() const { return handle->client; }
+ struct ::wl_client *client() const { return wl_resource_get_client(handle); }
int version() const { return wl_resource_get_version(handle); }
static Resource *fromResource(struct ::wl_resource *resource);
@@ -193,7 +193,7 @@ namespace QtWaylandServer {
xdg_surface_v5 *xdg_surface_object;
struct ::wl_resource *handle;
- struct ::wl_client *client() const { return handle->client; }
+ struct ::wl_client *client() const { return wl_resource_get_client(handle); }
int version() const { return wl_resource_get_version(handle); }
static Resource *fromResource(struct ::wl_resource *resource);
@@ -366,7 +366,7 @@ namespace QtWaylandServer {
xdg_popup_v5 *xdg_popup_object;
struct ::wl_resource *handle;
- struct ::wl_client *client() const { return handle->client; }
+ struct ::wl_client *client() const { return wl_resource_get_client(handle); }
int version() const { return wl_resource_get_version(handle); }
static Resource *fromResource(struct ::wl_resource *resource);
diff --git a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
index d5c661e93..b4f3d6822 100644
--- a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
+++ b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
@@ -84,7 +84,7 @@ ClientBuffer *BufferManager::getBuffer(wl_resource *buffer_resource)
auto *destroy_listener = new buffer_manager_destroy_listener;
destroy_listener->d = this;
- wl_signal_add(&buffer_resource->destroy_signal, destroy_listener);
+ wl_resource_add_destroy_listener(buffer_resource, destroy_listener);
return newBuffer;
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index de62ffc3b..e30bc84f8 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -210,7 +210,7 @@ bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDevic
if (!m_compositorOwnsSelection)
return false;
- wl_client *client = clientDataDeviceResource->client;
+ wl_client *client = wl_resource_get_client(clientDataDeviceResource);
//qDebug("compositor offers %d types to %p", m_retainedData.formats().count(), client);
struct wl_resource *selectionOffer =
@@ -253,7 +253,7 @@ void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const
void DataDeviceManager::comp_receive(wl_client *client, wl_resource *resource, const char *mime_type, int32_t fd)
{
Q_UNUSED(client);
- DataDeviceManager *self = static_cast<DataDeviceManager *>(resource->data);
+ DataDeviceManager *self = static_cast<DataDeviceManager *>(wl_resource_get_user_data(resource));
//qDebug("client %p wants data for type %s from compositor", client, mime_type);
QByteArray content = QWaylandMimeHelper::getByteArray(&self->m_retainedData, QString::fromLatin1(mime_type));
if (!content.isEmpty()) {
diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h
index 00e1d239f..0a05a6733 100644
--- a/src/compositor/wayland_wrapper/qwlregion_p.h
+++ b/src/compositor/wayland_wrapper/qwlregion_p.h
@@ -70,7 +70,7 @@ public:
static Region *fromResource(struct ::wl_resource *resource);
- uint id() const { return resource()->handle->object.id; }
+ uint id() const { return wl_resource_get_id(resource()->handle); }
QRegion region() const { return m_region; }
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
index a02226a52..3cb01313b 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
@@ -184,7 +184,7 @@ wl_kms_buffer *Vsp2Layer::nextKmsBuffer()
struct wl_kms_buffer *kmsBuffer = wayland_kms_buffer_get(wlBuffer);
if (!kmsBuffer)
- qWarning() << "Failed to get wl_kms_buffer for wl_buffer:" << wlBuffer->object.id;
+ qWarning() << "Failed to get wl_kms_buffer for wl_buffer:" << wl_resource_get_id(wlBuffer);
return kmsBuffer;
}
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index ec1341e8a..f2e2d24de 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/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 *>(resource->data);\n");
+ printf(" return static_cast<Resource *>(wl_resource_get_user_data(resource));\n");
printf(" return nullptr;\n");
printf(" }\n");
diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp
index 077b8ee05..797c05c44 100644
--- a/tests/auto/client/shared/mockcompositor.cpp
+++ b/tests/auto/client/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<Compositor *>(compositorResource->data);
+ Compositor *compositor = static_cast<Compositor *>(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<struct wl_resource *>(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<Surface *> Compositor::surfaces() const