summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbscreen.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-27 01:00:05 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-27 09:29:30 +0100
commit4054c0d6ed8bafe7ca68d981daf1be51a55fe6f1 (patch)
treeb4e000e7db3ef633983fab4dc1957721fd904657 /src/plugins/platforms/xcb/qxcbscreen.cpp
parent3ea7caed6f949953706aaa6ce00d79aa8ca15a60 (diff)
parent25101f0984e86aa30f34773eb5b2025f58086b71 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: .qmake.conf src/plugins/platforms/xcb/qxcbscreen.cpp src/widgets/accessible/qaccessiblewidget.cpp Change-Id: Ib3138e61ba7981610940509a7ff02ba2dd281bf0
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index cc84e836b4..2426b5243a 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -320,12 +320,22 @@ bool QXcbVirtualDesktop::xResource(const QByteArray &identifier,
static bool parseXftInt(const QByteArray& stringValue, int *value)
{
- Q_ASSERT(value != nullptr);
+ Q_ASSERT(value);
bool ok;
*value = stringValue.toInt(&ok);
return ok;
}
+static bool parseXftDpi(const QByteArray& stringValue, int *value)
+{
+ Q_ASSERT(value);
+ bool ok = parseXftInt(stringValue, value);
+ // Support GNOME 3 bug that wrote DPI with fraction:
+ if (!ok)
+ *value = qRound(stringValue.toDouble(&ok));
+ return ok;
+}
+
static QFontEngine::HintStyle parseXftHintStyle(const QByteArray& stringValue)
{
if (stringValue == "hintfull")
@@ -391,7 +401,7 @@ void QXcbVirtualDesktop::readXResources()
int value;
QByteArray stringValue;
if (xResource(r, "Xft.dpi:\t", stringValue)) {
- if (parseXftInt(stringValue, &value))
+ if (parseXftDpi(stringValue, &value))
m_forcedDpi = value;
} else if (xResource(r, "Xft.hintstyle:\t", stringValue)) {
m_hintStyle = parseXftHintStyle(stringValue);