diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index 3fc7206d25..db3303003e 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -516,6 +516,20 @@ private: bool m_touch = false; }; +void keyboardKeyPressed(quint32 key, quint32 time); +void keyboardKeyReleased(quint32 key, quint32 time); +void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta = 0, + InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); +void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta = 0, + InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); +void pointerButtonPressed(quint32 button, quint32 time); +void pointerButtonReleased(quint32 button, quint32 time); +void pointerMotion(const QPointF &position, quint32 time); +void touchCancel(); +void touchDown(qint32 id, const QPointF &pos, quint32 time); +void touchMotion(qint32 id, const QPointF &pos, quint32 time); +void touchUp(qint32 id, quint32 time); + /** * Creates a Wayland Connection in a dedicated thread and creates various * client side objects which can be used to create windows. diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index 5ac4527bcb..fdc5e2f0ba 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -1371,5 +1371,79 @@ bool VirtualInputDevice::isLidSwitch() const { return false; } + +void keyboardKeyPressed(quint32 key, quint32 time) +{ + auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); + Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyPressed, time, virtualKeyboard); +} + +void keyboardKeyReleased(quint32 key, quint32 time) +{ + auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); + Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyReleased, time, virtualKeyboard); +} + +void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta, + InputRedirection::PointerAxisSource source) +{ + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisHorizontal, + delta, discreteDelta, source, time, virtualPointer); +} + +void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta, + InputRedirection::PointerAxisSource source) +{ + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisVertical, + delta, discreteDelta, source, time, virtualPointer); +} + +void pointerButtonPressed(quint32 button, quint32 time) +{ + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerButtonChanged(button, + InputRedirection::PointerButtonState::PointerButtonPressed, + time, virtualPointer); +} + +void pointerButtonReleased(quint32 button, quint32 time) +{ + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerButtonChanged(button, + InputRedirection::PointerButtonState::PointerButtonReleased, + time, virtualPointer); +} + +void pointerMotion(const QPointF &position, quint32 time) +{ + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerMotionAbsolute(position, time, virtualPointer); +} + +void touchCancel() +{ + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + Q_EMIT virtualTouch->touchCanceled(virtualTouch); +} + +void touchDown(qint32 id, const QPointF &pos, quint32 time) +{ + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + Q_EMIT virtualTouch->touchDown(id, pos, time, virtualTouch); +} + +void touchMotion(qint32 id, const QPointF &pos, quint32 time) +{ + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + Q_EMIT virtualTouch->touchMotion(id, pos, time, virtualTouch); +} + +void touchUp(qint32 id, quint32 time) +{ + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + Q_EMIT virtualTouch->touchUp(id, time, virtualTouch); +} } }