summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2014-01-29 17:56:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-16 20:21:59 +0100
commit00b96399e6d3bcd7a1081721cafeb15da3ab9781 (patch)
tree6157104c8d002c4f5db788444f25899207ecf362
parent0827f0bd6659db97fe8d8d062a1812f9f434fb50 (diff)
[QNX] Don't deactivate windows focus
When the focus changes, screen sends a focus deactivated change for the focus window. Depending on the order, this might deactivate the window focus completely. This for example leads to problems with QComboBox. Change-Id: Ia57f061a765c1f971d86d941b17f573ce9221ae1 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp26
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h4
2 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 8757e391ef..178ea121e6 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -72,6 +72,7 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
#if defined(QQNX_SCREENEVENTTHREAD)
, m_eventThread(0)
#endif
+ , m_focusLostTimer(-1)
{
// Create a touch device
m_touchDevice = new QTouchDevice;
@@ -617,13 +618,26 @@ void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t wi
qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno);
QWindow *focusWindow = QQnxIntegration::window(window);
- if (focus) {
+
+ if (m_focusLostTimer != -1) {
+ killTimer(m_focusLostTimer);
+ m_focusLostTimer = -1;
+ }
+
+ if (focus && focusWindow != QGuiApplication::focusWindow())
QWindowSystemInterface::handleWindowActivated(focusWindow);
- } else if (focusWindow == QGuiApplication::focusWindow()) {
- // Deactivate only if the window was the focus window.
- // Screen might send a keyboard focus event for a newly created
- // window on the secondary screen, with focus 0.
- QWindowSystemInterface::handleWindowActivated(0);
+ else if (!focus && focusWindow == QGuiApplication::focusWindow())
+ m_focusLostTimer = startTimer(50);
+}
+
+void QQnxScreenEventHandler::timerEvent(QTimerEvent *event)
+{
+ if (event->timerId() == m_focusLostTimer) {
+ killTimer(m_focusLostTimer);
+ m_focusLostTimer = -1;
+ event->accept();
+ } else {
+ QObject::timerEvent(event);
}
}
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index a7bcd449ee..bab6420cb8 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -76,6 +76,9 @@ Q_SIGNALS:
void newWindowCreated(void *window);
void windowClosed(void *window);
+protected:
+ void timerEvent(QTimerEvent *event);
+
#if defined(QQNX_SCREENEVENTTHREAD)
private Q_SLOTS:
void processEventsFromScreenThread();
@@ -107,6 +110,7 @@ private:
#if defined(QQNX_SCREENEVENTTHREAD)
QQnxScreenEventThread *m_eventThread;
#endif
+ int m_focusLostTimer;
};
QT_END_NAMESPACE