[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 #endif
connect(kwinApp(), &Application::workspaceCreated, this, &InputRedirection::setupWorkspace); connect(kwinApp(), &Application::workspaceCreated, this, &InputRedirection::setupWorkspace);
reconfigure();
} }
InputRedirection::~InputRedirection() InputRedirection::~InputRedirection()
@ -370,9 +371,24 @@ void InputRedirection::setupWorkspace()
m_xkb->getGroup()); 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() static KWayland::Server::SeatInterface *findSeat()
{ {
auto server = waylandServer(); auto server = waylandServer();

View file

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