[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>
This commit is contained in:
Fabian Bumberger 2014-01-29 17:56:00 +01:00 committed by The Qt Project
parent 0827f0bd66
commit 00b96399e6
2 changed files with 24 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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