diff options
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index d6e0ca15cd..f976095ee1 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1149,6 +1149,23 @@ static inline bool windowHasFocus(QQuickWindow *win) return win == focusWindow || QQuickRenderControl::renderWindowFor(win) == focusWindow; } +#ifdef Q_OS_WEBOS +// Temporary fix for webOS until multi-seat is implemented see QTBUG-85272 +static inline bool singleWindowOnScreen(QQuickWindow *win) +{ + const QWindowList windowList = QGuiApplication::allWindows(); + for (int i = 0; i < windowList.count(); i++) { + QWindow *ii = windowList.at(i); + if (ii == win) + continue; + if (ii->screen() == win->screen()) + return false; + } + + return true; +} +#endif + /*! Set the focus inside \a scope to be \a item. If the scope contains the active focus item, it will be changed to \a item. @@ -1223,7 +1240,14 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q } if (!(options & DontChangeFocusProperty)) { - if (item != contentItem || windowHasFocus(q)) { + if (item != contentItem + || windowHasFocus(q) +#ifdef Q_OS_WEBOS + // Allow focused if there is only one window in the screen where it belongs. + // Temporary fix for webOS until multi-seat is implemented see QTBUG-85272 + || singleWindowOnScreen(q) +#endif + ) { itemPrivate->focus = true; changed << item; } |