Rename some SeatInterface methods following consistent naming scheme

This change renames methods that are used by the compositor to notify the
seat about input events.

There isn't anything special about the proposed naming scheme, for what
it is worth, it was established in weston. "notify" methods are used to
notify kwaylandserver about something, and "send" methods actually send
relevant events to wayland clients.
master
Vlad Zahorodnii 4 years ago
parent d7a1067a7a
commit 4e16b10e82

@ -251,15 +251,15 @@ void TestDataDevice::testDrag()
QFETCH(bool, success);
if (!hasGrab) {
// in case we don't have grab, still generate a pointer serial to make it more interesting
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
}
if (hasPointerFocus) {
m_seatInterface->setFocusedPointerSurface(surfaceInterface);
}
if (hasGrab) {
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
}
// TODO: This test would be better, if it could also test that a client trying to guess
@ -332,15 +332,15 @@ void TestDataDevice::testDragInternally()
QFETCH(bool, success);
if (!hasGrab) {
// in case we don't have grab, still generate a pointer serial to make it more interesting
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
}
if (hasPointerFocus) {
m_seatInterface->setFocusedPointerSurface(surfaceInterface);
}
if (hasGrab) {
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
}
// TODO: This test would be better, if it could also test that a client trying to guess

@ -206,8 +206,8 @@ void TestDragAndDrop::testPointerDragAndDrop()
QVERIFY(buttonPressSpy.isValid());
m_seatInterface->setFocusedPointerSurface(serverSurface);
m_seatInterface->setTimestamp(2);
m_seatInterface->pointerButtonPressed(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonPressSpy.wait());
QCOMPARE(buttonPressSpy.first().at(1).value<quint32>(), quint32(2));
@ -254,8 +254,8 @@ void TestDragAndDrop::testPointerDragAndDrop()
// simulate motion
m_seatInterface->setTimestamp(3);
m_seatInterface->setPointerPos(QPointF(3, 3));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPointF(3, 3));
m_seatInterface->notifyPointerFrame();
QVERIFY(dragMotionSpy.wait());
QCOMPARE(dragMotionSpy.count(), 1);
QCOMPARE(dragMotionSpy.first().first().toPointF(), QPointF(3, 3));
@ -267,8 +267,8 @@ void TestDragAndDrop::testPointerDragAndDrop()
QSignalSpy droppedSpy(m_dataDevice, &DataDevice::dropped);
QVERIFY(droppedSpy.isValid());
m_seatInterface->setTimestamp(4);
m_seatInterface->pointerButtonReleased(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(sourceDropSpy.isEmpty());
QVERIFY(droppedSpy.wait());
QCOMPARE(sourceDropSpy.count(), 1);
@ -307,7 +307,7 @@ void TestDragAndDrop::testTouchDragAndDrop()
m_seatInterface->setFocusedTouchSurface(serverSurface);
m_seatInterface->setTimestamp(2);
const qint32 touchId = 0;
m_seatInterface->touchDown(touchId, QPointF(50,50));
m_seatInterface->notifyTouchDown(touchId, QPointF(50,50));
QVERIFY(sequenceStartedSpy.wait());
QScopedPointer<TouchPoint> tp(sequenceStartedSpy.first().at(0).value<TouchPoint*>());
@ -357,7 +357,7 @@ void TestDragAndDrop::testTouchDragAndDrop()
// simulate motion
m_seatInterface->setTimestamp(3);
m_seatInterface->touchMove(touchId, QPointF(75, 75));
m_seatInterface->notifyTouchMotion(touchId, QPointF(75, 75));
QVERIFY(dragMotionSpy.wait());
QCOMPARE(dragMotionSpy.count(), 1);
QCOMPARE(dragMotionSpy.first().first().toPointF(), QPointF(75, 75));
@ -369,7 +369,7 @@ void TestDragAndDrop::testTouchDragAndDrop()
QSignalSpy droppedSpy(m_dataDevice, &DataDevice::dropped);
QVERIFY(droppedSpy.isValid());
m_seatInterface->setTimestamp(4);
m_seatInterface->touchUp(touchId);
m_seatInterface->notifyTouchUp(touchId);
QVERIFY(sourceDropSpy.isEmpty());
QVERIFY(droppedSpy.wait());
QCOMPARE(sourceDropSpy.count(), 1);
@ -405,8 +405,8 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
QVERIFY(buttonPressSpy.isValid());
m_seatInterface->setFocusedPointerSurface(serverSurface);
m_seatInterface->setTimestamp(2);
m_seatInterface->pointerButtonPressed(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonPressSpy.wait());
QCOMPARE(buttonPressSpy.first().at(1).value<quint32>(), quint32(2));
@ -453,8 +453,8 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
// simulate motion
m_seatInterface->setTimestamp(3);
m_seatInterface->setPointerPos(QPointF(3, 3));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPointF(3, 3));
m_seatInterface->notifyPointerFrame();
QVERIFY(dragMotionSpy.wait());
QCOMPARE(dragMotionSpy.count(), 1);
QCOMPARE(dragMotionSpy.first().first().toPointF(), QPointF(3, 3));
@ -474,8 +474,8 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
QSignalSpy droppedSpy(m_dataDevice, &DataDevice::dropped);
QVERIFY(droppedSpy.isValid());
m_seatInterface->setTimestamp(4);
m_seatInterface->pointerButtonReleased(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(!droppedSpy.wait(500));
// verify that we did not get any further input events
@ -513,10 +513,10 @@ void TestDragAndDrop::testPointerEventsIgnored()
// first simulate a few things
quint32 timestamp = 1;
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(10, 10));
m_seatInterface->notifyPointerMotion(QPointF(10, 10));
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
// verify that we have those
QVERIFY(axisSpy.wait());
QCOMPARE(axisSpy.count(), 1);
@ -527,8 +527,8 @@ void TestDragAndDrop::testPointerEventsIgnored()
// let's start the drag
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonPressed(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonSpy.wait());
QCOMPARE(buttonSpy.count(), 1);
m_dataDevice->startDrag(buttonSpy.first().first().value<quint32>(), m_dataSource, s.data());
@ -536,33 +536,33 @@ void TestDragAndDrop::testPointerEventsIgnored()
// now simulate all the possible pointer interactions
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonPressed(2);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(2);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonReleased(2);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(2);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Vertical, 5, 1, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setFocusedPointerSurface(nullptr);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setFocusedPointerSurface(serverSurface);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(50, 50));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPointF(50, 50));
m_seatInterface->notifyPointerFrame();
// last but not least, simulate the drop
QSignalSpy cancelledSpy(m_dataSource, &DataSource::cancelled);
QVERIFY(cancelledSpy.isValid());
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonReleased(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(cancelledSpy.wait());
// all the changes should have been ignored

@ -223,14 +223,14 @@ void TestPointerConstraints::testLockPointer()
m_seatInterface->setFocusedPointerSurface(serverSurface);
QSignalSpy pointerMotionSpy(m_pointer, &Pointer::motion);
QVERIFY(pointerMotionSpy.isValid());
m_seatInterface->setPointerPos(QPoint(0, 1));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPoint(0, 1));
m_seatInterface->notifyPointerFrame();
QVERIFY(pointerMotionSpy.wait());
serverLockedPointer->setLocked(true);
QCOMPARE(serverLockedPointer->isLocked(), true);
m_seatInterface->setPointerPos(QPoint(1, 1));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPoint(1, 1));
m_seatInterface->notifyPointerFrame();
QCOMPARE(lockedChangedSpy.count(), 1);
QCOMPARE(pointerMotionSpy.count(), 1);
QVERIFY(lockedSpy.isEmpty());
@ -257,8 +257,8 @@ void TestPointerConstraints::testLockPointer()
QCOMPARE(lockedSpy.count(), 1);
// now motion should work again
m_seatInterface->setPointerPos(QPoint(0, 1));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPoint(0, 1));
m_seatInterface->notifyPointerFrame();
QVERIFY(pointerMotionSpy.wait());
QCOMPARE(pointerMotionSpy.count(), 2);

