[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
This commit is contained in:
parent
fde3b1f6bb
commit
5114494b57
2 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue