diff options
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 26 |
1 files changed, 20 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); } } |