diff options
Diffstat (limited to 'src/plugins/platforms/blackberry')
5 files changed, 25 insertions, 20 deletions
diff --git a/src/plugins/platforms/blackberry/qbbintegration.cpp b/src/plugins/platforms/blackberry/qbbintegration.cpp index 76a47dc..4482e8e 100644 --- a/src/plugins/platforms/blackberry/qbbintegration.cpp +++ b/src/plugins/platforms/blackberry/qbbintegration.cpp @@ -99,22 +99,20 @@ QBBIntegration::QBBIntegration() : qFatal("QBB: failed to connect to composition manager, errno=%d", errno); } - // Create displays for all possible screens (which may not be attached) - createDisplays(); - - // create/start event thread - mEventThread = new QBBEventThread(mContext, mScreenEventHandler); - mEventThread->start(); - // Create/start navigator event handler // Not on BlackBerry, it has specialised event dispatcher which also handles navigator events -#ifndef Q_OS_BLACKBERRY - mNavigatorEventHandler = new QBBNavigatorEventHandler(*primaryDisplay()); + mNavigatorEventHandler = new QBBNavigatorEventHandler; // 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(mNavigatorEventHandler, "start", Qt::QueuedConnection); -#endif + + // Create displays for all possible screens (which may not be attached) + createDisplays(); + + // create/start event thread + mEventThread = new QBBEventThread(mContext, mScreenEventHandler); + mEventThread->start(); #ifdef QBBLOCALETHREAD_ENABLED // Start the locale change monitoring thread. @@ -313,6 +311,8 @@ void QBBIntegration::createDisplays() screen, SLOT(newWindowCreated(screen_window_t))); QObject::connect(mScreenEventHandler, SIGNAL(windowClosed(screen_window_t)), screen, SLOT(windowClosed(screen_window_t))); + + QObject::connect(mNavigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int))); } } diff --git a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp index 877e91c..bac680a 100644 --- a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp +++ b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp @@ -41,7 +41,6 @@ #include "qbbnavigatoreventhandler.h" -#include "qbbscreen.h" #include <QtCore/private/qcore_unix_p.h> #include <QtGui/QApplication> @@ -61,8 +60,8 @@ #define NAV_CONTROL_PATH "/pps/services/navigator/control" #define PPS_BUFFER_SIZE 4096 -QBBNavigatorEventHandler::QBBNavigatorEventHandler(QBBScreen& primaryScreen) - : mPrimaryScreen(primaryScreen), +QBBNavigatorEventHandler::QBBNavigatorEventHandler(QObject *parent) + : QObject(parent), mFd(-1), mReadNotifier(0) { @@ -201,8 +200,7 @@ void QBBNavigatorEventHandler::handleMessage(const QByteArray &msg, const QByteA #if defined(QBBNAVIGATOREVENTHANDLER_DEBUG) qDebug() << "PPS: orientation, o=" << dat; #endif - mPrimaryScreen.setRotation( dat.toInt() ); - QWindowSystemInterface::handleScreenGeometryChange(0); + emit rotationChanged(dat.toInt()); replyPPS(msg, id, ""); } else if (msg == "SWIPE_DOWN") { diff --git a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.h b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.h index 4bac909..948f6e3 100644 --- a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.h +++ b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.h @@ -44,15 +44,17 @@ QT_BEGIN_NAMESPACE -class QBBScreen; class QSocketNotifier; class QBBNavigatorEventHandler : public QObject { Q_OBJECT public: - QBBNavigatorEventHandler(QBBScreen& primaryScreen); - virtual ~QBBNavigatorEventHandler(); + explicit QBBNavigatorEventHandler(QObject *parent = 0); + ~QBBNavigatorEventHandler(); + +Q_SIGNALS: + void rotationChanged(int angle); public Q_SLOTS: void start(); @@ -61,7 +63,6 @@ private Q_SLOTS: void readData(); private: - QBBScreen& mPrimaryScreen; int mFd; QSocketNotifier *mReadNotifier; diff --git a/src/plugins/platforms/blackberry/qbbscreen.cpp b/src/plugins/platforms/blackberry/qbbscreen.cpp index 5c91979..30630f1 100644 --- a/src/plugins/platforms/blackberry/qbbscreen.cpp +++ b/src/plugins/platforms/blackberry/qbbscreen.cpp @@ -222,6 +222,12 @@ void QBBScreen::setRotation(int rotation) // save new rotation mCurrentRotation = rotation; + + // TODO: check if other screens are supposed to rotate as well and/or whether this depends + // on if clone mode is being used. + // Rotating only the primary screen is what we had in the navigator event handler before refactoring + if (mPrimaryDisplay) + QWindowSystemInterface::handleScreenGeometryChange(mScreenIndex); } } diff --git a/src/plugins/platforms/blackberry/qbbscreen.h b/src/plugins/platforms/blackberry/qbbscreen.h index 22d210a..e353de1 100644 --- a/src/plugins/platforms/blackberry/qbbscreen.h +++ b/src/plugins/platforms/blackberry/qbbscreen.h @@ -64,7 +64,6 @@ public: virtual QSize physicalSize() const { return mCurrentPhysicalSize; } int rotation() const { return mCurrentRotation; } - void setRotation(int rotation); int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; } screen_display_t nativeDisplay() const { return mDisplay; } @@ -86,6 +85,7 @@ public: QSharedPointer<QBBRootWindow> rootWindow() const { return mRootWindow; } public Q_SLOTS: + void setRotation(int rotation); void newWindowCreated(screen_window_t window); void windowClosed(screen_window_t window); |