Commit 5114494b authored by David Edmundson's avatar David Edmundson
Browse files

[effects/startupfeedback] Port to KConfigWatcher

Summary:
startupfeedback is a special case, rather than loading our own config we
load settings from klaunchrc.

In order to reload this means leaking kwin specific calls into the
launch feedback KCM. Using the new KConfigWatcher syntax, we can use a
generic solution for all this code.

Test Plan:
Changed the value in KCM
Opened dolphin
cursor did the right thing

Reviewers: zzag

Reviewed By: zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25834
parent fde3b1f6
......@@ -82,6 +82,7 @@ StartupFeedbackEffect::StartupFeedbackEffect()
, m_type(BouncingFeedback)
, m_blinkingShader(nullptr)
, m_cursorSize(0)
, m_configWatcher(KConfigWatcher::create(KSharedConfig::openConfig("klaunchrc", KConfig::NoGlobals)))
{
for (int i = 0; i < 5; ++i) {
m_bouncingTextures[i] = nullptr;
......@@ -94,7 +95,11 @@ StartupFeedbackEffect::StartupFeedbackEffect()
connect(m_startupInfo, &KStartupInfo::gotRemoveStartup, this, &StartupFeedbackEffect::gotRemoveStartup);
connect(m_startupInfo, &KStartupInfo::gotStartupChange, this, &StartupFeedbackEffect::gotStartupChange);
connect(effects, &EffectsHandler::mouseChanged, this, &StartupFeedbackEffect::slotMouseChanged);
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this]() {
reconfigure(ReconfigureAll);
});
reconfigure(ReconfigureAll);
}
StartupFeedbackEffect::~StartupFeedbackEffect()
......@@ -117,11 +122,10 @@ bool StartupFeedbackEffect::supported()
void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
{
Q_UNUSED(flags)
KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals);
KConfigGroup c = conf.group("FeedbackStyle");
KConfigGroup c = m_configWatcher->config()->group("FeedbackStyle");
const bool busyCursor = c.readEntry("BusyCursor", true);
c = conf.group("BusyCursorSettings");
c = m_configWatcher->config()->group("BusyCursorSettings");
m_startupInfo->setTimeout(c.readEntry("Timeout", s_startupDefaultTimeout));
const bool busyBlinking = c.readEntry("Blinking", false);
const bool busyBouncing = c.readEntry("Bouncing", true);
......
......@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QObject>
#include <kwineffects.h>
#include <KStartupInfo>
#include <KConfigWatcher>
class KSelectionOwner;
namespace KWin
......@@ -87,6 +88,7 @@ private:
QRect m_currentGeometry, m_dirtyRect;
GLShader *m_blinkingShader;
int m_cursorSize;
KConfigWatcher::Ptr m_configWatcher;
};
} // namespace
......
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