summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index abbd1fe999..769d30888b 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -490,8 +490,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
{
QPlatformScreen *currentScreen = screen();
QPlatformScreen *fallback = currentScreen;
- //QRect::center can return a value outside the rectangle if it's empty
- const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
+ // QRect::center can return a value outside the rectangle if it's empty.
+ // Apply mapToGlobal() in case it is a foreign/embedded window.
+ const QPoint center =
+ mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center());
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
const auto screens = currentScreen->virtualSiblings();