summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-09-08 15:44:47 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-09-10 17:28:11 +0200
commit7238123521708ec94edd816d5b668978c002b17a (patch)
tree5b9ff50b539009c54f92764c3cbeef885af023ba /src/plugins/platforms/xcb
parentb3c991ae8f9da6d8eb26f10b3d4ab08587588c9e (diff)
X11: set fallback logical DPI to 96
Returning physical DPI from logicalDpi() is problematic, as explained in commit 77e04acb. The most predictable implementation is to never return physical DPI from QPlaformScreen::logicalDpi(). Other platform plugins already does this, and this change brings xcb in line with the rest of Qt. We have the QPlatformScreen::physicalSize() API which covers returning physical DPI (indirectly); Options for selecting which one to use can be implemented on top of these (see QT_USE_PHYSICAL_DPI). Change-Id: Ifc41229fa63734a2eb06b3acefd97b2ed3e57c2d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index c17be437ce..82e256657c 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -690,12 +690,12 @@ QDpi QXcbScreen::logicalDpi() const
if (forcedDpi > 0)
return QDpi(forcedDpi, forcedDpi);
- // Fall back to physical virtual desktop DPI, but prevent
- // using DPI values lower than 96. This ensuers that connecting
- // to e.g. a TV works somewhat predictabilly.
- QDpi virtualDesktopPhysicalDPi = m_virtualDesktop->dpi();
- return QDpi(std::max(virtualDesktopPhysicalDPi.first, 96.0),
- std::max(virtualDesktopPhysicalDPi.second, 96.0));
+ // Fall back to 96 DPI in case no logical DPI is set. We don't want to
+ // return physical DPI here, since that is a differnt type of DPI: Logical
+ // DPI typically accounts for user preference and viewing distance, and is
+ // quantized into DPI classes (96, 144, 192, etc); pysical DPI is an exact
+ // physical measure.
+ return QDpi(96, 96);
}
QPlatformCursor *QXcbScreen::cursor() const