summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2021-01-29 15:41:23 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2021-02-01 22:43:59 +0100
commitdafe9e23638c4fe272044fae91380a225e19193a (patch)
tree74c12afef0fb2340a5c8da78af38509ff1ce1234
parent7d1cda9de3e88db33696675c9723209d0f876cdb (diff)
Windows: Fix frame margins calculation
Passing nullptr to QHighDpi::toNativePixels() is seldom correct, and will work only on the main screen. Instead, call frameMargins() on the platform window (instead of on the QWindow) and get the margins directly in native pixels. Pick-to: 5.15 Fixes: QTBUG-90716 Change-Id: Id7b31ec3246010c367781b64ed832c589bbaeb0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index e9d1915201..e42237db13 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -91,9 +91,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) {
// Windows with alpha: Use blend function to update.
QRect r = QHighDpi::toNativePixels(window->frameGeometry(), window);
- QPoint frameOffset(QHighDpi::toNativePixels(QPoint(window->frameMargins().left(), window->frameMargins().top()),
- static_cast<const QWindow *>(nullptr)));
- QRect dirtyRect = br.translated(offset + frameOffset);
+ QMargins frameMargins = rw->frameMargins();
+ QRect dirtyRect = br.translated(offset + QPoint(frameMargins.left(), frameMargins.top()));
SIZE size = {r.width(), r.height()};
POINT ptDst = {r.x(), r.y()};