diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-10-11 10:37:40 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-10-17 14:24:46 +0000 |
commit | 7b3ec2816e2ba0b225f38a75ca76564e7367c89b (patch) | |
tree | 4c7dc073ff6b04d780a254f9de5949736088e660 | |
parent | 0761173a046f8f10cc185cff9c524ae6a5284556 (diff) |
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>
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 10 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 37c6fbe9f..5b5ad7a32 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -781,7 +781,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #if QT_CONFIG(xkbcommon_evdev) mRepeatSym = sym; #endif - mRepeatTimer.setInterval(400); + mRepeatTimer.setInterval(mRepeatDelay); mRepeatTimer.start(); } else if (mRepeatCode == code) { mRepeatTimer.stop(); @@ -790,7 +790,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::repeatKey() { - mRepeatTimer.setInterval(25); + mRepeatTimer.setInterval(mRepeatRate); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, #if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, @@ -830,6 +830,12 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, #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, uint32_t time, struct wl_surface *surface, diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index e1f0f5070..d1ff0da23 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -204,6 +204,7 @@ public: uint32_t mods_latched, uint32_t mods_locked, uint32_t group) override; + void keyboard_repeat_info(int32_t rate, int32_t delay) override; QWaylandInputDevice *mParent = nullptr; QPointer<QWaylandWindow> mFocus; @@ -219,6 +220,8 @@ public: int mRepeatKey; uint32_t mRepeatCode; uint32_t mRepeatTime; + int mRepeatRate = 25; + int mRepeatDelay = 400; QString mRepeatText; #if QT_CONFIG(xkbcommon_evdev) xkb_keysym_t mRepeatSym; |