diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-11-21 15:47:45 +0100 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2015-11-28 10:40:48 +0000 |
commit | d18db983c679140224cc85a3ec6990b93f443a40 (patch) | |
tree | a8f0b5c029e7380bf8e044353b4c60ca625ba1df /src/compositor/compositor_api/qwaylandkeyboard.cpp | |
parent | 77503ab20b4408fdf32b94400bc54f7ea5f628dc (diff) |
Add keyboard repeat rate and delay
Add getter and setter for repeat rate and delay.
This has no effect until the compositor has support for Wayland 1.6
which has not yet been done due to CI lacking a recent library version.
Change-Id: I55a9c48dcb974d5fff437fd79148ce02d74beccb
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandkeyboard.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandkeyboard.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp index e19977349..76e9a39a6 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.cpp +++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp @@ -70,6 +70,8 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandInputDevice *seat) , keymap_fd(-1) , xkb_state(0) #endif + , repeatRate(40) + , repeatDelay(400) { #ifndef QT_NO_WAYLAND_XKB initXKB(); @@ -454,6 +456,66 @@ void QWaylandKeyboard::sendKeyReleaseEvent(uint code) } /*! + * Returns the current repeat rate. + */ +quint32 QWaylandKeyboard::repeatRate() const +{ + Q_D(const QWaylandKeyboard); + return d->repeatRate; +} + +/*! + * Sets the repeat rate to \a rate. + */ +void QWaylandKeyboard::setRepeatRate(quint32 rate) +{ + Q_D(QWaylandKeyboard); + + if (d->repeatRate == rate) + return; + + // TODO: As of today 2015-11-25, we don't support Wayland 1.6 + // because of CI limitations. Once the protocol is updated + // we can send keyboard repeat information to the client as + // per wl_seat version 4 + + qWarning("Setting QWaylandKeyboard::repeatRate has no effect until QtWaylandCompositor support wl_seat 4"); + + d->repeatRate = rate; + Q_EMIT repeatRateChanged(rate); +} + +/*! + * Returns the current repeat delay. + */ +quint32 QWaylandKeyboard::repeatDelay() const +{ + Q_D(const QWaylandKeyboard); + return d->repeatDelay; +} + +/*! + * Sets the repeat delay to \a delay. + */ +void QWaylandKeyboard::setRepeatDelay(quint32 delay) +{ + Q_D(QWaylandKeyboard); + + if (d->repeatDelay == delay) + return; + + // TODO: As of today 2015-11-25, we don't support Wayland 1.6 + // because of CI limitations. Once the protocol is updated + // we can send keyboard repeat information to the client as + // per wl_seat version 4 + + qWarning("Setting QWaylandKeyboard::repeatDelay has no effect until QtWaylandCompositor support wl_seat 4"); + + d->repeatDelay = delay; + Q_EMIT repeatDelayChanged(delay); +} + +/*! * Returns the currently focused surface. */ QWaylandSurface *QWaylandKeyboard::focus() const |