Commit 40067fdf authored by Nate Graham's avatar Nate Graham
Browse files

Only show "Force font DPI" feature on X11

Allowing users to manually change the font DPI independent of font sizes
and the global scale is already of questionable value on X11, but on
Wayland where Qt scaling is always used, it is an anachronism. So let's
only show it on X11. On Wayland, people can use the global scaling
feature in the KScreen KCM.

See also https://phabricator.kde.org/T9500
parent 73621879
......@@ -130,10 +130,9 @@ void KFonts::load()
void KFonts::save()
{
auto dpiItem = fontsAASettings()->findItem("forceFontDPI");
auto dpiWaylandItem = fontsAASettings()->findItem("forceFontDPIWayland");
auto antiAliasingItem = fontsAASettings()->findItem("antiAliasing");
Q_ASSERT(dpiItem && dpiWaylandItem && antiAliasingItem);
if (dpiItem->isSaveNeeded() || dpiWaylandItem->isSaveNeeded() || antiAliasingItem->isSaveNeeded()) {
Q_ASSERT(dpiItem && antiAliasingItem);
if (dpiItem->isSaveNeeded() || antiAliasingItem->isSaveNeeded()) {
emit aliasingChangeApplied();
}
......
......@@ -265,7 +265,6 @@ 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);
}
......@@ -318,11 +317,7 @@ void FontsAASettings::setAntiAliasing(bool antiAliasing)
int FontsAASettings::dpi() const
{
if (KWindowSystem::isPlatformWayland()) {
return forceFontDPIWayland();
} else {
return forceFontDPI();
}
return forceFontDPI();
}
void FontsAASettings::setDpi(int newDPI)
......@@ -330,11 +325,9 @@ void FontsAASettings::setDpi(int newDPI)
if (dpi() == newDPI) {
return;
}
if (KWindowSystem::isPlatformWayland()) {
setForceFontDPIWayland(newDPI);
} else {
setForceFontDPI(newDPI);
}
setForceFontDPI(newDPI);
emit dpiChanged();
}
......
......@@ -5,12 +5,8 @@
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 X11</label>
<label>Force font DPI on X11</label>
<default>0</default>
</entry>
</group>
......
......@@ -362,6 +362,9 @@ 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
......@@ -372,13 +375,6 @@ 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"
......@@ -394,13 +390,6 @@ 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"
......
......@@ -457,13 +457,8 @@ 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 = 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;
}
dpi = 96; // Don't change the default DPI at all under wayland
} else {
dpi = cfgfonts.readEntry( "forceFontDPI", 0);
}
......
......@@ -29,14 +29,6 @@ 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.
{
......
Supports Markdown
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