summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-05-03 14:26:01 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-03 14:50:22 +0200
commit60fefff22f7fa259a8bdb023d1ec9a57cfd34bfb (patch)
treeab33ab6eeb08f7a72e0196ee5025790aaa01b1dd /src/plugins/platforms/xcb
parentb1e0a71997111fc296001bc94e0da8342cf0ac97 (diff)
parentda32360ffc3c7b677355c37ae54c89637c18047f (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index df458e85d7..e1bd8eb752 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -750,7 +750,12 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation)
m_sizeMillimeters = sizeInMillimeters(geometry.size(), virtualDpi());
qreal dpi = geometry.width() / physicalSize().width() * qreal(25.4);
- m_pixelDensity = qMax(1, qRound(dpi/96));
+ qreal rawFactor = dpi/96;
+ int roundedFactor = qFloor(rawFactor);
+ // Round up for .8 and higher. This favors "small UI" over "large UI".
+ if (rawFactor - roundedFactor >= 0.8)
+ roundedFactor = qCeil(rawFactor);
+ m_pixelDensity = qMax(1, roundedFactor);
m_geometry = geometry;
m_availableGeometry = geometry & m_virtualDesktop->workArea();
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);