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.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 04532e82aa..9f2c6af51f 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -486,8 +486,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
QPlatformScreen *fallback = currentScreen;
// 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());
+ QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
+ if (window()->type() == Qt::ForeignWindow)
+ center = mapToGlobal(center - newGeometry.topLeft());
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {