Commit 243d0b6d authored by Bhushan Shah's avatar Bhushan Shah 📱
Browse files

kcm/fonts: set initial settings correctly

Summary:
During initial load we check if certain settings are set or not, and if
they are not set, we set it to rgb/slight (recommended settings by
Plasma team).

however state management of this is broken, previous flow was,

- try to get configuration
- if configuration is not available, set state to desired settings
- set original state to current state value(!)
- write configuration to the file once complete state is written (all
  other settings)

This is fine, when setting is changing from something other then none or
not-set. But if it is not-set, both original state and current state
ended up being desired settings, which write function would happily
ignore since it thinks config never changed.

So, if we encounter not-set configuration, preserve that as a original
setting to get configs written correctly.

This patch on it's own have no visible effect, kcm is still broken due
to lack of kcminit which writes correct configuration at startup, but
this is one of obvious bugfix for follow-up patch series.

Test Plan: with upcoming patch to add kcminit, it correctly applies rgb/slight

Reviewers: #plasma, fvogt, davidedmundson

Reviewed By: fvogt

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25140
parent 47d17ebe
......@@ -150,23 +150,28 @@ void FontAASettings::load()
excludeToChanged();
excludeFromChanged();
KXftConfig::SubPixel::Type spType;
if (!xft.getSubPixelType(spType) || KXftConfig::SubPixel::NotSet == spType) {
// start with empty subpixel type
KXftConfig::SubPixel::Type spType = KXftConfig::SubPixel::NotSet;
// get subpixel type from config
xft.getSubPixelType(spType);
m_originalState.subPixel = spType;
// if it is not set, we set it to rgb
if (spType == KXftConfig::SubPixel::NotSet) {
spType = KXftConfig::SubPixel::Rgb;
}
setSubPixel(spType);
m_originalState.subPixel = spType;
m_state.subPixelHasLocalConfig = xft.subPixelTypeHasLocalConfig();
KXftConfig::Hint::Style hStyle;
if (!xft.getHintStyle(hStyle) || KXftConfig::Hint::NotSet == hStyle) {
// start with empty hint style
KXftConfig::Hint::Style hStyle = KXftConfig::Hint::NotSet;
// get value from config;
xft.getHintStyle(hStyle);
m_originalState.hinting = hStyle;
// if it is not set, we set it to slight hinting
if (hStyle == KXftConfig::Hint::NotSet) {
hStyle = KXftConfig::Hint::Slight;
}
setHinting(hStyle);
m_originalState.hinting = hStyle;
m_state.hintingHasLocalConfig = xft.hintStyleHasLocalConfig();
KConfig _cfgfonts("kcmfonts");
......
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