QPlatformWindow::screenForGeometry(): Do not call mapToGlobal() on top level geometry.

Use mapToGlobal() only for foreign windows passing relative coordinates.
Amend change 9915630d08.

Task-number: QTBUG-50206
Task-number: QTBUG-51320
Change-Id: Idee60cc8ea8004c0355ce78a00f807798836b49c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2016-02-23 15:26:49 +01:00
parent 45ae0cb780
commit 9f134750a1

View File

@ -486,8 +486,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
QPlatformScreen *fallback = currentScreen; QPlatformScreen *fallback = currentScreen;
// QRect::center can return a value outside the rectangle if it's empty. // QRect::center can return a value outside the rectangle if it's empty.
// Apply mapToGlobal() in case it is a foreign/embedded window. // Apply mapToGlobal() in case it is a foreign/embedded window.
const QPoint center = QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center()); if (window()->type() == Qt::ForeignWindow)
center = mapToGlobal(center - newGeometry.topLeft());
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) { if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {