From 47617f68cbed0c14e7318e1c85885ed8411b7344 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Apr 2012 12:07:10 +0200 Subject: [PATCH] Make the QNX QPA plugin work with non blackberry. Change-Id: Id85d18d9f21711e8d53e8e4bfdf39d10e135f593 Reviewed-by: Rafael Roquetto Reviewed-by: Kevin Krammer Reviewed-by: Andreas Holzammer Reviewed-by: Robin Burchell --- mkspecs/common/qcc-base-qnx-armv7le.conf | 25 ++++++++++++ mkspecs/common/qcc-base-qnx-x86.conf | 25 ++++++++++++ .../unsupported/blackberry-armv7le-qcc/qmake.conf | 4 +- mkspecs/unsupported/blackberry-x86-qcc/qmake.conf | 2 +- mkspecs/unsupported/qnx-armv7le-qcc/qmake.conf | 22 +--------- mkspecs/unsupported/qnx-x86-qcc/qmake.conf | 22 +--------- src/plugins/platforms/qnx/qnx.pro | 47 +++++++++++++--------- src/plugins/platforms/qnx/qqnxintegration.cpp | 25 +++++++++--- src/plugins/platforms/qnx/qqnxintegration.h | 19 ++++++--- 9 files changed, 118 insertions(+), 73 deletions(-) create mode 100644 mkspecs/common/qcc-base-qnx-armv7le.conf create mode 100644 mkspecs/common/qcc-base-qnx-x86.conf diff --git a/mkspecs/common/qcc-base-qnx-armv7le.conf b/mkspecs/common/qcc-base-qnx-armv7le.conf new file mode 100644 index 0000000..8270a27 --- /dev/null +++ b/mkspecs/common/qcc-base-qnx-armv7le.conf @@ -0,0 +1,25 @@ +# +# qmake configuration for qnx-qcc armv7 targets +# + +MAKEFILE_GENERATOR = UNIX +TARGET_PLATFORM = unix +TEMPLATE = app +CONFIG += qt warn_on release link_prl +QT += core gui + +include(g++-unix.conf) +include(unix.conf) + +QMAKE_CC = qcc -Vgcc_ntoarmv7le +QNX_CPUDIR = armle-v7 + +include(qcc-base-qnx.conf) + +QMAKE_AR = ntoarmv7-ar cqs +QMAKE_OBJCOPY = ntoarmv7-objcopy +QMAKE_RANLIB = ntoarmv7-ranlib + +QMAKE_STRIP = ntoarmv7-strip + +load(qt_config) diff --git a/mkspecs/common/qcc-base-qnx-x86.conf b/mkspecs/common/qcc-base-qnx-x86.conf new file mode 100644 index 0000000..5e88ba8 --- /dev/null +++ b/mkspecs/common/qcc-base-qnx-x86.conf @@ -0,0 +1,25 @@ +# +# qmake configuration for qnx-qcc x86 targets +# + +MAKEFILE_GENERATOR = UNIX +TARGET_PLATFORM = unix +TEMPLATE = app +CONFIG += qt warn_on release link_prl +QT += core gui + +include(g++-unix.conf) +include(unix.conf) + +QMAKE_CC = qcc -Vgcc_ntox86 +QNX_CPUDIR = x86 + +include(qcc-base-qnx.conf) + +QMAKE_AR = ntox86-ar cqs +QMAKE_OBJCOPY = ntox86-objcopy +QMAKE_RANLIB = ntox86-ranlib + +QMAKE_STRIP = ntox86-strip + +load(qt_config) diff --git a/mkspecs/unsupported/blackberry-armv7le-qcc/qmake.conf b/mkspecs/unsupported/blackberry-armv7le-qcc/qmake.conf index 4e72667..efb585b 100644 --- a/mkspecs/unsupported/blackberry-armv7le-qcc/qmake.conf +++ b/mkspecs/unsupported/blackberry-armv7le-qcc/qmake.conf @@ -1,5 +1,5 @@ # -# qmake configuration for blackberry x86 systems +# qmake configuration for blackberry armv7le systems # DEFINES += Q_OS_BLACKBERRY @@ -9,4 +9,4 @@ LIBS += -lbps # Blackberry also has support for stack smashing protection in its libc QMAKE_CFLAGS += -fstack-protector -fstack-protector-all -include(../qnx-armv7le-qcc/qmake.conf) +include(../../common/qcc-base-qnx-armv7le.conf) diff --git a/mkspecs/unsupported/blackberry-x86-qcc/qmake.conf b/mkspecs/unsupported/blackberry-x86-qcc/qmake.conf index 60b67f8..3fd84c1 100644 --- a/mkspecs/unsupported/blackberry-x86-qcc/qmake.conf +++ b/mkspecs/unsupported/blackberry-x86-qcc/qmake.conf @@ -9,4 +9,4 @@ LIBS += -lbps # Blackberry also has support for stack smashing protection in its libc QMAKE_CFLAGS += -fstack-protector -fstack-protector-all -include(../qnx-x86-qcc/qmake.conf) +include(../../common/qcc-base-qnx-x86.conf) diff --git a/mkspecs/unsupported/qnx-armv7le-qcc/qmake.conf b/mkspecs/unsupported/qnx-armv7le-qcc/qmake.conf index ac6da27..37c66cd 100644 --- a/mkspecs/unsupported/qnx-armv7le-qcc/qmake.conf +++ b/mkspecs/unsupported/qnx-armv7le-qcc/qmake.conf @@ -2,24 +2,6 @@ # qmake configuration for qnx-qcc armv7 targets # -MAKEFILE_GENERATOR = UNIX -TARGET_PLATFORM = unix -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui +include(../../common/qcc-base-qnx-armv7le.conf) -include(../../common/g++-unix.conf) -include(../../common/unix.conf) - -QMAKE_CC = qcc -Vgcc_ntoarmv7le -QNX_CPUDIR = armle-v7 - -include(../../common/qcc-base-qnx.conf) - -QMAKE_AR = ntoarmv7-ar cqs -QMAKE_OBJCOPY = ntoarmv7-objcopy -QMAKE_RANLIB = ntoarmv7-ranlib - -QMAKE_STRIP = ntoarmv7-strip - -load(qt_config) +DEFINES += QT_NO_CLIPBOARD diff --git a/mkspecs/unsupported/qnx-x86-qcc/qmake.conf b/mkspecs/unsupported/qnx-x86-qcc/qmake.conf index fef8d44..cf588ba 100644 --- a/mkspecs/unsupported/qnx-x86-qcc/qmake.conf +++ b/mkspecs/unsupported/qnx-x86-qcc/qmake.conf @@ -2,24 +2,6 @@ # qmake configuration for qnx-qcc x86 targets # -MAKEFILE_GENERATOR = UNIX -TARGET_PLATFORM = unix -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui +include(../../common/qcc-base-qnx-x86.conf) -include(../../common/g++-unix.conf) -include(../../common/unix.conf) - -QMAKE_CC = qcc -Vgcc_ntox86 -QNX_CPUDIR = x86 - -include(../../common/qcc-base-qnx.conf) - -QMAKE_AR = ntox86-ar cqs -QMAKE_OBJCOPY = ntox86-objcopy -QMAKE_RANLIB = ntox86-ranlib - -QMAKE_STRIP = ntox86-strip - -load(qt_config) +DEFINES += QT_NO_CLIPBOARD diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index ef9ae57..04e3b43 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -31,59 +31,66 @@ SOURCES = main.cpp \ qqnxglcontext.cpp \ qqnxglbackingstore.cpp \ qqnxintegration.cpp \ - qqnxnavigatoreventhandler.cpp \ - qqnxnavigatoreventnotifier.cpp \ qqnxscreen.cpp \ qqnxwindow.cpp \ qqnxrasterbackingstore.cpp \ - qqnxvirtualkeyboard.cpp \ - qqnxclipboard.cpp \ qqnxrootwindow.cpp \ qqnxscreeneventhandler.cpp \ - qqnxabstractvirtualkeyboard.cpp \ qqnxnativeinterface.cpp +CONFIG(blackberry) { + SOURCES += qqnxnavigatoreventhandler.cpp \ + qqnxnavigatoreventnotifier.cpp \ + qqnxvirtualkeyboard.cpp \ + qqnxclipboard.cpp \ + qqnxabstractvirtualkeyboard.cpp +} + HEADERS = main.h \ qqnxbuffer.h \ qqnxeventthread.h \ qqnxkeytranslator.h \ qqnxintegration.h \ - qqnxnavigatoreventhandler.h \ - qqnxnavigatoreventnotifier.h \ qqnxglcontext.h \ qqnxglbackingstore.h \ qqnxscreen.h \ qqnxwindow.h \ qqnxrasterbackingstore.h \ - qqnxvirtualkeyboard.h \ - qqnxclipboard.h \ qqnxrootwindow.h \ qqnxscreeneventhandler.h \ - qqnxabstractvirtualkeyboard.h \ qqnxnativeinterface.h CONFIG(blackberry) { + HEADERS += qqnxnavigatoreventhandler.h \ + qqnxnavigatoreventnotifier.h \ + qqnxvirtualkeyboard.h \ + qqnxclipboard.h \ + qqnxabstractvirtualkeyboard.h +} + + +CONFIG(blackberry) { SOURCES += qqnxservices.cpp HEADERS += qqnxservices.h -} -CONFIG(qqnx_imf) { - DEFINES += QQNX_IMF - HEADERS += qqnxinputcontext_imf.h - SOURCES += qqnxinputcontext_imf.cpp -} else { - HEADERS += qqnxinputcontext_noimf.h - SOURCES += qqnxinputcontext_noimf.cpp + CONFIG(qqnx_imf) { + DEFINES += QQNX_IMF + HEADERS += qqnxinputcontext_imf.h + SOURCES += qqnxinputcontext_imf.cpp + } else { + HEADERS += qqnxinputcontext_noimf.h + SOURCES += qqnxinputcontext_noimf.cpp + } } OTHER_FILES += qnx.json QMAKE_CXXFLAGS += -I./private -LIBS += -lpps -lscreen -lEGL -lclipboard +LIBS += -lscreen -lEGL CONFIG(blackberry) { - LIBS += -lbps + LIBS += -lbps -lpps -lclipboard } include (../../../platformsupport/eglconvenience/eglconvenience.pri) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index b411299..683daee 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -44,15 +44,17 @@ #include "qqnxglbackingstore.h" #include "qqnxglcontext.h" #include "qqnxnativeinterface.h" -#include "qqnxnavigatoreventhandler.h" -#include "qqnxnavigatoreventnotifier.h" #include "qqnxrasterbackingstore.h" #include "qqnxscreen.h" #include "qqnxscreeneventhandler.h" #include "qqnxwindow.h" +#include "qqnxglcontext.h" + +#ifdef Q_OS_BLACKBERRY +#include "qqnxnavigatoreventhandler.h" +#include "qqnxnavigatoreventnotifier.h" #include "qqnxvirtualkeyboard.h" #include "qqnxclipboard.h" -#include "qqnxglcontext.h" #include "qqnxservices.h" #if defined(QQnx_IMF) @@ -60,6 +62,7 @@ #else #include "qqnxinputcontext_noimf.h" #endif +#endif // Q_OS_BLACKBERRY #include "private/qgenericunixfontdatabase_p.h" #include "private/qgenericunixeventdispatcher_p.h" @@ -81,15 +84,17 @@ QMutex QQnxIntegration::ms_windowMapperMutex; QQnxIntegration::QQnxIntegration() : QPlatformIntegration() , m_eventThread(0) +#ifdef Q_OS_BLACKBERRY , m_navigatorEventHandler(new QQnxNavigatorEventHandler()) , m_navigatorEventNotifier(0) , m_virtualKeyboard(0) , m_inputContext(0) + , m_services(0) +#endif , m_fontDatabase(new QGenericUnixFontDatabase()) , m_paintUsingOpenGL(false) , m_eventDispatcher(createUnixEventDispatcher()) , m_nativeInterface(new QQnxNativeInterface()) - , m_services(0) , m_screenEventHandler(new QQnxScreenEventHandler()) #ifndef QT_NO_CLIPBOARD , m_clipboard(0) @@ -105,12 +110,14 @@ QQnxIntegration::QQnxIntegration() qFatal("QQnx: failed to connect to composition manager, errno=%d", errno); } +#ifdef Q_OS_BLACKBERRY // Create/start navigator event notifier m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler); // delay invocation of start() to the time the event loop is up and running // needed to have the QThread internals of the main thread properly initialized QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection); +#endif // Create displays for all possible screens (which may not be attached) createDisplays(); @@ -122,6 +129,7 @@ QQnxIntegration::QQnxIntegration() m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler); m_eventThread->start(); +#ifdef Q_OS_BLACKBERRY // Create/start the keyboard class. m_virtualKeyboard = new QQnxVirtualKeyboard(); @@ -137,7 +145,6 @@ QQnxIntegration::QQnxIntegration() m_inputContext = new QQnxInputContext(*m_virtualKeyboard); // Create services handling class -#ifdef Q_OS_BLACKBERRY m_services = new QQnxServices; #endif } @@ -151,6 +158,7 @@ QQnxIntegration::~QQnxIntegration() delete m_nativeInterface; +#ifdef Q_OS_BLACKBERRY // Destroy input context delete m_inputContext; @@ -165,6 +173,7 @@ QQnxIntegration::~QQnxIntegration() // Stop/destroy navigator event notifier delete m_navigatorEventNotifier; delete m_navigatorEventHandler; +#endif // Stop/destroy event thread delete m_eventThread; @@ -231,6 +240,7 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont return new QQnxGLContext(context); } +#ifdef Q_OS_BLACKBERRY QPlatformInputContext *QQnxIntegration::inputContext() const { #if defined(QQNXINTEGRATION_DEBUG) @@ -238,6 +248,7 @@ QPlatformInputContext *QQnxIntegration::inputContext() const #endif return m_inputContext; } +#endif void QQnxIntegration::moveToScreen(QWindow *window, int screen) { @@ -292,10 +303,12 @@ QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +#ifdef Q_OS_BLACKBERRY QPlatformServices * QQnxIntegration::services() const { return m_services; } +#endif QWindow *QQnxIntegration::window(screen_window_t qnxWindow) { @@ -361,7 +374,9 @@ void QQnxIntegration::createDisplays() QObject::connect(m_screenEventHandler, SIGNAL(windowClosed(void *)), screen, SLOT(windowClosed(void *))); +#ifdef Q_OS_BLACKBERRY QObject::connect(m_navigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int))); +#endif } } diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 801bd7b..3207b9c 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -51,15 +51,18 @@ QT_BEGIN_NAMESPACE class QQnxEventThread; -class QQnxInputContext; class QQnxNativeInterface; +class QQnxWindow; +class QQnxScreen; +class QQnxScreenEventHandler; + +#ifdef Q_OS_BLACKBERRY +class QQnxInputContext; class QQnxNavigatorEventHandler; class QQnxNavigatorEventNotifier; class QQnxAbstractVirtualKeyboard; -class QQnxWindow; class QQnxServices; -class QQnxScreen; -class QQnxScreenEventHandler; +#endif #ifndef QT_NO_CLIPBOARD class QQnxClipboard; @@ -80,7 +83,9 @@ public: QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; +#ifdef Q_OS_BLACKBERRY QPlatformInputContext *inputContext() const; +#endif void moveToScreen(QWindow *window, int screen); @@ -98,7 +103,9 @@ public: bool paintUsingOpenGL() const { return m_paintUsingOpenGL; } +#ifdef Q_OS_BLACKBERRY QPlatformServices *services() const; +#endif static QWindow *window(screen_window_t qnxWindow); @@ -112,15 +119,17 @@ private: screen_context_t m_screenContext; QQnxEventThread *m_eventThread; +#ifdef Q_OS_BLACKBERRY QQnxNavigatorEventHandler *m_navigatorEventHandler; QQnxNavigatorEventNotifier *m_navigatorEventNotifier; QQnxAbstractVirtualKeyboard *m_virtualKeyboard; QQnxInputContext *m_inputContext; + QQnxServices *m_services; +#endif QPlatformFontDatabase *m_fontDatabase; bool m_paintUsingOpenGL; QAbstractEventDispatcher *m_eventDispatcher; QQnxNativeInterface *m_nativeInterface; - QQnxServices *m_services; QList m_screens; QQnxScreenEventHandler *m_screenEventHandler; #ifndef QT_NO_CLIPBOARD -- 2.7.4