summaryrefslogtreecommitdiffstats
path: root/src/compositor/global
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-04-09 16:52:59 +0200
committerJørgen Lind <jorgen.lind@digia.com>2013-04-17 09:39:21 +0200
commit82d52cdae8bb5c328db68123cb16d9d1fe4efb81 (patch)
tree58429ba7ec7cf33d520c28765ebb216d9415e620 /src/compositor/global
parent05d054ad7207764293525661876ebc689940a15c (diff)
Adapted code to use qtwaylandscanner.
We include the wayland.xml since we need to generate bindings for the core protocol as well. Also, WAYLANDSOURCES has been split into WAYLANDSERVERSOURCES and WAYLANDCLIENTSOURCES since we need to produce different output in the server and client cases. Change-Id: I0bd493d41ca6b26dfd2d9b1463d4b762786537f9 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/compositor/global')
-rw-r--r--src/compositor/global/qwaylandresourcecollection.cpp20
-rw-r--r--src/compositor/global/qwaylandresourcecollection.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/src/compositor/global/qwaylandresourcecollection.cpp b/src/compositor/global/qwaylandresourcecollection.cpp
index 6433474a3..cc20e628f 100644
--- a/src/compositor/global/qwaylandresourcecollection.cpp
+++ b/src/compositor/global/qwaylandresourcecollection.cpp
@@ -46,6 +46,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
+struct wl_resource *resourceForClient(const struct wl_list *list, struct wl_client *client)
+{
+ struct wl_resource *resource;
+ wl_list_for_each(resource, list, link) {
+ if (resource->client == client) {
+ return resource;
+ }
+ }
+ return 0;
+}
+
ResourceCollection::ResourceCollection()
{
wl_list_init(&client_resources);
@@ -66,14 +77,7 @@ void ResourceCollection::registerResource(struct wl_resource *resource)
struct wl_resource *ResourceCollection::resourceForClient(wl_client *client) const
{
- struct wl_resource *resource;
- wl_list_for_each(resource,&client_resources, link) {
- if (resource->client == client) {
- return resource;
- }
- }
- return 0;
-
+ return QtWayland::resourceForClient(&client_resources, client);
}
bool ResourceCollection::resourceListIsEmpty() const
diff --git a/src/compositor/global/qwaylandresourcecollection.h b/src/compositor/global/qwaylandresourcecollection.h
index cfc1c32cb..61df0f1d7 100644
--- a/src/compositor/global/qwaylandresourcecollection.h
+++ b/src/compositor/global/qwaylandresourcecollection.h
@@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
+struct wl_resource *resourceForClient(const struct wl_list *list, struct wl_client *client);
+
class ResourceCollection
{
public: