X11: restrict fallback logical DPI to 96 and higher
QXcbScreen determines logical DPI using the following priority: 1) use Xft.dpi if set 2) virtual desktop size / virtual desktop physical size (This change does not restrict or alter the value obtained from Xft.dpi in any way) The fallback option 2) has several problems: - It is a physical DPI, which does not account for viewing distance or user preference - It is a global value for the entire virtual desktop (not per-screen) - X servers usually fake the virtual desktop physical size such that the computed DPI ends up at 96; in cases where this does not happen we can end up with a surprising DPI value. We might be better off just hardcoding 96 here, to avoid picking up an incorrect physical DPI when for example connecting to a TV (as reported in QTBUG-67928). This change does not go as far as hardcoding 96, but instead restricts the (fallback) DPI value to be 96 or higher. Pick-to: 5.15 Task-number: QTBUG-67928 Change-Id: Ieea6c7a137261282b40302fb4c19273c5def10af Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
ed813c19fa
commit
77e04acb4e
@ -698,7 +698,12 @@ QDpi QXcbScreen::logicalDpi() const
|
||||
if (forcedDpi > 0)
|
||||
return QDpi(forcedDpi, forcedDpi);
|
||||
|
||||
return m_virtualDesktop->dpi();
|
||||
// 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));
|
||||
}
|
||||
|
||||
QPlatformCursor *QXcbScreen::cursor() const
|
||||
|
Loading…
Reference in New Issue
Block a user