diff --git a/autotests/wayland/client/test_drag_drop.cpp b/autotests/wayland/client/test_drag_drop.cpp index 6a92be9024..58757454e5 100644 --- a/autotests/wayland/client/test_drag_drop.cpp +++ b/autotests/wayland/client/test_drag_drop.cpp @@ -388,11 +388,12 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource() QVERIFY(buttonPressSpy.wait()); QCOMPARE(buttonPressSpy.first().at(1).value(), 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()); + QVERIFY(pointerLeftSpy.wait()); QVERIFY(dragEnteredSpy.count() || dragEnteredSpy.wait()); QCOMPARE(dragEnteredSpy.count(), 1); QCOMPARE(dragEnteredSpy.first().first().value(), 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) diff --git a/src/wayland/seat.cpp b/src/wayland/seat.cpp index d4780d2140..4c961e1808 100644 --- a/src/wayland/seat.cpp +++ b/src/wayland/seat.cpp @@ -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();