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