Build the QNX plugin with -no-opengl enabled.
authorStephen Kelly <stephen.kelly.qnx@kdab.com>
Wed, 18 Apr 2012 13:07:23 +0000 (15:07 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 23 Apr 2012 15:04:04 +0000 (17:04 +0200)
Change-Id: I776a3eb0d7ada4399b8c191bbfa1e3ed9236b20e
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
src/plugins/platforms/qnx/qnx.pro
src/plugins/platforms/qnx/qqnxintegration.cpp
src/plugins/platforms/qnx/qqnxintegration.h
src/plugins/platforms/qnx/qqnxwindow.cpp
src/plugins/platforms/qnx/qqnxwindow.h

index 04e3b43..940c463 100644 (file)
@@ -2,7 +2,11 @@ TARGET = qnx
 include(../../qpluginbase.pri)
 
 QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
-QT += opengl opengl-private platformsupport platformsupport-private widgets-private
+QT += platformsupport platformsupport-private widgets-private
+
+contains(QT_CONFIG, opengles2) {
+    QT += opengl opengl-private
+}
 
 # Uncomment this to build with support for IMF once it becomes available in the BBNDK
 #CONFIG += qqnx_imf
@@ -28,8 +32,6 @@ QT += opengl opengl-private platformsupport platformsupport-private widgets-priv
 SOURCES =   main.cpp \
             qqnxbuffer.cpp \
             qqnxeventthread.cpp \
-            qqnxglcontext.cpp \
-            qqnxglbackingstore.cpp \
             qqnxintegration.cpp \
             qqnxscreen.cpp \
             qqnxwindow.cpp \
@@ -46,13 +48,16 @@ CONFIG(blackberry) {
                qqnxabstractvirtualkeyboard.cpp
 }
 
+contains(QT_CONFIG, opengles2) {
+    SOURCES += qqnxglcontext.cpp \
+               qqnxglbackingstore.cpp
+}
+
 HEADERS =   main.h \
             qqnxbuffer.h \
             qqnxeventthread.h \
             qqnxkeytranslator.h \
             qqnxintegration.h \
-            qqnxglcontext.h \
-            qqnxglbackingstore.h \
             qqnxscreen.h \
             qqnxwindow.h \
             qqnxrasterbackingstore.h \
@@ -68,6 +73,11 @@ CONFIG(blackberry) {
                qqnxabstractvirtualkeyboard.h
 }
 
+contains(QT_CONFIG, opengles2) {
+    HEADERS += qqnxglcontext.h \
+               qqnxglbackingstore.h
+}
+
 
 CONFIG(blackberry) {
     SOURCES += qqnxservices.cpp
@@ -87,7 +97,11 @@ OTHER_FILES += qnx.json
 
 QMAKE_CXXFLAGS += -I./private
 
-LIBS += -lscreen -lEGL
+LIBS += -lscreen
+
+contains(QT_CONFIG, opengles2) {
+    LIBS += -lEGL
+}
 
 CONFIG(blackberry) {
     LIBS += -lbps -lpps -lclipboard
index 683daee..8a99155 100644 (file)
 
 #include "qqnxintegration.h"
 #include "qqnxeventthread.h"
-#include "qqnxglbackingstore.h"
-#include "qqnxglcontext.h"
 #include "qqnxnativeinterface.h"
 #include "qqnxrasterbackingstore.h"
 #include "qqnxscreen.h"
 #include "qqnxscreeneventhandler.h"
 #include "qqnxwindow.h"
-#include "qqnxglcontext.h"
 
 #ifdef Q_OS_BLACKBERRY
 #include "qqnxnavigatoreventhandler.h"
 
 #include <QtGui/QPlatformWindow>
 #include <QtGui/QWindowSystemInterface>
+
+#ifndef QT_NO_OPENGL
+#include "qqnxglbackingstore.h"
+#include "qqnxglcontext.h"
+
 #include <QtGui/QOpenGLContext>
+#endif
 
 #include <QtCore/QDebug>
 #include <QtCore/QHash>
@@ -92,7 +95,9 @@ QQnxIntegration::QQnxIntegration()
     , m_services(0)
 #endif
     , m_fontDatabase(new QGenericUnixFontDatabase())
+#ifndef QT_NO_OPENGL
     , m_paintUsingOpenGL(false)
+#endif
     , m_eventDispatcher(createUnixEventDispatcher())
     , m_nativeInterface(new QQnxNativeInterface())
     , m_screenEventHandler(new QQnxScreenEventHandler())
@@ -122,8 +127,10 @@ QQnxIntegration::QQnxIntegration()
     // Create displays for all possible screens (which may not be attached)
     createDisplays();
 
+#ifndef QT_NO_OPENGL
     // Initialize global OpenGL resources
     QQnxGLContext::initialize();
+#endif
 
     // Create/start event thread
     m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
@@ -185,8 +192,10 @@ QQnxIntegration::~QQnxIntegration()
     // Close connection to QNX composition manager
     screen_destroy_context(m_screenContext);
 
+#ifndef QT_NO_OPENGL
     // Cleanup global OpenGL resources
     QQnxGLContext::shutdown();
+#endif
 
     // Destroy services class
 #ifdef Q_OS_BLACKBERRY
@@ -226,12 +235,15 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind
 #if defined(QQNXINTEGRATION_DEBUG)
     qDebug() << Q_FUNC_INFO;
 #endif
+#ifndef QT_NO_OPENGL
     if (paintUsingOpenGL())
         return new QQnxGLBackingStore(window);
     else
+#endif
         return new QQnxRasterBackingStore(window);
 }
 
+#ifndef QT_NO_OPENGL
 QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
 {
 #if defined(QQNXINTEGRATION_DEBUG)
@@ -239,6 +251,7 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont
 #endif
     return new QQnxGLContext(context);
 }
+#endif
 
 #ifdef Q_OS_BLACKBERRY
 QPlatformInputContext *QQnxIntegration::inputContext() const
index 3207b9c..b46c406 100644 (file)
@@ -81,7 +81,10 @@ public:
 
     QPlatformWindow *createPlatformWindow(QWindow *window) const;
     QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+
+#ifndef QT_NO_OPENGL
     QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+#endif
 
 #ifdef Q_OS_BLACKBERRY
     QPlatformInputContext *inputContext() const;
@@ -101,7 +104,9 @@ public:
 
     QVariant styleHint(StyleHint hint) const;
 
+#ifndef QT_NO_OPENGL
     bool paintUsingOpenGL() const { return m_paintUsingOpenGL; }
+#endif
 
 #ifdef Q_OS_BLACKBERRY
     QPlatformServices *services() const;
@@ -127,7 +132,9 @@ private:
     QQnxServices *m_services;
 #endif
     QPlatformFontDatabase *m_fontDatabase;
+#ifndef QT_NO_OPENGL
     bool m_paintUsingOpenGL;
+#endif
     QAbstractEventDispatcher *m_eventDispatcher;
     QQnxNativeInterface *m_nativeInterface;
     QList<QQnxScreen*> m_screens;
index 85c3e49..e37c827 100644 (file)
@@ -40,7 +40,9 @@
 ****************************************************************************/
 
 #include "qqnxwindow.h"
+#ifndef QT_NO_OPENGL
 #include "qqnxglcontext.h"
+#endif
 #include "qqnxintegration.h"
 #include "qqnxscreen.h"
 
@@ -59,7 +61,9 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
       m_window(0),
       m_currentBufferIndex(-1),
       m_previousBufferIndex(-1),
+#ifndef QT_NO_OPENGL
       m_platformOpenGLContext(0),
+#endif
       m_screen(0),
       m_parentWindow(0),
       m_visible(true)
@@ -301,6 +305,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
 
     // Create window buffers if they do not exist
     if (!hasBuffers()) {
+#ifndef QT_NO_OPENGL
         // Get pixel format from EGL config if using OpenGL;
         // otherwise inherit pixel format of window's screen
         if (m_platformOpenGLContext != 0) {
@@ -308,6 +313,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
         } else {
             val[0] = m_screen->nativeFormat();
         }
+#endif
 
         errno = 0;
         result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
@@ -553,12 +559,14 @@ void QQnxWindow::gainedFocus()
     QWindowSystemInterface::handleWindowActivated(window());
 }
 
+#ifndef QT_NO_OPENGL
 void QQnxWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext)
 {
     // This function does not take ownership of the platform gl context.
     // It is owned by the frontend QOpenGLContext
     m_platformOpenGLContext = platformOpenGLContext;
 }
+#endif
 
 QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle)
 {
index fc27c12..2ea7bbc 100644 (file)
@@ -48,7 +48,9 @@
 
 #include <QtGui/QImage>
 
+#ifndef QT_NO_OPENGL
 #include <EGL/egl.h>
+#endif
 
 #include <screen/screen.h>
 
@@ -57,7 +59,9 @@ QT_BEGIN_NAMESPACE
 // all surfaces double buffered
 #define MAX_BUFFER_COUNT    2
 
+#ifndef QT_NO_OPENGL
 class QQnxGLContext;
+#endif
 class QQnxScreen;
 
 class QSurfaceFormat;
@@ -98,8 +102,10 @@ public:
     QQnxScreen *screen() const { return m_screen; }
     const QList<QQnxWindow*>& children() const { return m_childWindows; }
 
+#ifndef QT_NO_OPENGL
     void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext);
     QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
+#endif
 
     QQnxWindow *findWindow(screen_window_t windowHandle);
 
@@ -124,7 +130,9 @@ private:
     QRegion m_previousDirty;
     QRegion m_scrolled;
 
+#ifndef QT_NO_OPENGL
     QQnxGLContext *m_platformOpenGLContext;
+#endif
     QQnxScreen *m_screen;
     QList<QQnxWindow*> m_childWindows;
     QQnxWindow *m_parentWindow;