DataDevice: Send enter event with a correct position if we're using touch
It used to send the pointer position, which may be somewhere completely different when we're using touch.
This commit is contained in:
parent
10eb1aa0b9
commit
1bd496f42b
2 changed files with 7 additions and 3 deletions
|
@ -339,7 +339,7 @@ void TestDragAndDrop::testTouchDragAndDrop()
|
||||||
QVERIFY(dragEnteredSpy.wait());
|
QVERIFY(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());
|
||||||
QCOMPARE(dragEnteredSpy.first().last().toPointF(), QPointF(0, 0));
|
QCOMPARE(dragEnteredSpy.first().last().toPointF(), QPointF(50.0, 50.0));
|
||||||
QCOMPARE(m_dataDevice->dragSurface().data(), s.data());
|
QCOMPARE(m_dataDevice->dragSurface().data(), s.data());
|
||||||
auto offer = m_dataDevice->dragOffer();
|
auto offer = m_dataDevice->dragOffer();
|
||||||
QVERIFY(offer);
|
QVERIFY(offer);
|
||||||
|
|
|
@ -272,8 +272,12 @@ void DataDeviceInterface::updateDragTarget(SurfaceInterface *surface, quint32 se
|
||||||
d->drag = DataDeviceInterfacePrivate::Drag();
|
d->drag = DataDeviceInterfacePrivate::Drag();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: handle touch position
|
QPointF pos;
|
||||||
const QPointF pos = d->seat->dragSurfaceTransformation().map(d->seat->pointerPos());
|
if (d->seat->isDragPointer()) {
|
||||||
|
pos = d->seat->dragSurfaceTransformation().map(d->seat->pointerPos());
|
||||||
|
} else if (d->seat->isDragTouch()) {
|
||||||
|
pos = d->seat->dragSurfaceTransformation().map(d->seat->firstTouchPointPosition());
|
||||||
|
}
|
||||||
d->send_enter(serial, surface->resource(), wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()), offer ? offer->resource() : nullptr);
|
d->send_enter(serial, surface->resource(), wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()), offer ? offer->resource() : nullptr);
|
||||||
if (offer) {
|
if (offer) {
|
||||||
offer->sendSourceActions();
|
offer->sendSourceActions();
|
||||||
|
|
Loading…
Reference in a new issue