diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-08 08:41:14 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-08-08 11:20:22 +0200 |
commit | 577654047a0bb2810d789fb2fbc550ccfee47029 (patch) | |
tree | 51e70099313464f7ed3c4ba563e2aa2bc5f762b8 /src/gui | |
parent | 634e5dd9f2e03198a06269087ad3dd9b59ac87f1 (diff) | |
parent | bedf50a5bb9656a64ec609536366f90929a63c39 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/plugins/platforms/cocoa/qcocoabackingstore.mm
src/plugins/platforms/cocoa/qcocoascreen.mm
Change-Id: Iac965aea4867059dbf7bc401b71e8e8b5b259afb
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 16 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 8 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen.cpp | 24 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen.h | 2 |
4 files changed, 29 insertions, 21 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 712699ddc9..40d82d9269 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1864,19 +1864,19 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e)); break; case QWindowSystemInterfacePrivate::ScreenOrientation: - QGuiApplicationPrivate::reportScreenOrientationChange( + QGuiApplicationPrivate::processScreenOrientationChange( static_cast<QWindowSystemInterfacePrivate::ScreenOrientationEvent *>(e)); break; case QWindowSystemInterfacePrivate::ScreenGeometry: - QGuiApplicationPrivate::reportGeometryChange( + QGuiApplicationPrivate::processScreenGeometryChange( static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e)); break; case QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInch: - QGuiApplicationPrivate::reportLogicalDotsPerInchChange( + QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange( static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e)); break; case QWindowSystemInterfacePrivate::ScreenRefreshRate: - QGuiApplicationPrivate::reportRefreshRateChange( + QGuiApplicationPrivate::processScreenRefreshRateChange( static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e)); break; case QWindowSystemInterfacePrivate::ThemeChange: @@ -2907,7 +2907,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To } } -void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e) +void QGuiApplicationPrivate::processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e) { // This operation only makes sense after the QGuiApplication constructor runs if (QCoreApplication::startingUp()) @@ -2944,7 +2944,7 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QScreen *s) QCoreApplication::sendEvent(QCoreApplication::instance(), &event); } -void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e) +void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e) { // This operation only makes sense after the QGuiApplication constructor runs if (QCoreApplication::startingUp()) @@ -2987,7 +2987,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate: } } -void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e) +void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e) { // This operation only makes sense after the QGuiApplication constructor runs if (QCoreApplication::startingUp()) @@ -3002,7 +3002,7 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } -void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) +void QGuiApplicationPrivate::processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) { // This operation only makes sense after the QGuiApplication constructor runs if (QCoreApplication::startingUp()) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 145e764244..79c1a1c820 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -139,10 +139,10 @@ public: static void updateFilteredScreenOrientation(QScreen *screen); static void reportScreenOrientationChange(QScreen *screen); - static void reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e); - static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); - static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e); - static void reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e); + static void processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e); + static void processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); + static void processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e); + static void processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e); static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce); static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e); 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) diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h index 97fe3fed03..e9d64c8a29 100644 --- a/src/gui/kernel/qplatformscreen.h +++ b/src/gui/kernel/qplatformscreen.h @@ -123,6 +123,8 @@ public: virtual void setOrientationUpdateMask(Qt::ScreenOrientations mask); virtual QWindow *topLevelAt(const QPoint &point) const; + QWindowList windows() const; + virtual QList<QPlatformScreen *> virtualSiblings() const; const QPlatformScreen *screenForPosition(const QPoint &point) const; |