wayland: Revert send pointer leave on drag

This was changed to match the behaviour of other compositors.
However what kwin did before is more sensible.

Sending a leave event breaks cursor updates by design. See
https://gitlab.freedesktop.org/wayland/wayland/-/issues/444
This commit is contained in:
David Edmundson 2024-03-08 16:46:22 +00:00
parent 044c9f0154
commit 9302e84b95
2 changed files with 2 additions and 10 deletions

View file

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

View file

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