@ -350,7 +350,7 @@ void TestWaylandSeat::testPointer()
QSignalSpy committedSpy(serverSurface, &KWaylandServer::SurfaceInterface::committed);
QVERIFY(committedSpy.wait());
m_seatInterface->setPointerPos(QPoint(20, 18));
m_seatInterface->notifyPointerMotion(QPoint(20, 18));
m_seatInterface->setFocusedPointerSurface(serverSurface, QPoint(10, 15));
Pointer *p = m_seat->createPointer(m_seat);
@ -399,8 +399,8 @@ void TestWaylandSeat::testPointer()
// test motion
m_seatInterface->setTimestamp(1);
m_seatInterface->setPointerPos(QPoint(10, 16));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPoint(10, 16));
m_seatInterface->notifyPointerFrame();
QVERIFY(motionSpy.wait());
QCOMPARE(frameSpy.count(), 4);
QCOMPARE(motionSpy.first().first().toPoint(), QPoint(0, 1));
@ -408,7 +408,7 @@ void TestWaylandSeat::testPointer()
// test relative motion
m_seatInterface->relativePointerMotion(QSizeF(1, 2), QSizeF(3, 4), quint64(-1));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerFrame();
QVERIFY(relativeMotionSpy.wait());
QCOMPARE(relativeMotionSpy.count(), 1);
QCOMPARE(frameSpy.count(), 5);
@ -418,13 +418,13 @@ void TestWaylandSeat::testPointer()
// test axis
m_seatInterface->setTimestamp(2);
m_seatInterface->pointerAxis(Qt::Horizontal, 10, 1, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Horizontal, 10, 1, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
QVERIFY(axisSpy.wait());
QCOMPARE(frameSpy.count(), 6);
m_seatInterface->setTimestamp(3);
m_seatInterface->pointerAxis(Qt::Vertical, 20, 2, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Vertical, 20, 2, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
QVERIFY(axisSpy.wait());
QCOMPARE(frameSpy.count(), 7);
QCOMPARE(axisSpy.first().at(0).value<quint32>(), quint32(2));
@ -437,26 +437,26 @@ void TestWaylandSeat::testPointer()
// test button
m_seatInterface->setTimestamp(4);
m_seatInterface->pointerButtonPressed(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonSpy.wait());
QCOMPARE(frameSpy.count(), 8);
QCOMPARE(buttonSpy.at(0).at(0).value<quint32>(), m_display->serial());
m_seatInterface->setTimestamp(5);
m_seatInterface->pointerButtonPressed(2);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(2);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonSpy.wait());
QCOMPARE(frameSpy.count(), 9);
QCOMPARE(buttonSpy.at(1).at(0).value<quint32>(), m_display->serial());
m_seatInterface->setTimestamp(6);
m_seatInterface->pointerButtonReleased(2);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(2);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonSpy.wait());
QCOMPARE(frameSpy.count(), 10);
QCOMPARE(buttonSpy.at(2).at(0).value<quint32>(), m_display->serial());
m_seatInterface->setTimestamp(7);
m_seatInterface->pointerButtonReleased(1);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(1);
m_seatInterface->notifyPointerFrame();
QVERIFY(buttonSpy.wait());
QCOMPARE(frameSpy.count(), 11);
QCOMPARE(buttonSpy.count(), 4);
@ -559,7 +559,7 @@ void TestWaylandSeat::testPointerTransformation()
QSignalSpy committedSpy(serverSurface, &KWaylandServer::SurfaceInterface::committed);
QVERIFY(committedSpy.wait());
m_seatInterface->setPointerPos(QPoint(20, 18));
m_seatInterface->notifyPointerMotion(QPoint(20, 18));
QFETCH(QMatrix4x4, enterTransformation);
m_seatInterface->setFocusedPointerSurface(serverSurface, enterTransformation);
QCOMPARE(m_seatInterface->focusedPointerSurfaceTransformation(), enterTransformation);
@ -597,8 +597,8 @@ void TestWaylandSeat::testPointerTransformation()
// test motion
m_seatInterface->setTimestamp(1);
m_seatInterface->setPointerPos(QPoint(10, 16));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPoint(10, 16));
m_seatInterface->notifyPointerFrame();
QVERIFY(motionSpy.wait());
QTEST(motionSpy.first().first().toPointF(), "expectedMovePoint");
QCOMPARE(motionSpy.first().last().value<quint32>(), quint32(1));
@ -685,7 +685,7 @@ void TestWaylandSeat::testPointerButton()
wl_display_flush(m_connection->display());
QCoreApplication::processEvents();
m_seatInterface->setPointerPos(QPoint(20, 18));
m_seatInterface->notifyPointerMotion(QPoint(20, 18));
m_seatInterface->setFocusedPointerSurface(serverSurface, QPoint(10, 15));
QVERIFY(m_seatInterface->focusedPointerSurface());
@ -698,8 +698,8 @@ void TestWaylandSeat::testPointerButton()
QCOMPARE(m_seatInterface->isPointerButtonPressed(waylandButton), false);
QCOMPARE(m_seatInterface->isPointerButtonPressed(qtButton), false);
m_seatInterface->setTimestamp(msec);
m_seatInterface->pointerButtonPressed(qtButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(qtButton);
m_seatInterface->notifyPointerFrame();
QCOMPARE(m_seatInterface->isPointerButtonPressed(waylandButton), true);
QCOMPARE(m_seatInterface->isPointerButtonPressed(qtButton), true);
QVERIFY(buttonChangedSpy.wait());
@ -711,8 +711,8 @@ void TestWaylandSeat::testPointerButton()
QCOMPARE(buttonChangedSpy.last().at(3).value<KWayland::Client::Pointer::ButtonState>(), Pointer::ButtonState::Pressed);
msec = QDateTime::currentMSecsSinceEpoch();
m_seatInterface->setTimestamp(QDateTime::currentMSecsSinceEpoch());
m_seatInterface->pointerButtonReleased(qtButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(qtButton);
m_seatInterface->notifyPointerFrame();
QCOMPARE(m_seatInterface->isPointerButtonPressed(waylandButton), false);
QCOMPARE(m_seatInterface->isPointerButtonPressed(qtButton), false);
QVERIFY(buttonChangedSpy.wait());
@ -778,7 +778,7 @@ void TestWaylandSeat::testPointerSubSurfaceTree()
// first to the grandChild2 in the overlapped area
quint32 timestamp = 1;
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(25, 50));
m_seatInterface->notifyPointerMotion(QPointF(25, 50));
m_seatInterface->setFocusedPointerSurface(serverSurface);
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 1);
@ -788,8 +788,8 @@ void TestWaylandSeat::testPointerSubSurfaceTree()
QCOMPARE(pointer->enteredSurface(), grandChild2Surface.data());
// a motion on grandchild2
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(25, 60));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPointF(25, 60));
m_seatInterface->notifyPointerFrame();
QVERIFY(motionSpy.wait());
QCOMPARE(enteredSpy.count(), 1);
QCOMPARE(leftSpy.count(), 0);
@ -797,8 +797,8 @@ void TestWaylandSeat::testPointerSubSurfaceTree()
QCOMPARE(motionSpy.last().first().toPointF(), QPointF(25, 35));
// motion which changes to childSurface
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(25, 80));
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerMotion(QPointF(25, 80));
m_seatInterface->notifyPointerFrame();
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 2);
QCOMPARE(leftSpy.count(), 1);
@ -814,7 +814,7 @@ void TestWaylandSeat::testPointerSubSurfaceTree()
QCOMPARE(motionSpy.count(), 2);
// a new enter on the main surface
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(75, 50));
m_seatInterface->notifyPointerMotion(QPointF(75, 50));
m_seatInterface->setFocusedPointerSurface(serverSurface);
QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 3);
@ -1126,8 +1126,8 @@ void TestWaylandSeat::testPointerAxis()
quint32 timestamp = 1;
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Vertical, 10, 1, PointerAxisSource::Wheel);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Vertical, 10, 1, PointerAxisSource::Wheel);
m_seatInterface->notifyPointerFrame();
QVERIFY(frameSpy.wait());
QCOMPARE(frameSpy.count(), 2);
QCOMPARE(axisSourceSpy.count(), 1);
@ -1143,8 +1143,8 @@ void TestWaylandSeat::testPointerAxis()
// let's scroll using fingers
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Horizontal, 42, 0, PointerAxisSource::Finger);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Horizontal, 42, 0, PointerAxisSource::Finger);
m_seatInterface->notifyPointerFrame();
QVERIFY(frameSpy.wait());
QCOMPARE(frameSpy.count(), 3);
QCOMPARE(axisSourceSpy.count(), 2);
@ -1158,8 +1158,8 @@ void TestWaylandSeat::testPointerAxis()
// lift the fingers off the device
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Horizontal, 0, 0, PointerAxisSource::Finger);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Horizontal, 0, 0, PointerAxisSource::Finger);
m_seatInterface->notifyPointerFrame();
QVERIFY(frameSpy.wait());
QCOMPARE(frameSpy.count(), 4);
QCOMPARE(axisSourceSpy.count(), 3);
@ -1172,8 +1172,8 @@ void TestWaylandSeat::testPointerAxis()
// if the device is unknown, no axis_source event should be sent
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerAxis(Qt::Horizontal, 42, 1, PointerAxisSource::Unknown);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerAxis(Qt::Horizontal, 42, 1, PointerAxisSource::Unknown);
m_seatInterface->notifyPointerFrame();
QVERIFY(frameSpy.wait());
QCOMPARE(frameSpy.count(), 5);
QCOMPARE(axisSourceSpy.count(), 3);
@ -1254,7 +1254,7 @@ void TestWaylandSeat::testKeyboardSubSurfaceTreeFromPointer()
QVERIFY(pointerEnterSpy.isValid());
quint32 timestamp = 1;
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->setPointerPos(QPointF(25, 50));
m_seatInterface->notifyPointerMotion(QPointF(25, 50));
m_seatInterface->setFocusedPointerSurface(serverSurface);
QVERIFY(pointerEnterSpy.wait());
QCOMPARE(pointerEnterSpy.count(), 1);
@ -1264,11 +1264,11 @@ void TestWaylandSeat::testKeyboardSubSurfaceTreeFromPointer()
// let's click
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonReleased(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
QVERIFY(enterSpy.wait());
QCOMPARE(enterSpy.count(), 2);
QCOMPARE(leftSpy.count(), 1);
@ -1276,11 +1276,11 @@ void TestWaylandSeat::testKeyboardSubSurfaceTreeFromPointer()
// click on same surface should not trigger another enter
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonPressed(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerPress(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
m_seatInterface->setTimestamp(timestamp++);
m_seatInterface->pointerButtonReleased(Qt::LeftButton);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerRelease(Qt::LeftButton);
m_seatInterface->notifyPointerFrame();
QVERIFY(!enterSpy.wait(200));
QCOMPARE(enterSpy.count(), 2);
QCOMPARE(leftSpy.count(), 1);
@ -1288,7 +1288,7 @@ void TestWaylandSeat::testKeyboardSubSurfaceTreeFromPointer()
// unfocus keyboard
m_seatInterface->setFocusedKeyboardSurface(nullptr);
m_seatInterface->pointerFrame();
m_seatInterface->notifyPointerFrame();
QVERIFY(leftSpy.wait());
QCOMPARE(enterSpy.count(), 2);
QCOMPARE(leftSpy.count(), 2);
@ -1327,7 +1327,7 @@ void TestWaylandSeat::testCursor()
QSignalSpy enteredSpy(p.data(), &KWayland::Client::Pointer::entered);
QVERIFY(enteredSpy.isValid());
m_seatInterface->setPointerPos(QPoint(20, 18));
m_seatInterface->notifyPointerMotion(QPoint(20, 18));
m_seatInterface->setFocusedPointerSurface(serverSurface, QPoint(10, 15));
quint32 serial = m_seatInterface->display()->serial();
QVERIFY(enteredSpy.wait());
@ -1983,7 +1983,7 @@ void TestWaylandSeat::testTouch()
m_seatInterface->setFocusedTouchSurfacePosition(QPointF(10, 20));
QCOMPARE(m_seatInterface->focusedTouchSurfacePosition(), QPointF(10, 20));
m_seatInterface->setTimestamp(1);
m_seatInterface->touchDown(0, QPointF(15, 26));
m_seatInterface->notifyTouchDown(0, QPointF(15, 26));
QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(sequenceEndedSpy.count(), 0);
@ -2007,14 +2007,14 @@ void TestWaylandSeat::testTouch()
QCOMPARE(touch->sequence().first(), tp);
// let's end the frame
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchFrame();
QVERIFY(frameEndedSpy.wait());
QCOMPARE(frameEndedSpy.count(), 1);
// move the one point
m_seatInterface->setTimestamp(2);
m_seatInterface->touchMove(0, QPointF(10, 20));
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchMotion(0, QPointF(10, 20));
m_seatInterface->notifyTouchFrame();
QVERIFY(frameEndedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(sequenceEndedSpy.count(), 0);
@ -2036,8 +2036,8 @@ void TestWaylandSeat::testTouch()
// add onther point
m_seatInterface->setTimestamp(3);
m_seatInterface->touchDown(1, QPointF(15, 26));
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchDown(1, QPointF(15, 26));
m_seatInterface->notifyTouchFrame();
QVERIFY(frameEndedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(sequenceEndedSpy.count(), 0);
@ -2062,8 +2062,8 @@ void TestWaylandSeat::testTouch()
// send it an up
m_seatInterface->setTimestamp(4);
m_seatInterface->touchUp(1);
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchUp(1);
m_seatInterface->notifyTouchFrame();
QVERIFY(frameEndedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(sequenceEndedSpy.count(), 0);
@ -2084,13 +2084,13 @@ void TestWaylandSeat::testTouch()
// send another down and up
m_seatInterface->setTimestamp(5);
m_seatInterface->touchDown(1, QPointF(15, 26));
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchDown(1, QPointF(15, 26));
m_seatInterface->notifyTouchFrame();
m_seatInterface->setTimestamp(6);
m_seatInterface->touchUp(1);
m_seatInterface->notifyTouchUp(1);
// and send an up for the first point
m_seatInterface->touchUp(0);
m_seatInterface->touchFrame();
m_seatInterface->notifyTouchUp(0);
m_seatInterface->notifyTouchFrame();
QVERIFY(frameEndedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(sequenceEndedSpy.count(), 1);
@ -2108,9 +2108,9 @@ void TestWaylandSeat::testTouch()
// try cancel
m_seatInterface->setFocusedTouchSurface(serverSurface, QPointF(15, 26));
m_seatInterface->setTimestamp(7);
m_seatInterface->touchDown(0, QPointF(15, 26));
m_seatInterface->touchFrame();
m_seatInterface->cancelTouchSequence();
m_seatInterface->notifyTouchDown(0, QPointF(15, 26));
m_seatInterface->notifyTouchFrame();
m_seatInterface->notifyTouchCancel();
QVERIFY(sequenceCanceledSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 2);
QCOMPARE(sequenceEndedSpy.count(), 1);

@ -112,8 +112,8 @@ void TestWaylandServerSeat::testPointerButton()
QCOMPARE(seat->pointerButtonSerial(1), quint32(0));
// mark the button as pressed
seat->pointerButtonPressed(0);
seat->pointerFrame();
seat->notifyPointerPress(0);
seat->notifyPointerFrame();
QVERIFY(seat->isPointerButtonPressed(0));
QCOMPARE(seat->pointerButtonSerial(0), display.serial());
@ -122,8 +122,8 @@ void TestWaylandServerSeat::testPointerButton()
QCOMPARE(seat->pointerButtonSerial(1), quint32(0));
// release it again
seat->pointerButtonReleased(0);
seat->pointerFrame();
seat->notifyPointerRelease(0);
seat->notifyPointerFrame();
QVERIFY(!seat->isPointerButtonPressed(0));
QCOMPARE(seat->pointerButtonSerial(0), display.serial());
}
@ -140,18 +140,18 @@ void TestWaylandServerSeat::testPointerPos()
QCOMPARE(seat->pointerPos(), QPointF());
seat->setPointerPos(QPointF(10, 15));
seat->pointerFrame();
seat->notifyPointerMotion(QPointF(10, 15));
seat->notifyPointerFrame();
QCOMPARE(seat->pointerPos(), QPointF(10, 15));
QCOMPARE(seatPosSpy.count(), 1);
QCOMPARE(seatPosSpy.first().first().toPointF(), QPointF(10, 15));
seat->setPointerPos(QPointF(10, 15));
seat->pointerFrame();
seat->notifyPointerMotion(QPointF(10, 15));
seat->notifyPointerFrame();
QCOMPARE(seatPosSpy.count(), 1);
seat->setPointerPos(QPointF(5, 7));
seat->pointerFrame();
seat->notifyPointerMotion(QPointF(5, 7));
seat->notifyPointerFrame();
QCOMPARE(seat->pointerPos(), QPointF(5, 7));
QCOMPARE(seatPosSpy.count(), 2);
QCOMPARE(seatPosSpy.first().first().toPointF(), QPointF(10, 15));

@ -475,7 +475,7 @@ QPointF SeatInterface::pointerPos() const
return d->globalPointer.pos;
}
void SeatInterface::setPointerPos(const QPointF &pos)
void SeatInterface::notifyPointerMotion(const QPointF &pos)
{
if (d->globalPointer.pos == pos) {
return;
@ -550,11 +550,11 @@ void SeatInterface::setDragTarget(SurfaceInterface *surface, const QPointF &glob
}
if (d->drag.mode == SeatInterfacePrivate::Drag::Mode::Pointer) {
setPointerPos(globalPosition);
pointerFrame();
notifyPointerMotion(globalPosition);
notifyPointerFrame();
} else if (d->drag.mode == SeatInterfacePrivate::Drag::Mode::Touch &&
d->globalTouch.focus.firstTouchPos != globalPosition) {
touchMove(d->globalTouch.ids.first(), globalPosition);
notifyTouchMotion(d->globalTouch.ids.first(), globalPosition);
}
if (d->drag.target) {
d->drag.surface = surface;
@ -706,7 +706,7 @@ bool SeatInterface::isPointerButtonPressed(quint32 button) const
return it.value() == SeatInterfacePrivate::Pointer::State::Pressed;
}
void SeatInterface::pointerAxis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source)
void SeatInterface::notifyPointerAxis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source)
{
Q_ASSERT(d->pointer);
if (d->drag.mode == SeatInterfacePrivate::Drag::Mode::Pointer) {
@ -716,16 +716,16 @@ void SeatInterface::pointerAxis(Qt::Orientation orientation, qreal delta, qint32
d->pointer->sendAxis(orientation, delta, discreteDelta, source);
}
void SeatInterface::pointerButtonPressed(Qt::MouseButton button)
void SeatInterface::notifyPointerPress(Qt::MouseButton button)
{
const quint32 nativeButton = qtToWaylandButton(button);
if (nativeButton == 0) {
return;
}
pointerButtonPressed(nativeButton);
notifyPointerPress(nativeButton);
}
void SeatInterface::pointerButtonPressed(quint32 button)
void SeatInterface::notifyPointerPress(quint32 button)
{
Q_ASSERT(d->pointer);
const quint32 serial = d->display->nextSerial();
@ -744,16 +744,16 @@ void SeatInterface::pointerButtonPressed(quint32 button)
}
}
void SeatInterface::pointerButtonReleased(Qt::MouseButton button)
void SeatInterface::notifyPointerRelease(Qt::MouseButton button)
{
const quint32 nativeButton = qtToWaylandButton(button);
if (nativeButton == 0) {
return;
}
pointerButtonReleased(nativeButton);
notifyPointerRelease(nativeButton);
}
void SeatInterface::pointerButtonReleased(quint32 button)
void SeatInterface::notifyPointerRelease(quint32 button)
{
Q_ASSERT(d->pointer);
const quint32 serial = d->display->nextSerial();
@ -771,7 +771,7 @@ void SeatInterface::pointerButtonReleased(quint32 button)
d->pointer->sendRelease(button, serial);
}
void SeatInterface::pointerFrame()
void SeatInterface::notifyPointerFrame()
{
Q_ASSERT(d->pointer);
d->pointer->sendFrame();
@ -946,7 +946,7 @@ KeyboardInterface *SeatInterface::keyboard() const
return d->keyboard.data();
}
void SeatInterface::cancelTouchSequence()
void SeatInterface::notifyTouchCancel()
{
Q_ASSERT(d->touch);
d->touch->sendCancel();
@ -1010,7 +1010,7 @@ void SeatInterface::setFocusedTouchSurfacePosition(const QPointF &surfacePositio
d->globalTouch.focus.offset = surfacePosition;
}
void SeatInterface::touchDown(qint32 id, const QPointF &globalPosition)
void SeatInterface::notifyTouchDown(qint32 id, const QPointF &globalPosition)
{
Q_ASSERT(d->touch);
const qint32 serial = display()->nextSerial();
@ -1037,7 +1037,7 @@ void SeatInterface::touchDown(qint32 id, const QPointF &globalPosition)
d->globalTouch.ids[id] = serial;
}
void SeatInterface::touchMove(qint32 id, const QPointF &globalPosition)
void SeatInterface::notifyTouchMotion(qint32 id, const QPointF &globalPosition)
{
Q_ASSERT(d->touch);
Q_ASSERT(d->globalTouch.ids.contains(id));
@ -1064,7 +1064,7 @@ void SeatInterface::touchMove(qint32 id, const QPointF &globalPosition)
emit touchMoved(id, d->globalTouch.ids[id], globalPosition);
}
void SeatInterface::touchUp(qint32 id)
void SeatInterface::notifyTouchUp(qint32 id)
{
Q_ASSERT(d->touch);
Q_ASSERT(d->globalTouch.ids.contains(id));
@ -1091,7 +1091,7 @@ void SeatInterface::touchUp(qint32 id)
d->globalTouch.ids.remove(id);
}
void SeatInterface::touchFrame()
void SeatInterface::notifyTouchFrame()
{
Q_ASSERT(d->touch);
d->touch->sendFrame();

@ -89,14 +89,14 @@ enum class PointerAxisSource {
* // example for pointer
* seat->setFocusedPointerSurface(surface, QPointF(100, 200)); // surface at it's global position
* seat->setTimestamp(100);
* seat->setPointerPos(QPointF(350, 210)); // global pos, local pos in surface: 250,10
* seat->pointerFrame();
* seat->notifyPointerMotion(QPointF(350, 210)); // global pos, local pos in surface: 250,10
* seat->notifyPointerFrame();
* seat->setTimestamp(110);
* seat->pointerButtonPressed(Qt::LeftButton);
* seat->pointerFrame();
* seat->notifyPointerPress(Qt::LeftButton);
* seat->notifyPointerFrame();
* seat->setTimestamp(120);
* seat->pointerButtonReleased(Qt::LeftButton);
* seat->pointerFrame();
* seat->notifyPointerRelease(Qt::LeftButton);
* seat->notifyPointerFrame();
* @endcode
*
* @see KeyboardInterface
@ -131,7 +131,7 @@ class KWAYLANDSERVER_EXPORT SeatInterface : public QObject
/**
* The global pointer position.
**/
Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE setPointerPos NOTIFY pointerPosChanged)
Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE notifyPointerMotion NOTIFY pointerPosChanged)
/**
* The current timestamp passed to the input events.
**/
@ -227,7 +227,7 @@ public:
*
* Sends a pointer motion event to the focused pointer surface.
**/
void setPointerPos(const QPointF &pos);
void notifyPointerMotion(const QPointF &pos);
/**
* @returns the global pointer position
**/
@ -337,12 +337,12 @@ public:
*
* @param button The Linux button code
**/
void pointerButtonPressed(quint32 button);
void notifyPointerPress(quint32 button);
/**
* @overload
**/
void pointerButtonPressed(Qt::MouseButton button);
void pointerFrame();
void notifyPointerPress(Qt::MouseButton button);
void notifyPointerFrame();
/**
* Marks the @p button as released.
*
@ -350,11 +350,11 @@ public:
*
* @param button The Linux button code
**/
void pointerButtonReleased(quint32 button);
void notifyPointerRelease(quint32 button);
/**
* @overload
**/
void pointerButtonReleased(Qt::MouseButton button);
void notifyPointerRelease(Qt::MouseButton button);
/**
* @returns whether the @p button is pressed
**/
@ -380,7 +380,7 @@ public:
* @param source Describes how the axis event was physically generated.
* @since 5.59
**/
void pointerAxis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
void notifyPointerAxis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
/**
* @returns true if there is a pressed button with the given @p serial
* @since 5.6
@ -557,11 +557,11 @@ public:
TouchInterface *touch() const;
void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
QPointF focusedTouchSurfacePosition() const;
void touchDown(qint32 id, const QPointF &globalPosition);
void touchUp(qint32 id);
void touchMove(qint32 id, const QPointF &globalPosition);
void touchFrame();
void cancelTouchSequence();
void notifyTouchDown(qint32 id, const QPointF &globalPosition);
void notifyTouchUp(qint32 id);
void notifyTouchMotion(qint32 id, const QPointF &globalPosition);
void notifyTouchFrame();
void notifyTouchCancel();
bool isTouchSequence() const;
/**
* @returns true if there is a touch sequence going on associated with a touch

@ -190,8 +190,8 @@ void CompositorWindow::mouseMoveEvent(QMouseEvent *event)
updateFocus();
}
m_seat->setTimestamp(event->timestamp());
m_seat->setPointerPos(event->localPos().toPoint());
m_seat->pointerFrame();
m_seat->notifyPointerMotion(event->localPos().toPoint());
m_seat->notifyPointerFrame();
}
void CompositorWindow::mousePressEvent(QMouseEvent *event)
@ -203,16 +203,16 @@ void CompositorWindow::mousePressEvent(QMouseEvent *event)
}
}
m_seat->setTimestamp(event->timestamp());
m_seat->pointerButtonPressed(event->button());
m_seat->pointerFrame();
m_seat->notifyPointerPress(event->button());
m_seat->notifyPointerFrame();
}
void CompositorWindow::mouseReleaseEvent(QMouseEvent *event)
{
QWidget::mouseReleaseEvent(event);
m_seat->setTimestamp(event->timestamp());
m_seat->pointerButtonReleased(event->button());
m_seat->pointerFrame();
m_seat->notifyPointerRelease(event->button());
m_seat->notifyPointerFrame();
}
void CompositorWindow::wheelEvent(QWheelEvent *event)
@ -221,12 +221,12 @@ void CompositorWindow::wheelEvent(QWheelEvent *event)
m_seat->setTimestamp(event->timestamp());
const QPoint &angle = event->angleDelta() / (8 * 15);
if (angle.x() != 0) {
m_seat->pointerAxis(Qt::Horizontal, angle.x(), 1, KWaylandServer::PointerAxisSource::Wheel);
m_seat->notifyPointerAxis(Qt::Horizontal, angle.x(), 1, KWaylandServer::PointerAxisSource::Wheel);
}
if (angle.y() != 0) {
m_seat->pointerAxis(Qt::Vertical, angle.y(), 1, KWaylandServer::PointerAxisSource::Wheel);
m_seat->notifyPointerAxis(Qt::Vertical, angle.y(), 1, KWaylandServer::PointerAxisSource::Wheel);
}
m_seat->pointerFrame();
m_seat->notifyPointerFrame();
}
int main(int argc, char **argv)

Loading…
Cancel
Save