aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElvis Lee <kwangwoong.lee@lge.com>2019-08-21 20:44:57 +0900
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-14 07:46:42 +0000
commitbf65961f37c169ddfb358dcd0aef739989e4d88e (patch)
tree388aaf180532463f7db917130384b53a107520fc
parent791fe6e5c2d0ae3533c9aa10ffa91deae46929ee (diff)
webOS: Allow to have activeFocus for each window
This makes multiple windows focused if there is a single window per screen assuming that windows across screens don't compete the keyboard focus. Task-number: QTBUG-83361 Change-Id: Id6f6fd0c95747b03d56c5e535f1313c27d67ab24 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a2c5f5abff3cafc5769588b573bb04cf950a0450) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/items/qquickwindow.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index a66e98d66f..d0c9ad5454 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1063,6 +1063,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.
@@ -1137,7 +1154,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;
}