summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qscreen.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-03-29 10:11:27 +0100
committerLiang Qi <liang.qi@qt.io>2019-03-29 20:55:24 +0000
commit300940a6c9eb0f74cefda7d76a5d19f56ec50253 (patch)
treeb17f5a6f4289890872a17e29f682d46e302b69cd /src/gui/kernel/qscreen.cpp
parent6ed2ea86db63c72a38a60543da5a95d3543d39b1 (diff)
Revert "Remove deprecated screen maintenance functions in QPlatformIntegration"
This reverts commit 7a64ffb7738dc975b5008800901c8cd8ab238a0f. This change landed in 5.13 too early, so there is no baseline with both APIs in dev. This will be reverted later when the fixes for leaf modules landed. Task-number: QTBUG-74816 Change-Id: Ie5ee41fbf6be53b8fcb4289ac1ec3974e5bf6e42 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Diffstat (limited to 'src/gui/kernel/qscreen.cpp')
-rw-r--r--src/gui/kernel/qscreen.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 952023dd1b..f208eb02be 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -106,18 +106,9 @@ void QScreenPrivate::setPlatformScreen(QPlatformScreen *screen)
*/
QScreen::~QScreen()
{
- // Remove screen
- const bool wasPrimary = QGuiApplication::primaryScreen() == this;
- QGuiApplicationPrivate::screen_list.removeOne(this);
- QGuiApplicationPrivate::resetCachedDevicePixelRatio();
-
- if (!qGuiApp)
+ if (!qApp)
return;
- QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
- if (wasPrimary && newPrimaryScreen)
- emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
-
// Allow clients to manage windows that are affected by the screen going
// away, before we fall back to moving them to the primary screen.
emit qApp->screenRemoved(this);
@@ -125,8 +116,11 @@ QScreen::~QScreen()
if (QGuiApplication::closingDown())
return;
- bool movingFromVirtualSibling = newPrimaryScreen
- && newPrimaryScreen->handle()->virtualSiblings().contains(handle());
+ QScreen *primaryScreen = QGuiApplication::primaryScreen();
+ if (this == primaryScreen)
+ return;
+
+ bool movingFromVirtualSibling = primaryScreen && primaryScreen->handle()->virtualSiblings().contains(handle());
// Move any leftover windows to the primary screen
const auto allWindows = QGuiApplication::allWindows();
@@ -135,7 +129,7 @@ QScreen::~QScreen()
continue;
const bool wasVisible = window->isVisible();
- window->setScreen(newPrimaryScreen);
+ window->setScreen(primaryScreen);
// Re-show window if moved from a virtual sibling screen. Otherwise
// leave it up to the application developer to show the window.