Commit d96eb389 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

wayland: Reload key-repeat settings when kcminputrc changes

At the moment, if key repeat settings are changed in the input kcm, kwin
will do nothing.
parent 2da1b321
......@@ -2092,7 +2092,6 @@ void InputRedirection::setupWorkspace()
);
}
);
connect(workspace(), &Workspace::configChanged, this, &InputRedirection::reconfigure);
m_keyboard->init();
m_pointer->init();
......@@ -2148,11 +2147,17 @@ void InputRedirection::setupInputFilters()
}
}
void InputRedirection::handleInputConfigChanged(const KConfigGroup &group)
{
if (group.name() == QLatin1String("Keyboard")) {
reconfigure();
}
}
void InputRedirection::reconfigure()
{
if (Application::usesLibinput()) {
auto inputConfig = InputConfig::self()->inputConfig();
inputConfig->reparseConfiguration();
auto inputConfig = m_inputConfigWatcher->config();
const auto config = inputConfig->group(QStringLiteral("Keyboard"));
const int delay = config.readEntry("RepeatDelay", 660);
const int rate = config.readEntry("RepeatRate", 25);
......@@ -2293,10 +2298,14 @@ void InputRedirection::setupLibInput()
}
}
);
m_inputConfigWatcher = KConfigWatcher::create(InputConfig::self()->inputConfig());
connect(m_inputConfigWatcher.data(), &KConfigWatcher::configChanged,
this, &InputRedirection::handleInputConfigChanged);
reconfigure();
}
setupTouchpadShortcuts();
reconfigure();
}
void InputRedirection::setupTouchpadShortcuts()
......
......@@ -17,6 +17,7 @@
#include <QPointer>
#include <config-kwin.h>
#include <KConfigWatcher>
#include <KSharedConfig>
#include <QSet>
......@@ -296,6 +297,9 @@ Q_SIGNALS:
void hasAlphaNumericKeyboardChanged(bool set);
void hasTabletModeSwitchChanged(bool set);
private Q_SLOTS:
void handleInputConfigChanged(const KConfigGroup &group);
private:
void setupLibInput();
void setupTouchpadShortcuts();
......@@ -318,6 +322,7 @@ private:
QVector<InputEventFilter*> m_filters;
QVector<InputEventSpy*> m_spies;
KConfigWatcher::Ptr m_inputConfigWatcher;
KWIN_SINGLETON(InputRedirection)
friend InputRedirection *input();
......
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