From dafe9e23638c4fe272044fae91380a225e19193a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 29 Jan 2021 15:41:23 +0100 Subject: Windows: Fix frame margins calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/windows') 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 ®ion, 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(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()}; -- cgit v1.2.3