diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 7f503ee1e24..3e59899de92 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -408,7 +408,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 7)) , mQDisplay(display) , mDisplay(display->wl_display()) { @@ -955,6 +955,8 @@ void QWaylandInputDevice::Pointer::pointer_axis_source(uint32_t source) case axis_source_continuous: qCDebug(lcQpaWaylandInput) << "Axis source continuous"; break; + case axis_source_wheel_tilt: + qCDebug(lcQpaWaylandInput) << "Axis source wheel tilt"; } mFrameData.axisSource = axis_source(source); } diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 167cc6070c5..accac45fa2c 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -11,7 +11,7 @@ add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) add_subdirectory(seatv4) -add_subdirectory(seatv5) +add_subdirectory(seat) add_subdirectory(surface) add_subdirectory(tabletv2) add_subdirectory(wl_connect) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 91a479e28d3..4dbeb7db4a6 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -66,9 +66,6 @@ private slots: void tst_datadevicev1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); QCOMPOSITOR_TRY_VERIFY(dataDevice()); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index f7a63d13ec6..0f0c16102f1 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -268,9 +268,6 @@ private slots: void tst_primaryselectionv1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); } diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seat/CMakeLists.txt similarity index 82% rename from tests/auto/wayland/seatv5/CMakeLists.txt rename to tests/auto/wayland/seat/CMakeLists.txt index f48d8613787..fe59acee068 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/seat/CMakeLists.txt @@ -4,9 +4,9 @@ ## tst_seatv5 Test: ##################################################################### -qt_internal_add_test(tst_seatv5 +qt_internal_add_test(tst_seat SOURCES - tst_seatv5.cpp + tst_seat.cpp PUBLIC_LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seat/tst_seat.cpp similarity index 95% rename from tests/auto/wayland/seatv5/tst_seatv5.cpp rename to tests/auto/wayland/seat/tst_seat.cpp index 7e59dbddd9f..b8405eb6f58 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -33,9 +33,9 @@ using namespace MockCompositor; -class SeatV5Compositor : public DefaultCompositor { +class SeatCompositor : public DefaultCompositor { public: - explicit SeatV5Compositor() + explicit SeatCompositor() { exec([this] { m_config.autoConfigure = true; @@ -43,13 +43,13 @@ public: removeAll(); uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; - int version = 5; + int version = 7; add(capabilities, version); }); } }; -class tst_seatv5 : public QObject, private SeatV5Compositor +class tst_seat : public QObject, private SeatCompositor { Q_OBJECT private slots: @@ -65,6 +65,7 @@ private slots: void fingerScroll(); void fingerScrollSlow(); void continuousScroll(); + void wheelDiscreteScroll_data(); void wheelDiscreteScroll(); // Touch tests @@ -76,19 +77,19 @@ private slots: void tapAndMoveInSameFrame(); }; -void tst_seatv5::bindsToSeat() +void tst_seat::bindsToSeat() { QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); - QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 5); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 7); } -void tst_seatv5::createsPointer() +void tst_seat::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 7); } -void tst_seatv5::setsCursorOnEnter() +void tst_seat::setsCursorOnEnter() { QRasterWindow window; window.resize(64, 64); @@ -104,7 +105,7 @@ void tst_seatv5::setsCursorOnEnter() QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); } -void tst_seatv5::usesEnterSerial() +void tst_seat::usesEnterSerial() { QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; @@ -166,7 +167,7 @@ public: QList m_events; }; -void tst_seatv5::simpleAxis_data() +void tst_seat::simpleAxis_data() { QTest::addColumn("axis"); QTest::addColumn("value"); @@ -180,7 +181,7 @@ void tst_seatv5::simpleAxis_data() QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; } -void tst_seatv5::simpleAxis() +void tst_seat::simpleAxis() { QFETCH(uint, axis); QFETCH(qreal, value); @@ -216,7 +217,7 @@ void tst_seatv5::simpleAxis() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::fingerScroll() +void tst_seat::fingerScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -313,7 +314,7 @@ void tst_seatv5::fingerScroll() } -void tst_seatv5::fingerScrollSlow() +void tst_seat::fingerScrollSlow() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -342,17 +343,27 @@ void tst_seatv5::fingerScrollSlow() } QCOMPARE(accumulated.y(), -1); } -void tst_seatv5::wheelDiscreteScroll() + +void tst_seat::wheelDiscreteScroll_data() +{ + QTest::addColumn("source"); + QTest::newRow("wheel") << uint(Pointer::axis_source_wheel); + QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt); +} + +void tst_seat::wheelDiscreteScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QFETCH(uint, source); + exec([=] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); p->sendFrame(c); - p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisSource(c, Pointer::axis_source(source)); p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); p->sendFrame(c); @@ -372,7 +383,7 @@ void tst_seatv5::wheelDiscreteScroll() } } -void tst_seatv5::continuousScroll() +void tst_seat::continuousScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -398,10 +409,10 @@ void tst_seatv5::continuousScroll() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::createsTouch() +void tst_seat::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 7); } class TouchWindow : public QRasterWindow { @@ -432,7 +443,7 @@ public: QList m_events; }; -void tst_seatv5::singleTap() +void tst_seat::singleTap() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -463,7 +474,7 @@ void tst_seatv5::singleTap() } } -void tst_seatv5::singleTapFloat() +void tst_seat::singleTapFloat() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -494,7 +505,7 @@ void tst_seatv5::singleTapFloat() } } -void tst_seatv5::multiTouch() +void tst_seat::multiTouch() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -566,7 +577,7 @@ void tst_seatv5::multiTouch() } } -void tst_seatv5::multiTouchUpAndMotionFrame() +void tst_seat::multiTouchUpAndMotionFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -615,7 +626,7 @@ void tst_seatv5::multiTouchUpAndMotionFrame() QVERIFY(window.m_events.empty()); } -void tst_seatv5::tapAndMoveInSameFrame() +void tst_seat::tapAndMoveInSameFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -647,5 +658,5 @@ void tst_seatv5::tapAndMoveInSameFrame() QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } -QCOMPOSITOR_TEST_MAIN(tst_seatv5) -#include "tst_seatv5.moc" +QCOMPOSITOR_TEST_MAIN(tst_seat) +#include "tst_seat.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index e575444cb44..94481b41f54 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -321,7 +321,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 5); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 7); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead