From cd254c8f47bfd4c9227bebd953fcf1098d9089f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 15 Sep 2015 10:29:06 +0200 Subject: [PATCH] [wayland] Configure key repeat We take the configuration from the kcminputrc config file, group keyboard (see plasma-desktop.git/kcms/keyboard/kcmmisc.cpp) The values are only used for libinput. For backends providing input events we expect to get repeated key events anyway. --- input.cpp | 16 ++++++++++++++++ input.h | 1 + 2 files changed, 17 insertions(+) diff --git a/input.cpp b/input.cpp index 85d070b2e9..ea3161f311 100644 --- a/input.cpp +++ b/input.cpp @@ -293,6 +293,7 @@ InputRedirection::InputRedirection(QObject *parent) } #endif connect(kwinApp(), &Application::workspaceCreated, this, &InputRedirection::setupWorkspace); + reconfigure(); } InputRedirection::~InputRedirection() @@ -370,9 +371,24 @@ void InputRedirection::setupWorkspace() m_xkb->getGroup()); } ); + connect(workspace(), &Workspace::configChanged, this, &InputRedirection::reconfigure); } } +void InputRedirection::reconfigure() +{ +#if HAVE_INPUT + if (Application::usesLibinput()) { + const auto config = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("keyboard")); + const int delay = config.readEntry("RepeatDelay", 660); + const int rate = config.readEntry("RepeatRate", 25); + const bool enabled = config.readEntry("KeyboardRepeating", 0) == 0; + + waylandServer()->seat()->setKeyRepeatInfo(enabled ? rate : 0, delay); + } +#endif +} + static KWayland::Server::SeatInterface *findSeat() { auto server = waylandServer(); diff --git a/input.h b/input.h index 0ec266ba53..203e18d0ef 100644 --- a/input.h +++ b/input.h @@ -209,6 +209,7 @@ private: bool areButtonsPressed() const; void updateKeyboardWindow(); void setupWorkspace(); + void reconfigure(); QPointF m_globalPointer; QHash m_pointerButtons; QScopedPointer m_xkb;