summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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