From b332630c86014eada07990acf66c13e000b3482b Mon Sep 17 00:00:00 2001
From: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Date: Wed, 11 Jun 2014 13:43:58 +0300
Subject: [PATCH] Fix generated code for interface names not starting with qt_
 or wl_

The generated code for an interface without a qt_ or wl_ prefix was
broken, and could not compile.
This commit needs a 'make clean' to let qtwaylandscanner run again.

Change-Id: Id9c7e3f87385f83eeffd1e8718c854a405f411f0
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
---
 src/compositor/wayland_wrapper/qwldataoffer.cpp        |  2 +-
 src/compositor/wayland_wrapper/qwldatasource.cpp       |  2 +-
 src/compositor/wayland_wrapper/qwlextendedoutput.cpp   |  2 +-
 src/compositor/wayland_wrapper/qwlinputdevice_p.h      |  2 +-
 src/compositor/wayland_wrapper/qwlregion.cpp           |  2 +-
 src/compositor/wayland_wrapper/qwlsurface.cpp          |  2 +-
 .../compositor/xcomposite_share/xcompositebuffer.h     |  2 +-
 src/qtwaylandscanner/qtwaylandscanner.cpp              | 10 +++++-----
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp
index 7099a171f..312e53858 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer.cpp
+++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp
@@ -55,7 +55,7 @@ DataOffer::DataOffer(DataSource *dataSource, QtWaylandServer::wl_data_device::Re
     , m_dataSource(dataSource)
 {
     // FIXME: connect to dataSource and reset m_dataSource on destroy
-    target->data_device->send_data_offer(target->handle, resource()->handle);
+    target->data_device_object->send_data_offer(target->handle, resource()->handle);
     Q_FOREACH (const QString &mimeType, dataSource->mimeTypes()) {
         send_offer(mimeType);
     }
diff --git a/src/compositor/wayland_wrapper/qwldatasource.cpp b/src/compositor/wayland_wrapper/qwldatasource.cpp
index c0791d417..679693c32 100644
--- a/src/compositor/wayland_wrapper/qwldatasource.cpp
+++ b/src/compositor/wayland_wrapper/qwldatasource.cpp
@@ -105,7 +105,7 @@ void DataSource::setDevice(DataDevice *device)
 
 DataSource *DataSource::fromResource(struct ::wl_resource *resource)
 {
-    return static_cast<DataSource *>(Resource::fromResource(resource)->data_source);
+    return static_cast<DataSource *>(Resource::fromResource(resource)->data_source_object);
 }
 
 void DataSource::data_source_offer(Resource *, const QString &mime_type)
diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
index e376e0b48..eb2de318a 100644
--- a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
+++ b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
@@ -115,7 +115,7 @@ void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
         sendOperation = QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
     }
 
-    extended_output->send_set_screen_rotation(handle, sendOperation);
+    extended_output_object->send_set_screen_rotation(handle, sendOperation);
 }
 
 }
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h
index f98a43927..35a2224b9 100644
--- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h
+++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h
@@ -120,7 +120,7 @@ public:
 
     static InputDevice *fromSeatResource(struct ::wl_resource *resource)
     {
-        return static_cast<InputDevice *>(wl_seat::Resource::fromResource(resource)->seat);
+        return static_cast<InputDevice *>(wl_seat::Resource::fromResource(resource)->seat_object);
     }
 
     QWaylandInputDevice::CapabilityFlags capabilities() { return m_capabilities; }
diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp
index 69f382404..fdbc5390d 100644
--- a/src/compositor/wayland_wrapper/qwlregion.cpp
+++ b/src/compositor/wayland_wrapper/qwlregion.cpp
@@ -57,7 +57,7 @@ Region::~Region()
 
 Region *Region::fromResource(struct ::wl_resource *resource)
 {
-    return static_cast<Region *>(Resource::fromResource(resource)->region);
+    return static_cast<Region *>(Resource::fromResource(resource)->region_object);
 }
 
 void Region::region_destroy_resource(Resource *)
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 437789adb..919e517dc 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -151,7 +151,7 @@ void Surface::releaseSurfaces()
 
 Surface *Surface::fromResource(struct ::wl_resource *resource)
 {
-    return static_cast<Surface *>(Resource::fromResource(resource)->surface);
+    return static_cast<Surface *>(Resource::fromResource(resource)->surface_object);
 }
 
 QWaylandSurface::Type Surface::type() const
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
index 20cf399b6..a50c69009 100644
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
+++ b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
@@ -68,7 +68,7 @@ public:
 
     QSize size() const { return mSize; }
 
-    static XCompositeBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<XCompositeBuffer*>(Resource::fromResource(resource)->buffer); }
+    static XCompositeBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<XCompositeBuffer*>(Resource::fromResource(resource)->buffer_object); }
 
 protected:
     void buffer_destroy_resource(Resource *) Q_DECL_OVERRIDE;
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 097813f3c..5ffb52f4e 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -425,10 +425,10 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
             printf("        class Resource\n");
             printf("        {\n");
             printf("        public:\n");
-            printf("            Resource() : %s(0), handle(0) {}\n", interfaceNameStripped);
+            printf("            Resource() : %s_object(0), handle(0) {}\n", interfaceNameStripped);
             printf("            virtual ~Resource() {}\n");
             printf("\n");
-            printf("            %s *%s;\n", interfaceName, interfaceNameStripped);
+            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");
@@ -636,7 +636,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
             printf("    void %s::destroy_func(struct ::wl_resource *client_resource)\n", interfaceName);
             printf("    {\n");
             printf("        Resource *resource = Resource::fromResource(client_resource);\n");
-            printf("        %s *that = resource->%s;\n", interfaceName, interfaceNameStripped);
+            printf("        %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped);
             printf("        that->m_resource_map.remove(resource->client(), resource);\n");
             printf("        that->%s_destroy_resource(resource);\n", interfaceNameStripped);
             printf("        delete resource;\n");
@@ -655,7 +655,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
             printf("    %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName);
             printf("    {\n");
             printf("        Resource *resource = %s_allocate();\n", interfaceNameStripped);
-            printf("        resource->%s = this;\n", interfaceNameStripped);
+            printf("        resource->%s_object = this;\n", interfaceNameStripped);
             printf("\n");
             printf("        struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, ::%s_interface.version, id);\n", interfaceName, interfaceName);
             printf("        wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData());
@@ -699,7 +699,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
                     printf("    {\n");
                     printf("        Q_UNUSED(client);\n");
                     printf("        Resource *r = Resource::fromResource(resource);\n");
-                    printf("        static_cast<%s *>(r->%s)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData());
+                    printf("        static_cast<%s *>(r->%s_object)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData());
                     printf("            r");
                     for (int i = 0; i < e.arguments.size(); ++i) {
                         printf(",\n");
-- 
GitLab