summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qmath_p.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h
index c710ee462a..bc7bb320b7 100644
--- a/src/gui/painting/qmath_p.h
+++ b/src/gui/painting/qmath_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
static const qreal Q_PI = qreal(3.14159265358979323846); // pi
static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi
static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2
+static const qreal Q_MM_PER_INCH = 25.4;
inline int qIntSqrtInt(int v)
{
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 6452186bbf..4f0c3ba6bb 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -50,6 +50,7 @@
#include <QDebug>
#include <qpa/qwindowsysteminterface.h>
+#include <private/qmath_p.h>
QT_BEGIN_NAMESPACE
@@ -242,8 +243,8 @@ QImage::Format QXcbScreen::format() const
QDpi QXcbScreen::logicalDpi() const
{
- return QDpi(25.4 * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
- 25.4 * m_virtualSize.height() / m_virtualSizeMillimeters.height());
+ return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
+ Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
}
QPlatformCursor *QXcbScreen::cursor() const
@@ -315,6 +316,9 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation);
+ QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QPlatformScreen::screen(),
+ Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
+ Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
}
void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)