Revert "wayland: Revert send pointer leave on drag"

Now we have server-side cursor icons, we can send the pointer leave.

This reverts commit 9302e84b95.
This commit is contained in:
David Edmundson 2024-07-16 16:57:26 +01:00
parent 0726ae6cfa
commit 99f2cd2f51
2 changed files with 10 additions and 2 deletions

View file

@ -388,11 +388,12 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
QVERIFY(buttonPressSpy.wait());
QCOMPARE(buttonPressSpy.first().at(1).value<quint32>(), quint32(2));
QSignalSpy pointerLeftSpy(m_pointer, &KWayland::Client::Pointer::left);
// add some signal spies for client side
QSignalSpy dragEnteredSpy(m_dataDevice, &KWayland::Client::DataDevice::dragEntered);
QSignalSpy dragMotionSpy(m_dataDevice, &KWayland::Client::DataDevice::dragMotion);
QSignalSpy pointerMotionSpy(m_pointer, &KWayland::Client::Pointer::motion);
QSignalSpy pointerLeftSpy(m_pointer, &KWayland::Client::Pointer::left);
QSignalSpy dragLeftSpy(m_dataDevice, &KWayland::Client::DataDevice::dragLeft);
// now we can start the drag and drop
@ -405,6 +406,7 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
QCOMPARE(m_seatInterface->dragSurfaceTransformation(), QMatrix4x4());
QVERIFY(!m_seatInterface->dragIcon());
QCOMPARE(SeatInterfacePrivate::get(m_seatInterface)->drag.dragImplicitGrabSerial, buttonPressSpy.first().first().value<quint32>());
QVERIFY(pointerLeftSpy.wait());
QVERIFY(dragEnteredSpy.count() || dragEnteredSpy.wait());
QCOMPARE(dragEnteredSpy.count(), 1);
QCOMPARE(dragEnteredSpy.first().first().value<quint32>(), m_display->serial());
@ -527,12 +529,12 @@ void TestDragAndDrop::testPointerEventsIgnored()
m_seatInterface->notifyPointerButton(1, PointerButtonState::Released);
m_seatInterface->notifyPointerFrame();
QVERIFY(cancelledSpy.wait());
QVERIFY(pointerLeftSpy.count() || pointerLeftSpy.wait());
// all the changes should have been ignored
QCOMPARE(axisSpy.count(), 1);
QCOMPARE(pointerMotionSpy.count(), 1);
QCOMPARE(pointerEnteredSpy.count(), 1);
QCOMPARE(pointerLeftSpy.count(), 1);
}
QTEST_GUILESS_MAIN(TestDragAndDrop)

View file

@ -523,6 +523,9 @@ void SeatInterface::setDragTarget(AbstractDropHandler *dropTarget,
surfaceInputTransformation.scale(surface->scaleOverride());
d->drag.surface = surface;
d->drag.transformation = surfaceInputTransformation;
if (d->dragInhibitsPointer(surface)) {
notifyPointerLeave();
}
d->drag.target->updateDragTarget(surface, serial);
} else {
d->drag.surface = nullptr;
@ -1383,6 +1386,9 @@ void SeatInterface::startDrag(AbstractDataSource *dragSource, SurfaceInterface *
d->drag.target = d->dataDevicesForSurface(originSurface)[0];
}
if (d->drag.target) {
if (d->dragInhibitsPointer(originSurface)) {
notifyPointerLeave();
}
d->drag.target->updateDragTarget(originSurface, display()->nextSerial());
}
Q_EMIT dragStarted();