Make logicalDpi consistent in relation to device pixel ratio

In GNOME/Unity XCB, logical DPI is scaled by device pixel ratio, and on
Macs logical DPI is constant but pixel ratio is based on physical DPI,
making logical DPI effectively physical DPI divided by pixel ratio.

This patch ensure the same logic is used for other XCB desktops.

Change-Id: I60f24618cd49f6b34a6ff1eff317883d191d3491
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
This commit is contained in:
Allan Sandfeld Jensen 2015-06-03 10:18:38 +02:00 committed by Jani Heikkinen
parent cf452e20f9
commit 769cc4d878

View File

@ -361,11 +361,11 @@ QDpi QXcbScreen::logicalDpi() const
if (overrideDpi)
return QDpi(overrideDpi, overrideDpi);
if (m_forcedDpi > 0) {
int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio());
int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio());
if (m_forcedDpi > 0)
return QDpi(m_forcedDpi/primaryDpr, m_forcedDpi/primaryDpr);
}
return virtualDpi();
QDpi vDpi = virtualDpi();
return QDpi(vDpi.first/primaryDpr, vDpi.second/primaryDpr);
}