summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformscreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qplatformscreen.cpp')
-rw-r--r--src/gui/kernel/qplatformscreen.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index e22037c1e9..358ff16930 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -104,6 +104,20 @@ QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const
}
/*!
+ Return all windows residing on this screen.
+*/
+QWindowList QPlatformScreen::windows() const
+{
+ QWindowList windows;
+ for (QWindow *window : QGuiApplication::allWindows()) {
+ if (platformScreenForWindow(window) != this)
+ continue;
+ windows.append(window);
+ }
+ return windows;
+}
+
+/*!
Find the sibling screen corresponding to \a globalPos.
Returns this screen if no suitable screen is found at the position.
@@ -369,25 +383,17 @@ QPlatformCursor *QPlatformScreen::cursor() const
*/
void QPlatformScreen::resizeMaximizedWindows()
{
- QList<QWindow*> windows = QGuiApplication::allWindows();
-
// 'screen()' still has the old geometry info while 'this' has the new geometry info
const QRect oldGeometry = screen()->geometry();
const QRect oldAvailableGeometry = screen()->availableGeometry();
const QRect newGeometry = deviceIndependentGeometry();
const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
- // make sure maximized and fullscreen windows are updated
- for (int i = 0; i < windows.size(); ++i) {
- QWindow *w = windows.at(i);
-
+ for (QWindow *w : windows()) {
// Skip non-platform windows, e.g., offscreen windows.
if (!w->handle())
continue;
- if (platformScreenForWindow(w) != this)
- continue;
-
if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry)
w->setGeometry(newAvailableGeometry);
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry)