[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.
This commit is contained in:
Martin Gräßlin 2015-09-15 10:29:06 +02:00
parent 1ab663436d
commit cd254c8f47
2 changed files with 17 additions and 0 deletions

View file

@ -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();

View file

@ -209,6 +209,7 @@ private:
bool areButtonsPressed() const;
void updateKeyboardWindow();
void setupWorkspace();
void reconfigure();
QPointF m_globalPointer;
QHash<uint32_t, PointerButtonState> m_pointerButtons;
QScopedPointer<Xkb> m_xkb;