From dac4fcd9b03e2f4ac5e07cf36fcdd06951ab955e Mon Sep 17 00:00:00 2001
From: Olivier Blin <olivier.blin@softathome.com>
Date: Fri, 28 Nov 2014 11:41:36 +0100
Subject: [PATCH] Fix build without OpenGL

Also fix a comment alongside.

Change-Id: I0091a89ff8e7ed46e769ea47a0225bc87db2c1f5
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
---
 src/compositor/wayland_wrapper/qwlcompositor.cpp    |  8 +++++++-
 src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h | 12 ++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index 2fd91f30d..f057542ca 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -89,9 +89,11 @@
 
 #include <wayland-server.h>
 
+#if defined (QT_COMPOSITOR_WAYLAND_GL)
 #include "hardware_integration/qwlhwintegration_p.h"
 #include "hardware_integration/qwlclientbufferintegration_p.h"
 #include "hardware_integration/qwlserverbufferintegration_p.h"
+#endif
 #include "windowmanagerprotocol/waylandwindowmanagerintegration_p.h"
 
 #include "hardware_integration/qwlclientbufferintegrationfactory_p.h"
@@ -470,6 +472,7 @@ void Compositor::bindGlobal(wl_client *client, void *data, uint32_t version, uin
 
 void Compositor::loadClientBufferIntegration()
 {
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     QStringList keys = ClientBufferIntegrationFactory::keys();
     QString targetKey;
     QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION");
@@ -491,11 +494,13 @@ void Compositor::loadClientBufferIntegration()
                 m_hw_integration->setClientBufferIntegration(targetKey);
         }
     }
-    //BUG: if there is no client buffer integration, bad things will when opengl is used
+    //BUG: if there is no client buffer integration, bad things will happen when opengl is used
+#endif
 }
 
 void Compositor::loadServerBufferIntegration()
 {
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     QStringList keys = ServerBufferIntegrationFactory::keys();
     QString targetKey;
     QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
@@ -507,6 +512,7 @@ void Compositor::loadServerBufferIntegration()
         if (m_hw_integration)
             m_hw_integration->setServerBufferIntegration(targetKey);
     }
+#endif
 }
 
 void Compositor::registerInputDevice(QWaylandInputDevice *device)
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index 8e07068bc..580e71d0b 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -95,7 +95,12 @@ public:
     bool isDestroyed() { return m_destroyed; }
 
     void createTexture();
+#ifdef QT_COMPOSITOR_WAYLAND_GL
     inline GLuint texture() const;
+#else
+    inline uint texture() const;
+#endif
+
     void destroyTexture();
 
     inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
@@ -150,12 +155,19 @@ private:
     friend class ::QWaylandBufferRef;
 };
 
+#ifdef QT_COMPOSITOR_WAYLAND_GL
 GLuint SurfaceBuffer::texture() const
 {
     if (m_buffer)
         return m_texture;
     return 0;
 }
+#else
+uint SurfaceBuffer::texture() const
+{
+    return 0;
+}
+#endif
 
 }
 
-- 
GitLab