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 65defddee95db6738d5e2c80f6c7b373fde451a1
This reverts commit 40afa58ab9bf0d0808edb891f9cd855316a82411

BUG: 433115
FIXED-IN: 5.21.2
wilder-5.22
Nate Graham 5 years ago
parent cf9f722ef2
commit 62842ac6fd
  1. 5
      kcms/fonts/fonts.cpp
  2. 1
      kcms/fonts/fontsaasettings.cpp
  3. 4
      kcms/fonts/fontsaasettingsbase.kcfg
  4. 17
      kcms/fonts/package/contents/ui/main.qml
  5. 7
      kcms/krdb/krdb.cpp
  6. 8
      startkde/startplasma-wayland.cpp

@ -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);
}

@ -30,6 +30,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.
{

Loading…
Cancel
Save