Client: Upgrade Seat support to v7

- Finish implementing support for axis_wheel_tilt. Some code existed
already, hence only debug and unit test are changed

- The unit test is renamed to seat as the only change is new events.
There is nothing deprecated and therefore no need to test backwards
compatibility.

- Set our supported version number to 7

No version bumps of libwayland are needed, our current minimum version
includes wl_seat v7.

Task-number: QTBUG-96258
Change-Id: Ief18bc5cef3fcbd0699dd52ccad513d47c6c010b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
David Edmundson 2021-09-11 16:02:43 +01:00
parent 715a39f026
commit 06f069bed8
7 changed files with 44 additions and 37 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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());

View File

@ -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());
}

View File

@ -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
)

View File

@ -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<Seat>();
uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch;
int version = 5;
int version = 7;
add<Seat>(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<Seat>()->resourceMap().size(), 1);
QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 5);
QCOMPOSITOR_COMPARE(get<Seat>()->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<Event> m_events;
};
void tst_seatv5::simpleAxis_data()
void tst_seat::simpleAxis_data()
{
QTest::addColumn<uint>("axis");
QTest::addColumn<qreal>("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<uint>("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<Event> 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"

View File

@ -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