summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorKevin Krammer <kevin.krammer.qnx@kdab.com>2012-04-03 11:15:39 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-03 12:45:46 +0200
commit45b7b0599cd1ebdfe17487215b36ff766068f0e8 (patch)
tree36260f5385c9e34a5196899eb442c65a0f0cdcef /src/plugins
parentb4ec80ac876d830f5a706afed2c0527ce79d48e0 (diff)
Move handling of rotation changes from event handler to screen
Have the navigator event handler emit the new rotation as a signal argument and let the screen class handle all parts of the change, i.e. also notifying the window system about the geometry change. This also allows to rotate all screens, not just the primary screen, if this should be necessary. Change-Id: I304a80232b84d2d9130e38e955d5a75b1ccad775 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp24
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp8
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h9
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp6
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h2
5 files changed, 29 insertions, 20 deletions
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index faec340347..687002db09 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -103,16 +103,6 @@ QQnxIntegration::QQnxIntegration()
qFatal("QQnx: failed to connect to composition manager, errno=%d", errno);
}
- // Create displays for all possible screens (which may not be attached)
- createDisplays();
-
- // Initialize global OpenGL resources
- QQnxGLContext::initialize();
-
- // Create/start event thread
- m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
- m_eventThread->start();
-
// Create/start navigator event handler
// Not on BlackBerry, it has specialised event dispatcher which also handles navigator events
#ifndef Q_OS_BLACKBERRY
@@ -123,6 +113,16 @@ QQnxIntegration::QQnxIntegration()
QMetaObject::invokeMethod(m_navigatorEventHandler, "start", Qt::QueuedConnection);
#endif
+ // Create displays for all possible screens (which may not be attached)
+ createDisplays();
+
+ // Initialize global OpenGL resources
+ QQnxGLContext::initialize();
+
+ // Create/start event thread
+ m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
+ m_eventThread->start();
+
// Create/start the keyboard class.
m_virtualKeyboard = new QQnxVirtualKeyboard();
@@ -360,6 +360,10 @@ void QQnxIntegration::createDisplays()
screen, SLOT(newWindowCreated(void *)));
QObject::connect(m_screenEventHandler, SIGNAL(windowClosed(void *)),
screen, SLOT(windowClosed(void *)));
+
+#ifndef Q_OS_BLACKBERRY
+ QObject::connect(m_navigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int)));
+#endif
}
}
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
index 4db86cb5cf..9527a57ca3 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qqnxnavigatoreventhandler.h"
-#include "qqnxscreen.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
@@ -61,8 +60,8 @@
static const char *navigatorControlPath = "/pps/services/navigator/control";
static const int ppsBufferSize = 4096;
-QQnxNavigatorEventHandler::QQnxNavigatorEventHandler(QQnxScreen& primaryScreen)
- : m_primaryScreen(primaryScreen),
+QQnxNavigatorEventHandler::QQnxNavigatorEventHandler(QObject *parent)
+ : QObject(parent),
m_fd(-1),
m_readNotifier(0)
{
@@ -202,8 +201,7 @@ void QQnxNavigatorEventHandler::handleMessage(const QByteArray &msg, const QByte
#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG)
qDebug() << "PPS: orientation, o=" << dat;
#endif
- m_primaryScreen.setRotation( dat.toInt() );
- QWindowSystemInterface::handleScreenGeometryChange(0, m_primaryScreen.geometry());
+ Q_EMIT rotationChanged(dat.toInt());
replyPPS(msg, id, "");
} else if (msg == "SWIPE_DOWN") {
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
index 2e0bd1fa14..8084eba1d9 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
@@ -46,15 +46,17 @@
QT_BEGIN_NAMESPACE
-class QQnxScreen;
class QSocketNotifier;
class QQnxNavigatorEventHandler : public QObject
{
Q_OBJECT
public:
- QQnxNavigatorEventHandler(QQnxScreen &primaryScreen);
- virtual ~QQnxNavigatorEventHandler();
+ explicit QQnxNavigatorEventHandler(QObject *parent = 0);
+ ~QQnxNavigatorEventHandler();
+
+Q_SIGNALS:
+ void rotationChanged(int angle);
public Q_SLOTS:
void start();
@@ -67,7 +69,6 @@ private:
void replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat);
void handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id);
- QQnxScreen &m_primaryScreen;
int m_fd;
QSocketNotifier *m_readNotifier;
};
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 7ddef321ae..27c1357a87 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -190,6 +190,12 @@ void QQnxScreen::setRotation(int rotation)
// Save new rotation
m_currentRotation = 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 (m_primaryScreen)
+ QWindowSystemInterface::handleScreenGeometryChange(screen(), m_currentGeometry);
}
}
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index b90f6f5abf..272cdd6261 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -71,7 +71,6 @@ public:
bool isPrimaryScreen() const { return m_primaryScreen; }
int rotation() const { return m_currentRotation; }
- void setRotation(int rotation);
int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
screen_display_t nativeDisplay() const { return m_display; }
@@ -92,6 +91,7 @@ public:
QSharedPointer<QQnxRootWindow> rootWindow() const { return m_rootWindow; }
public Q_SLOTS:
+ void setRotation(int rotation);
void newWindowCreated(void *window);
void windowClosed(void *window);