From 075ae987c48ce732e6a22c1eba71023fa0ea1775 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Jan 2015 15:44:12 +0100 Subject: X11 devicePixelRatio screen mapping fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix screen detection and window geometry when screens have different displayPixelRatios. We must use the native coordinate system to figure out which screen a window belongs to. Also, when a window moves to a screen with a different devicePixelRatio, we must recalculate the Qt geometry. Task-number: QTBUG-43713 Change-Id: I93063e37354ff88f3c8a13320b76dfb272e43a9c Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbscreen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 73f27c7117..f8d68c68f0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -77,8 +77,10 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, // virtual size is known (probably back-calculated from DPI and resolution) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = m_virtualSizeMillimeters; - if (m_geometry.isEmpty()) + if (m_geometry.isEmpty()) { m_geometry = QRect(QPoint(), m_virtualSize/dpr); + m_nativeGeometry = QRect(QPoint(), m_virtualSize); + } if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; @@ -461,6 +463,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) m_devicePixelRatio = qRound(dpi/96); const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr); + m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); -- cgit v1.2.3