summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/qnx/qqnxintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxintegration.cpp')
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp152
1 files changed, 119 insertions, 33 deletions
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index b4112999b6..2fa3b45047 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -40,33 +40,54 @@
****************************************************************************/
#include "qqnxintegration.h"
-#include "qqnxeventthread.h"
-#include "qqnxglbackingstore.h"
-#include "qqnxglcontext.h"
+#include "qqnxscreeneventthread.h"
#include "qqnxnativeinterface.h"
-#include "qqnxnavigatoreventhandler.h"
-#include "qqnxnavigatoreventnotifier.h"
#include "qqnxrasterbackingstore.h"
#include "qqnxscreen.h"
#include "qqnxscreeneventhandler.h"
#include "qqnxwindow.h"
-#include "qqnxvirtualkeyboard.h"
-#include "qqnxclipboard.h"
-#include "qqnxglcontext.h"
+#include "qqnxnavigatoreventhandler.h"
+#include "qqnxabstractnavigator.h"
+#include "qqnxabstractvirtualkeyboard.h"
#include "qqnxservices.h"
-#if defined(QQnx_IMF)
-#include "qqnxinputcontext_imf.h"
-#else
-#include "qqnxinputcontext_noimf.h"
+#if defined(Q_OS_BLACKBERRY)
+#include "qqnxbpseventfilter.h"
+#include "qqnxnavigatorbps.h"
+#include "qqnxvirtualkeyboardbps.h"
+#elif defined(QQNX_PPS)
+#include "qqnxnavigatorpps.h"
+#include "qqnxvirtualkeyboardpps.h"
+#endif
+
+#if defined(QQNX_PPS)
+# include "qqnxnavigatoreventnotifier.h"
+# include "qqnxclipboard.h"
+
+# if defined(QQNX_IMF)
+# include "qqnxinputcontext_imf.h"
+# else
+# include "qqnxinputcontext_noimf.h"
+# endif
#endif
#include "private/qgenericunixfontdatabase_p.h"
+
+#if defined(Q_OS_BLACKBERRY)
+#include "qqnxeventdispatcher_blackberry.h"
+#else
#include "private/qgenericunixeventdispatcher_p.h"
+#endif
#include <QtGui/QPlatformWindow>
#include <QtGui/QWindowSystemInterface>
+
+#if !defined(QT_NO_OPENGL)
+#include "qqnxglbackingstore.h"
+#include "qqnxglcontext.h"
+
#include <QtGui/QOpenGLContext>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QHash>
@@ -80,18 +101,27 @@ QMutex QQnxIntegration::ms_windowMapperMutex;
QQnxIntegration::QQnxIntegration()
: QPlatformIntegration()
- , m_eventThread(0)
+ , m_screenEventThread(0)
, m_navigatorEventHandler(new QQnxNavigatorEventHandler())
- , m_navigatorEventNotifier(0)
, m_virtualKeyboard(0)
+#if defined(QQNX_PPS)
+ , m_navigatorEventNotifier(0)
, m_inputContext(0)
+#endif
+ , m_services(0)
, m_fontDatabase(new QGenericUnixFontDatabase())
+#if !defined(QT_NO_OPENGL)
, m_paintUsingOpenGL(false)
+#endif
+#if defined(Q_OS_BLACKBERRY)
+ , m_eventDispatcher(new QQnxEventDispatcherBlackberry())
+ , m_bpsEventFilter(0)
+#else
, m_eventDispatcher(createUnixEventDispatcher())
+#endif
, m_nativeInterface(new QQnxNativeInterface())
- , m_services(0)
, m_screenEventHandler(new QQnxScreenEventHandler())
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
, m_clipboard(0)
#endif
{
@@ -105,41 +135,73 @@ QQnxIntegration::QQnxIntegration()
qFatal("QQnx: failed to connect to composition manager, errno=%d", errno);
}
+ // Not on BlackBerry, it has specialised event dispatcher which also handles navigator events
+#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
// 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();
+#if !defined(QT_NO_OPENGL)
// Initialize global OpenGL resources
QQnxGLContext::initialize();
+#endif
// Create/start event thread
- m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
- m_eventThread->start();
+ // Not on BlackBerry, it has specialised event dispatcher which also handles screen events
+#if !defined(Q_OS_BLACKBERRY)
+ m_screenEventThread = new QQnxScreenEventThread(m_screenContext, m_screenEventHandler);
+ m_screenEventThread->start();
+#endif
+ // Not on BlackBerry, it has specialised event dispatcher which also handles virtual keyboard events
+#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
// Create/start the keyboard class.
- m_virtualKeyboard = new QQnxVirtualKeyboard();
+ m_virtualKeyboard = new QQnxVirtualKeyboardPps();
// 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_virtualKeyboard, "start", Qt::QueuedConnection);
+#endif
- // TODO check if we need to do this for all screens or only the primary one
- QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
- primaryDisplay(), SLOT(keyboardHeightChanged(int)));
-
- // Set up the input context
- m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+#if defined(Q_OS_BLACKBERRY)
+ m_navigator = new QQnxNavigatorBps();
+#elif defined(QQNX_PPS)
+ m_navigator = new QQnxNavigatorPps();
+#endif
// Create services handling class
-#ifdef Q_OS_BLACKBERRY
- m_services = new QQnxServices;
+ if (m_navigator)
+ m_services = new QQnxServices(m_navigator);
+
+#if defined(Q_OS_BLACKBERRY)
+ QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps;
+ m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps);
+ Q_FOREACH (QQnxScreen *screen, m_screens)
+ m_bpsEventFilter->registerForScreenEvents(screen);
+
+ m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher);
+
+ m_virtualKeyboard = virtualKeyboardBps;
#endif
+
+ if (m_virtualKeyboard) {
+ // TODO check if we need to do this for all screens or only the primary one
+ QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
+ primaryDisplay(), SLOT(keyboardHeightChanged(int)));
+
+#if defined(QQNX_PPS)
+ // Set up the input context
+ m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+#endif
+ }
+
}
QQnxIntegration::~QQnxIntegration()
@@ -151,23 +213,35 @@ QQnxIntegration::~QQnxIntegration()
delete m_nativeInterface;
+#if defined(QQNX_PPS)
// Destroy input context
delete m_inputContext;
+#endif
// Destroy the keyboard class.
delete m_virtualKeyboard;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
// Delete the clipboard
delete m_clipboard;
#endif
// Stop/destroy navigator event notifier
+#if defined(QQNX_PPS)
delete m_navigatorEventNotifier;
+#endif
delete m_navigatorEventHandler;
- // Stop/destroy event thread
- delete m_eventThread;
+#if !defined(Q_OS_BLACKBERRY)
+ // Stop/destroy screen event thread
+ delete m_screenEventThread;
+#else
+ Q_FOREACH (QQnxScreen *screen, m_screens)
+ m_bpsEventFilter->unregisterForScreenEvents(screen);
+
+ delete m_bpsEventFilter;
+#endif
+
delete m_screenEventHandler;
// Destroy all displays
@@ -176,13 +250,16 @@ QQnxIntegration::~QQnxIntegration()
// Close connection to QNX composition manager
screen_destroy_context(m_screenContext);
+#if !defined(QT_NO_OPENGL)
// Cleanup global OpenGL resources
QQnxGLContext::shutdown();
+#endif
// Destroy services class
-#ifdef Q_OS_BLACKBERRY
delete m_services;
-#endif
+
+ // Destroy navigator interface
+ delete m_navigator;
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QQnx: platform plugin shutdown end";
@@ -217,12 +294,15 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
+#if !defined(QT_NO_OPENGL)
if (paintUsingOpenGL())
return new QQnxGLBackingStore(window);
else
+#endif
return new QQnxRasterBackingStore(window);
}
+#if !defined(QT_NO_OPENGL)
QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -230,7 +310,9 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont
#endif
return new QQnxGLContext(context);
}
+#endif
+#if defined(QQNX_PPS)
QPlatformInputContext *QQnxIntegration::inputContext() const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -238,6 +320,7 @@ QPlatformInputContext *QQnxIntegration::inputContext() const
#endif
return m_inputContext;
}
+#endif
void QQnxIntegration::moveToScreen(QWindow *window, int screen)
{
@@ -268,15 +351,18 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const
return m_nativeInterface;
}
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *QQnxIntegration::clipboard() const
{
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
+
+#if defined(QQNX_PPS)
if (!m_clipboard) {
m_clipboard = new QQnxClipboard;
}
+#endif
return m_clipboard;
}
#endif