Client: Set key repeat rate and delay from the repeat_info event

[ChangeLog][QPA plugin] Clients now follow the keyboard key repeat delay and
interval configured by the compositor.

Change-Id: I8a88d341a2bb648d70f95494fe19e941273ae31b
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
This commit is contained in:
Johan Klokkhammer Helsing 2018-10-11 10:37:40 +02:00 committed by Johan Helsing
parent 833e1cef06
commit 3b4dd0f24b
2 changed files with 11 additions and 2 deletions

View File

@ -781,7 +781,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
#if QT_CONFIG(xkbcommon_evdev) #if QT_CONFIG(xkbcommon_evdev)
mRepeatSym = sym; mRepeatSym = sym;
#endif #endif
mRepeatTimer.setInterval(400); mRepeatTimer.setInterval(mRepeatDelay);
mRepeatTimer.start(); mRepeatTimer.start();
} else if (mRepeatCode == code) { } else if (mRepeatCode == code) {
mRepeatTimer.stop(); mRepeatTimer.stop();
@ -790,7 +790,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
void QWaylandInputDevice::Keyboard::repeatKey() void QWaylandInputDevice::Keyboard::repeatKey()
{ {
mRepeatTimer.setInterval(25); mRepeatTimer.setInterval(mRepeatRate);
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
#if QT_CONFIG(xkbcommon_evdev) #if QT_CONFIG(xkbcommon_evdev)
mRepeatSym, mNativeModifiers, mRepeatSym, mNativeModifiers,
@ -830,6 +830,12 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial,
#endif #endif
} }
void QWaylandInputDevice::Keyboard::keyboard_repeat_info(int32_t rate, int32_t delay)
{
mRepeatRate = rate;
mRepeatDelay = delay;
}
void QWaylandInputDevice::Touch::touch_down(uint32_t serial, void QWaylandInputDevice::Touch::touch_down(uint32_t serial,
uint32_t time, uint32_t time,
struct wl_surface *surface, struct wl_surface *surface,

View File

@ -204,6 +204,7 @@ public:
uint32_t mods_latched, uint32_t mods_latched,
uint32_t mods_locked, uint32_t mods_locked,
uint32_t group) override; uint32_t group) override;
void keyboard_repeat_info(int32_t rate, int32_t delay) override;
QWaylandInputDevice *mParent = nullptr; QWaylandInputDevice *mParent = nullptr;
QPointer<QWaylandWindow> mFocus; QPointer<QWaylandWindow> mFocus;
@ -219,6 +220,8 @@ public:
int mRepeatKey; int mRepeatKey;
uint32_t mRepeatCode; uint32_t mRepeatCode;
uint32_t mRepeatTime; uint32_t mRepeatTime;
int mRepeatRate = 25;
int mRepeatDelay = 400;
QString mRepeatText; QString mRepeatText;
#if QT_CONFIG(xkbcommon_evdev) #if QT_CONFIG(xkbcommon_evdev)
xkb_keysym_t mRepeatSym; xkb_keysym_t mRepeatSym;