diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-02-25 15:42:03 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-03-25 12:17:06 +0000 |
commit | 667f3abc50082b4f8c68bc6ddd3c896dcd2635bc (patch) | |
tree | 78b5d445452dc17a7905ab62bf6522deef26306b /src/plugins/platforms/xcb | |
parent | 2e4a107e7e97a2dc36471cbd795ec94096f1a771 (diff) |
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 <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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 |