diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d2c469dc..241981909 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -352,6 +352,7 @@ set(kwin_KDEINIT_SRCS focuschain.cpp globalshortcuts.cpp input.cpp + input_event.cpp keyboard_input.cpp pointer_input.cpp touch_input.cpp diff --git a/autotests/libinput/CMakeLists.txt b/autotests/libinput/CMakeLists.txt index 1b5cb7b6b..be552c0e1 100644 --- a/autotests/libinput/CMakeLists.txt +++ b/autotests/libinput/CMakeLists.txt @@ -6,3 +6,12 @@ add_executable(testLibinputDevice ${testLibinputDevice_SRCS}) target_link_libraries( testLibinputDevice Qt5::Test) add_test(kwin-testLibinputDevice testLibinputDevice) ecm_mark_as_test(testLibinputDevice) + +######################################################## +# Test Input Events +######################################################## +set( testInputEvents_SRCS input_event_test.cpp mock_libinput.cpp ../../libinput/device.cpp ../../input_event.cpp ) +add_executable(testInputEvents ${testInputEvents_SRCS}) +target_link_libraries( testInputEvents Qt5::Test Qt5::Gui) +add_test(kwin-testInputEvents testInputEvents) +ecm_mark_as_test(testInputEvents) diff --git a/autotests/libinput/input_event_test.cpp b/autotests/libinput/input_event_test.cpp new file mode 100644 index 000000000..2b517877c --- /dev/null +++ b/autotests/libinput/input_event_test.cpp @@ -0,0 +1,150 @@ +/******************************************************************** +KWin - the KDE window manager +This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include "mock_libinput.h" +#include "../../libinput/device.h" +#include "../input_event.h" + +#include + +using namespace KWin; +using namespace KWin::LibInput; + +class InputEventsTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void testInitMouseEvent_data(); + void testInitMouseEvent(); + void testInitKeyEvent_data(); + void testInitKeyEvent(); + void testInitWheelEvent_data(); + void testInitWheelEvent(); +}; + +void InputEventsTest::testInitMouseEvent_data() +{ + QTest::addColumn("type"); + + QTest::newRow("Press") << QEvent::MouseButtonPress; + QTest::newRow("Release") << QEvent::MouseButtonRelease; + QTest::newRow("Move") << QEvent::MouseMove; +} + +void InputEventsTest::testInitMouseEvent() +{ + // this test verifies that a MouseEvent is constructed correctly + + // first create the test LibInput::Device + libinput_device device; + Device d(&device); + + QFETCH(QEvent::Type, type); + // now create our own event + MouseEvent event(type, QPointF(100, 200), Qt::LeftButton, Qt::LeftButton | Qt::RightButton, + Qt::ShiftModifier | Qt::ControlModifier, 300, &d); + // and verify the contract of QMouseEvent + QCOMPARE(event.type(), type); + QCOMPARE(event.globalPos(), QPoint(100, 200)); + QCOMPARE(event.screenPos(), QPointF(100, 200)); + QCOMPARE(event.localPos(), QPointF(100, 200)); + QCOMPARE(event.button(), Qt::LeftButton); + QCOMPARE(event.buttons(), Qt::LeftButton | Qt::RightButton); + QCOMPARE(event.modifiers(), Qt::ShiftModifier | Qt::ControlModifier); + QCOMPARE(event.timestamp(), 300ul); + // and our custom argument + QCOMPARE(event.device(), &d); +} + +void InputEventsTest::testInitKeyEvent_data() +{ + QTest::addColumn("type"); + QTest::addColumn("autorepeat"); + + QTest::newRow("Press") << QEvent::KeyPress << false; + QTest::newRow("Repeat") << QEvent::KeyPress << true; + QTest::newRow("Release") << QEvent::KeyRelease << false; +} + +void InputEventsTest::testInitKeyEvent() +{ + // this test verifies that a KeyEvent is constructed correctly + + // first create the test LibInput::Device + libinput_device device; + Device d(&device); + + // setup event + QFETCH(QEvent::Type, type); + QFETCH(bool, autorepeat); + KeyEvent event(type, Qt::Key_Space, Qt::ShiftModifier | Qt::ControlModifier, 200, 300, + QStringLiteral(" "), autorepeat, 400, &d); + // and verify the contract of QKeyEvent + QCOMPARE(event.type(), type); + QCOMPARE(event.isAutoRepeat(), autorepeat); + QCOMPARE(event.key(), int(Qt::Key_Space)); + QCOMPARE(event.nativeScanCode(), 200u); + QCOMPARE(event.nativeVirtualKey(), 300u); + QCOMPARE(event.text(), QStringLiteral(" ")); + QCOMPARE(event.count(), 1); + QCOMPARE(event.nativeModifiers(), 0u); + QCOMPARE(event.modifiers(), Qt::ShiftModifier | Qt::ControlModifier); + QCOMPARE(event.timestamp(), 400ul); + // and our custom argument + QCOMPARE(event.device(), &d); +} + +void InputEventsTest::testInitWheelEvent_data() +{ + QTest::addColumn("orientation"); + QTest::addColumn("delta"); + QTest::addColumn("expectedAngleDelta"); + + QTest::newRow("horiz") << Qt::Horizontal << 3.0 << QPoint(3, 0); + QTest::newRow("vert") << Qt::Vertical << 2.0 << QPoint(0, 2); +} + +void InputEventsTest::testInitWheelEvent() +{ + // this test verifies that a WheelEvent is constructed correctly + + // first create the test LibInput::Device + libinput_device device; + Device d(&device); + + // setup event + QFETCH(Qt::Orientation, orientation); + QFETCH(qreal, delta); + WheelEvent event(QPointF(100, 200), delta, orientation, Qt::LeftButton | Qt::RightButton, + Qt::ShiftModifier | Qt::ControlModifier, 300, &d); + // compare QWheelEvent contract + QCOMPARE(event.type(), QEvent::Wheel); + QCOMPARE(event.posF(), QPointF(100, 200)); + QCOMPARE(event.globalPosF(), QPointF(100, 200)); + QCOMPARE(event.buttons(), Qt::LeftButton | Qt::RightButton); + QCOMPARE(event.modifiers(), Qt::ShiftModifier | Qt::ControlModifier); + QCOMPARE(event.timestamp(), 300ul); + QTEST(event.angleDelta(), "expectedAngleDelta"); + // and our custom argument + QCOMPARE(event.device(), &d); + +} + +QTEST_GUILESS_MAIN(InputEventsTest) +#include "input_event_test.moc" diff --git a/input.cpp b/input.cpp index 0da1d2a09..a4e270934 100644 --- a/input.cpp +++ b/input.cpp @@ -35,6 +35,7 @@ along with this program. If not, see . #include "workspace.h" #if HAVE_INPUT #include "libinput/connection.h" +#include "libinput/device.h" #endif #include "platform.h" #include "shell_client.h" @@ -1105,14 +1106,14 @@ void InputRedirection::setupLibInput() connect(conn, &LibInput::Connection::pointerAxisChanged, m_pointer, &PointerInputRedirection::processAxis); connect(conn, &LibInput::Connection::keyChanged, m_keyboard, &KeyboardInputRedirection::processKey); connect(conn, &LibInput::Connection::pointerMotion, this, - [this] (QPointF delta, uint32_t time) { - m_pointer->processMotion(m_pointer->pos() + delta, time); + [this] (QPointF delta, uint32_t time, LibInput::Device *device) { + m_pointer->processMotion(m_pointer->pos() + delta, time, device); } ); connect(conn, &LibInput::Connection::pointerMotionAbsolute, this, - [this] (QPointF orig, QPointF screen, uint32_t time) { + [this] (QPointF orig, QPointF screen, uint32_t time, LibInput::Device *device) { Q_UNUSED(orig) - m_pointer->processMotion(screen, time); + m_pointer->processMotion(screen, time, device); } ); connect(conn, &LibInput::Connection::touchDown, m_touch, &TouchInputRedirection::processDown); diff --git a/input_event.cpp b/input_event.cpp new file mode 100644 index 000000000..87fdb41a5 --- /dev/null +++ b/input_event.cpp @@ -0,0 +1,50 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include "input_event.h" + +namespace KWin +{ + +MouseEvent::MouseEvent(QEvent::Type type, const QPointF &pos, Qt::MouseButton button, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, + quint32 timestamp, LibInput::Device *device) + : QMouseEvent(type, pos, pos, button, buttons, modifiers) + , m_device(device) +{ + setTimestamp(timestamp); +} + +WheelEvent::WheelEvent(const QPointF &pos, qreal delta, Qt::Orientation orientation, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device) + : QWheelEvent(pos, pos, QPoint(), (orientation == Qt::Horizontal) ? QPoint(delta, 0) : QPoint(0, delta), delta, orientation, buttons, modifiers) + , m_device(device) +{ + setTimestamp(timestamp); +} + +KeyEvent::KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers, quint32 code, quint32 keysym, + const QString &text, bool autorepeat, quint32 timestamp, LibInput::Device *device) + : QKeyEvent(type, key, modifiers, code, keysym, 0, text, autorepeat) + , m_device(device) +{ + setTimestamp(timestamp); +} + +} diff --git a/input_event.h b/input_event.h new file mode 100644 index 000000000..1203a559a --- /dev/null +++ b/input_event.h @@ -0,0 +1,76 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#ifndef KWIN_INPUT_EVENT_H +#define KWIN_INPUT_EVENT_H +#include + +namespace KWin +{ + +namespace LibInput +{ +class Device; +} + +class MouseEvent : public QMouseEvent +{ +public: + explicit MouseEvent(QEvent::Type type, const QPointF &pos, Qt::MouseButton button, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device); + + LibInput::Device *device() const { + return m_device; + } + +private: + LibInput::Device *m_device; +}; + +class WheelEvent : public QWheelEvent +{ +public: + explicit WheelEvent(const QPointF &pos, qreal delta, Qt::Orientation orientation, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device); + + LibInput::Device *device() const { + return m_device; + } + +private: + LibInput::Device *m_device; +}; + +class KeyEvent : public QKeyEvent +{ +public: + explicit KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers, quint32 code, quint32 keysym, + const QString &text, bool autorepeat, quint32 timestamp, LibInput::Device *device); + + LibInput::Device *device() const { + return m_device; + } + +private: + LibInput::Device *m_device; +}; + +} + +#endif diff --git a/keyboard_input.cpp b/keyboard_input.cpp index 26287e832..cf18a6137 100644 --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "keyboard_input.h" +#include "input_event.h" #include "abstract_client.h" #include "options.h" #include "utils.h" @@ -447,7 +448,7 @@ void KeyboardInputRedirection::update() } } -void KeyboardInputRedirection::processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time) +void KeyboardInputRedirection::processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time, LibInput::Device *device) { if (!m_inited) { return; @@ -478,15 +479,15 @@ void KeyboardInputRedirection::processKey(uint32_t key, InputRedirection::Keyboa } const xkb_keysym_t keySym = m_xkb->toKeysym(key); - QKeyEvent event(type, - m_xkb->toQtKey(keySym), - m_xkb->modifiers(), - key, - keySym, - 0, - m_xkb->toString(m_xkb->toKeysym(key)), - autoRepeat); - event.setTimestamp(time); + KeyEvent event(type, + m_xkb->toQtKey(keySym), + m_xkb->modifiers(), + key, + keySym, + m_xkb->toString(m_xkb->toKeysym(key)), + autoRepeat, + time, + device); if (state == InputRedirection::KeyboardKeyPressed) { if (m_xkb->shouldKeyRepeat(key) && waylandServer()->seat()->keyRepeatDelay() != 0) { QTimer *timer = new QTimer; diff --git a/keyboard_input.h b/keyboard_input.h index dbb286562..8bac81cb9 100644 --- a/keyboard_input.h +++ b/keyboard_input.h @@ -42,6 +42,11 @@ namespace KWin class InputRedirection; class Toplevel; +namespace LibInput +{ +class Device; +} + class Xkb { public: @@ -96,7 +101,7 @@ public: /** * @internal */ - void processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time); + void processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time, LibInput::Device *device = nullptr); /** * @internal */ diff --git a/libinput/connection.cpp b/libinput/connection.cpp index 820cb3253..626b3cd9f 100644 --- a/libinput/connection.cpp +++ b/libinput/connection.cpp @@ -283,7 +283,7 @@ void Connection::processEvents() } case LIBINPUT_EVENT_KEYBOARD_KEY: { KeyEvent *ke = static_cast(event.data()); - emit keyChanged(ke->key(), ke->state(), ke->time()); + emit keyChanged(ke->key(), ke->state(), ke->time(), ke->device()); break; } case LIBINPUT_EVENT_POINTER_AXIS: { @@ -312,13 +312,13 @@ void Connection::processEvents() } } for (auto it = deltas.constBegin(); it != deltas.constEnd(); ++it) { - emit pointerAxisChanged(it.key(), it.value().delta, it.value().time); + emit pointerAxisChanged(it.key(), it.value().delta, it.value().time, pe->device()); } break; } case LIBINPUT_EVENT_POINTER_BUTTON: { PointerEvent *pe = static_cast(event.data()); - emit pointerButtonChanged(pe->button(), pe->buttonState(), pe->time()); + emit pointerButtonChanged(pe->button(), pe->buttonState(), pe->time(), pe->device()); break; } case LIBINPUT_EVENT_POINTER_MOTION: { @@ -336,35 +336,35 @@ void Connection::processEvents() break; } } - emit pointerMotion(delta, latestTime); + emit pointerMotion(delta, latestTime, pe->device()); break; } case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: { PointerEvent *pe = static_cast(event.data()); - emit pointerMotionAbsolute(pe->absolutePos(), pe->absolutePos(m_size), pe->time()); + emit pointerMotionAbsolute(pe->absolutePos(), pe->absolutePos(m_size), pe->time(), pe->device()); break; } case LIBINPUT_EVENT_TOUCH_DOWN: { TouchEvent *te = static_cast(event.data()); - emit touchDown(te->id(), te->absolutePos(m_size), te->time()); + emit touchDown(te->id(), te->absolutePos(m_size), te->time(), te->device()); break; } case LIBINPUT_EVENT_TOUCH_UP: { TouchEvent *te = static_cast(event.data()); - emit touchUp(te->id(), te->time()); + emit touchUp(te->id(), te->time(), te->device()); break; } case LIBINPUT_EVENT_TOUCH_MOTION: { TouchEvent *te = static_cast(event.data()); - emit touchMotion(te->id(), te->absolutePos(m_size), te->time()); + emit touchMotion(te->id(), te->absolutePos(m_size), te->time(), te->device()); break; } case LIBINPUT_EVENT_TOUCH_CANCEL: { - emit touchCanceled(); + emit touchCanceled(event->device()); break; } case LIBINPUT_EVENT_TOUCH_FRAME: { - emit touchFrame(); + emit touchFrame(event->device()); break; } default: diff --git a/libinput/connection.h b/libinput/connection.h index af5546546..f6b3676da 100644 --- a/libinput/connection.h +++ b/libinput/connection.h @@ -83,16 +83,16 @@ public: } Q_SIGNALS: - void keyChanged(quint32 key, KWin::InputRedirection::KeyboardKeyState, quint32 time); - void pointerButtonChanged(quint32 button, KWin::InputRedirection::PointerButtonState state, quint32 time); - void pointerMotionAbsolute(QPointF orig, QPointF screen, quint32 time); - void pointerMotion(QPointF delta, quint32 time); - void pointerAxisChanged(KWin::InputRedirection::PointerAxis axis, qreal delta, quint32 time); - void touchFrame(); - void touchCanceled(); - void touchDown(qint32 id, const QPointF &absolutePos, quint32 time); - void touchUp(qint32 id, quint32 time); - void touchMotion(qint32 id, const QPointF &absolutePos, quint32 time); + void keyChanged(quint32 key, KWin::InputRedirection::KeyboardKeyState, quint32 time, KWin::LibInput::Device *device); + void pointerButtonChanged(quint32 button, KWin::InputRedirection::PointerButtonState state, quint32 time, KWin::LibInput::Device *device); + void pointerMotionAbsolute(QPointF orig, QPointF screen, quint32 time, KWin::LibInput::Device *device); + void pointerMotion(QPointF delta, quint32 time, KWin::LibInput::Device *device); + void pointerAxisChanged(KWin::InputRedirection::PointerAxis axis, qreal delta, quint32 time, KWin::LibInput::Device *device); + void touchFrame(KWin::LibInput::Device *device); + void touchCanceled(KWin::LibInput::Device *device); + void touchDown(qint32 id, const QPointF &absolutePos, quint32 time, KWin::LibInput::Device *device); + void touchUp(qint32 id, quint32 time, KWin::LibInput::Device *device); + void touchMotion(qint32 id, const QPointF &absolutePos, quint32 time, KWin::LibInput::Device *device); void hasKeyboardChanged(bool); void hasAlphaNumericKeyboardChanged(bool); void hasPointerChanged(bool); diff --git a/pointer_input.cpp b/pointer_input.cpp index 13b7ae577..7a8bfac17 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -20,6 +20,7 @@ along with this program. If not, see . #include "pointer_input.h" #include "platform.h" #include "effects.h" +#include "input_event.h" #include "screens.h" #include "shell_client.h" #include "wayland_cursor_theme.h" @@ -159,15 +160,14 @@ void PointerInputRedirection::init() updateAfterScreenChange(); } -void PointerInputRedirection::processMotion(const QPointF &pos, uint32_t time) +void PointerInputRedirection::processMotion(const QPointF &pos, uint32_t time, LibInput::Device *device) { if (!m_inited) { return; } updatePosition(pos); - QMouseEvent event(QEvent::MouseMove, m_pos.toPoint(), m_pos.toPoint(), - Qt::NoButton, m_qtButtons, m_input->keyboardModifiers()); - event.setTimestamp(time); + MouseEvent event(QEvent::MouseMove, m_pos, Qt::NoButton, m_qtButtons, + m_input->keyboardModifiers(), time, device); const auto &filters = m_input->filters(); for (auto it = filters.begin(), end = filters.end(); it != end; it++) { @@ -177,7 +177,7 @@ void PointerInputRedirection::processMotion(const QPointF &pos, uint32_t time) } } -void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time) +void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device) { if (!m_inited) { return; @@ -197,9 +197,8 @@ void PointerInputRedirection::processButton(uint32_t button, InputRedirection::P return; } - QMouseEvent event(type, m_pos.toPoint(), m_pos.toPoint(), - buttonToQtMouseButton(button), m_qtButtons, m_input->keyboardModifiers()); - event.setTimestamp(time); + MouseEvent event(type, m_pos, buttonToQtMouseButton(button), m_qtButtons, + m_input->keyboardModifiers(), time, device); const auto &filters = m_input->filters(); for (auto it = filters.begin(), end = filters.end(); it != end; it++) { @@ -209,7 +208,7 @@ void PointerInputRedirection::processButton(uint32_t button, InputRedirection::P } } -void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time) +void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device) { if (!m_inited) { return; @@ -220,13 +219,9 @@ void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qr emit m_input->pointerAxisChanged(axis, delta); - QWheelEvent wheelEvent(m_pos, m_pos, QPoint(), - (axis == InputRedirection::PointerAxisHorizontal) ? QPoint(delta, 0) : QPoint(0, delta), - delta, + WheelEvent wheelEvent(m_pos, delta, (axis == InputRedirection::PointerAxisHorizontal) ? Qt::Horizontal : Qt::Vertical, - m_qtButtons, - m_input->keyboardModifiers()); - wheelEvent.setTimestamp(time); + m_qtButtons, m_input->keyboardModifiers(), time, device); const auto &filters = m_input->filters(); for (auto it = filters.begin(), end = filters.end(); it != end; it++) { diff --git a/pointer_input.h b/pointer_input.h index e0c87136d..fa16c3fb9 100644 --- a/pointer_input.h +++ b/pointer_input.h @@ -42,6 +42,11 @@ namespace Decoration class DecoratedClientImpl; } +namespace LibInput +{ +class Device; +} + class KWIN_EXPORT PointerInputRedirection : public InputDeviceHandler { Q_OBJECT @@ -72,15 +77,15 @@ public: /** * @internal */ - void processMotion(const QPointF &pos, uint32_t time); + void processMotion(const QPointF &pos, uint32_t time, LibInput::Device *device = nullptr); /** * @internal */ - void processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time); + void processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device = nullptr); /** * @internal */ - void processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time); + void processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device = nullptr); private: void updatePosition(const QPointF &pos); diff --git a/tests/libinputtest.cpp b/tests/libinputtest.cpp index 8cec2d852..3446dc727 100644 --- a/tests/libinputtest.cpp +++ b/tests/libinputtest.cpp @@ -19,6 +19,7 @@ */ #include "../input.h" #include "../libinput/connection.h" +#include "../libinput/device.h" #include "../logind.h" #include diff --git a/touch_input.cpp b/touch_input.cpp index 06a39cdab..635c47a0c 100644 --- a/touch_input.cpp +++ b/touch_input.cpp @@ -144,8 +144,9 @@ void TouchInputRedirection::removeId(quint32 internalId) m_idMapper.remove(internalId); } -void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 time) +void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device) { + Q_UNUSED(device) if (!m_inited) { return; } @@ -159,8 +160,9 @@ void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 t m_windowUpdatedInCycle = false; } -void TouchInputRedirection::processUp(qint32 id, quint32 time) +void TouchInputRedirection::processUp(qint32 id, quint32 time, LibInput::Device *device) { + Q_UNUSED(device) if (!m_inited) { return; } @@ -174,8 +176,9 @@ void TouchInputRedirection::processUp(qint32 id, quint32 time) m_windowUpdatedInCycle = false; } -void TouchInputRedirection::processMotion(qint32 id, const QPointF &pos, quint32 time) +void TouchInputRedirection::processMotion(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device) { + Q_UNUSED(device) if (!m_inited) { return; } diff --git a/touch_input.h b/touch_input.h index 97cfb6bd9..900c0056a 100644 --- a/touch_input.h +++ b/touch_input.h @@ -37,6 +37,11 @@ namespace Decoration class DecoratedClientImpl; } +namespace LibInput +{ +class Device; +} + class TouchInputRedirection : public InputDeviceHandler { Q_OBJECT @@ -47,9 +52,9 @@ public: void update(const QPointF &pos = QPointF()); void init(); - void processDown(qint32 id, const QPointF &pos, quint32 time); - void processUp(qint32 id, quint32 time); - void processMotion(qint32 id, const QPointF &pos, quint32 time); + void processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device = nullptr); + void processUp(qint32 id, quint32 time, LibInput::Device *device = nullptr); + void processMotion(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device = nullptr); void cancel(); void frame();