From 667f3abc50082b4f8c68bc6ddd3c896dcd2635bc Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Feb 2015 15:42:03 +0100 Subject: Proper geometry conversion for devicePixelRatio > 1 Rounding the bottom right corner position means that the size can change when the window moves. For windows we need to round the size up in order to have a stable geometry. Task-number: QTBUG-45076 Change-Id: I9a85a5915bfec55b0a7295be137b6fbfd7b53095 Reviewed-by: Friedemann Kleint Reviewed-by: Laszlo Agocs Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 78ccf8a3e9..45245a1454 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -155,6 +155,11 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr) return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr); } +static inline QSize dpr_ceil(const QSize &s, int dpr) +{ + return QSize((s.width() + dpr - 1) / dpr, (s.height() + dpr - 1) / dpr); +} + static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) { return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr)); @@ -162,7 +167,7 @@ static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr) { - return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr); + return QRect(xRect.topLeft() / dpr, dpr_ceil(xRect.size(), dpr)); } // Returns \c true if we should set WM_TRANSIENT_FOR on \a w -- cgit v1.2.3