Commit 1278ebee authored by Nate Graham's avatar Nate Graham 🔩
Browse files

Re-add Force Font DPI spinbox on Wayland

People are using this feature to work around Wayland's terrible
fractional scaling implementation that makes everything super blurry. I
can't in good conscience tell them to use it anyway because it really
does look so bad. :( See https://bugs.kde.org/show_bug.cgi?id=433269.

This reverts commit 65defdde
This reverts commit 40afa58a

BUG: 433115
FIXED-IN: 5.21.2


(cherry picked from commit 62842ac6)
parent 78f885a1
......@@ -129,9 +129,10 @@ void KFonts::load()
void KFonts::save()
{
auto dpiItem = fontsAASettings()->findItem("forceFontDPI");
auto dpiWaylandItem = fontsAASettings()->findItem("forceFontDPIWayland");
auto antiAliasingItem = fontsAASettings()->findItem("antiAliasing");
Q_ASSERT(dpiItem && antiAliasingItem);
if (dpiItem->isSaveNeeded() || antiAliasingItem->isSaveNeeded()) {
Q_ASSERT(dpiItem && dpiWaylandItem && antiAliasingItem);
if (dpiItem->isSaveNeeded() || dpiWaylandItem->isSaveNeeded() || antiAliasingItem->isSaveNeeded()) {
emit aliasingChangeApplied();
}
......
......@@ -264,6 +264,7 @@ FontsAASettings::FontsAASettings(QObject *parent)
addItemInternal("subPixel", defaultSubPixel(), &FontsAASettings::subPixelChanged);
addItemInternal("hinting", defaultHinting(), &FontsAASettings::hintingChanged);
connect(this, &FontsAASettings::forceFontDPIWaylandChanged, this, &FontsAASettings::dpiChanged);
connect(this, &FontsAASettings::forceFontDPIChanged, this, &FontsAASettings::dpiChanged);
}
......
......@@ -5,6 +5,10 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kcmfonts" />
<group name="General">
<entry name="forceFontDPIWayland" type="UInt">
<label>Force font DPI Wayland</label>
<default>0</default>
</entry>
<entry name="forceFontDPI" type="UInt">
<label>Force font DPI on X11</label>
<default>0</default>
......
......@@ -362,9 +362,6 @@ KCM.SimpleKCM {
RowLayout {
Layout.preferredWidth: formLayout.maxImplicitWidth
// We don't want people messing with the font DPI on Wayland;
// they should always be using the global scaling system instead
visible: Qt.platform.pluginName === "xcb"
QtControls.CheckBox {
id: dpiCheckBox
......@@ -375,6 +372,13 @@ KCM.SimpleKCM {
dpiTwiddledMessage.visible = checked
}
// dpiSpinBox will set forceFontDPI or forceFontDPIWayland,
// so only one SettingStateBinding will be activated at a time.
KCM.SettingStateBinding {
configObject: kcm.fontsAASettings
settingName: "forceFontDPIWayland"
extraEnabledConditions: antiAliasingCheckBox.checked && !kcm.fontsAASettings.isAaImmutable
}
KCM.SettingStateBinding {
configObject: kcm.fontsAASettings
settingName: "forceFontDPI"
......@@ -390,6 +394,13 @@ KCM.SimpleKCM {
to: 999
from: 1
// dpiSpinBox will set forceFontDPI or forceFontDPIWayland,
// so only one SettingStateBinding will be activated at a time.
KCM.SettingStateBinding {
configObject: kcm.fontsAASettings
settingName: "forceFontDPIWayland"
extraEnabledConditions: dpiCheckBox.enabled && dpiCheckBox.checked
}
KCM.SettingStateBinding {
configObject: kcm.fontsAASettings
settingName: "forceFontDPI"
......
......@@ -438,8 +438,13 @@ void runRdb(uint flags)
int dpi;
//even though this sets up the X rdb, we want to use the value the
//user has set to use when under wayland - as X apps will be scaled by the compositor
if (KWindowSystem::isPlatformWayland()) {
dpi = 96; // Don't change the default DPI at all under wayland
dpi = cfgfonts.readEntry("forceFontDPIWayland", 0);
if (dpi == 0) { //with wayland we want xwayland to run at 96 dpi (unless set otherwise) as we have wayland scaling on top
dpi = 96;
}
} else {
dpi = cfgfonts.readEntry("forceFontDPI", 0);
}
......
......@@ -29,6 +29,14 @@ int main(int argc, char **argv)
createConfigDirectory();
setupCursor(true);
{
KConfig fonts(QStringLiteral("kcmfonts"));
KConfigGroup group = fonts.group("General");
auto dpiSetting = group.readEntry("forceFontDPIWayland", 96);
auto dpi = dpiSetting == 0 ? 96 : dpiSetting;
qputenv("QT_WAYLAND_FORCE_DPI", QByteArray::number(dpi));
}
// Query whether org.freedesktop.locale1 is available. If it is, try to
// set XKB_DEFAULT_{MODEL,LAYOUT,VARIANT,OPTIONS} accordingly.
{
......
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