summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandkeyboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandkeyboard.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp62
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