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
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();
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
}
}
****************************************************************************/
#include "qqnxnavigatoreventhandler.h"
-#include "qqnxscreen.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
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)
{
#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") {
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();
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;
};
// 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);
}
}
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; }
QSharedPointer<QQnxRootWindow> rootWindow() const { return m_rootWindow; }
public Q_SLOTS:
+ void setRotation(int rotation);
void newWindowCreated(void *window);
void windowClosed(void *window);