diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-04-25 11:31:34 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-08-23 03:40:35 +0200 |
commit | 900f2cb6f7070b4d426f3b83787ac489b8a2e827 (patch) | |
tree | 48f5a9fb87a01c3e5be8c9f436d0607602d24956 /src/plugins/platforms/xcb | |
parent | dd9da0441b18d1946a7b3d28e4e8819b1921de6f (diff) |
Update Dpi and scale factor computation
Remove pixelScale() in favor of logicalBaseDpi(). Compute scale factor
based on logical DPI and logical base DPI, or optionally based on the
physical DPI.
Add policies for running the scale factor and adjusting the logical
DPI reported to the application. The policies are set via environment
variables:
QT_SCALE_FACTOR_ROUNDING_POLICY=Round|Ceil|Floor|RoundPreferFloor|PassThrough
QT_DPI_ADJUSTMENT_POLICY=AdjustDpi|DontAdjustDpi|AdjustUpOnly
QT_USE_PHYSICAL_DPI=0|1
Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io>
Task-number: QTBUG-53022
Change-Id: I4846f223186df665eb0a9c827eaef0a96d1f458f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 13 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.h | 3 |
2 files changed, 1 insertions, 15 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8c34bd9c91..145f40ce80 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -679,11 +679,6 @@ QDpi QXcbScreen::logicalDpi() const return m_virtualDesktop->dpi(); } -qreal QXcbScreen::pixelDensity() const -{ - return m_pixelDensity; -} - QPlatformCursor *QXcbScreen::cursor() const { return m_cursor; @@ -747,14 +742,6 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = sizeInMillimeters(geometry.size(), m_virtualDesktop->dpi()); - qreal dpi = forcedDpi(); - if (dpi <= 0) - dpi = geometry.width() / physicalSize().width() * qreal(25.4); - - // Use 128 as a reference DPI on small screens. This favors "small UI" over "large UI". - qreal referenceDpi = physicalSize().width() <= 320 ? 128 : 96; - - m_pixelDensity = qMax(1, qRound(dpi/referenceDpi)); m_geometry = geometry; m_availableGeometry = geometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ec3b07bfb7..62931d2500 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -161,7 +161,7 @@ public: QImage::Format format() const override; QSizeF physicalSize() const override { return m_sizeMillimeters; } QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override { return QDpi(96, 96); }; QPlatformCursor *cursor() const override; qreal refreshRate() const override { return m_refreshRate; } Qt::ScreenOrientation orientation() const override { return m_orientation; } @@ -227,7 +227,6 @@ private: Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; QXcbCursor *m_cursor; int m_refreshRate = 60; - int m_pixelDensity = 1; QEdidParser m_edid; }; |