summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 7c60ca06f9..44d0bb3f55 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 != 0);
+ 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);