Commit 2b23256b authored by Nate Graham's avatar Nate Graham 🔩
Browse files

[KCM] Limit scale factor increment to 6.25% on X11

Summary:
Because of the nature of floating point math and various Qt and X11 bugs, limiting the
scale factor increment to 0.0625 (6.25% in percentage form) will improve the display in
many apps.

For more information, see the discussions in https://bugreports.qt.io/browse/QTBUG-66036 and
the following bug reports:
CCBUG: 412447
CCBUG: 390451
CCBUG: 373232

Depends on D24370
Depends on D24371

Test Plan: {F7500922}

Reviewers: #plasma, romangg, mart

Reviewed By: #plasma, romangg, mart

Subscribers: cullmann, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24373
parent 0f52663c
......@@ -77,14 +77,19 @@ ColumnLayout {
}
Controls.SpinBox {
id: spinbox
Layout.minimumWidth: Kirigami.Units.gridUnit * 6
// Because QQC2 SpinBox doesn't natively support decimal step
// sizes: https://bugreports.qt.io/browse/QTBUG-67349
property real factor: 20.0
property real factor: 16.0
property real realValue: value / factor
from : 1.0 * factor
to : 3.0 * factor
stepSize: 0.05 * factor
// On X11 We set the increment to this weird value to compensate
// for inherent difficulties with floating-point math and this
// Qt bug: https://bugreports.qt.io/browse/QTBUG-66036
stepSize: 0.0625 * factor
value: kcm.globalScale * factor
validator: DoubleValidator {
bottom: Math.min(spinbox.from, spinbox.to)*spinbox.factor
......@@ -111,8 +116,8 @@ ColumnLayout {
id: weirdScaleFactorMsg
Kirigami.FormData.isSection: true
Layout.fillWidth: true
type: Kirigami.MessageType.Warning
text: i18n("Scale factors that are not a multiple of 25% may cause visual glitches in applications. Consider setting the scale factor to a multiple of 25% and adjusting the font size instead.")
type: Kirigami.MessageType.Info
text: i18n("The global scale factor is limited to multiples of 6.25% to minimize visual glitches in applications using the X11 windowing system.")
visible: false
showCloseButton: true
}
......
......@@ -359,8 +359,8 @@ bool Output::writeGlobalPart(const KScreen::OutputPtr &output, QVariantMap &info
info[QStringLiteral("metadata")] = metadata(output);
info[QStringLiteral("rotation")] = output->rotation();
// Round scale to two digits
info[QStringLiteral("scale")] = int(output->scale() * 100 + 0.5) / 100.;
// Round scale to four digits
info[QStringLiteral("scale")] = int(output->scale() * 10000 + 0.5) / 10000.;
QVariantMap modeInfo;
float refreshRate = -1.;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment