Commit e6c1ccbd authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Fix drag and drop with touch between different windows

When dragging from one window to another, we may end up in a data_device
that didn't get "data_device_start_drag". In that case, the internal
touch point serial will be incorrect and we need to update it to the
serial from the seat. The serial stored in the seat is changed to
std::optional so we can properly check if it is set.
parent c793dd93
......@@ -254,6 +254,15 @@ void DataDeviceInterface::updateDragTarget(SurfaceInterface *surface, quint32 se
d->send_motion(d->seat->timestamp(), wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()));
});
} else if (d->seat->isDragTouch()) {
// When dragging from one window to another, we may end up in a data_device
// that didn't get "data_device_start_drag". In that case, the internal
// touch point serial will be incorrect and we need to update it to the
// serial from the seat.
SeatInterfacePrivate *seatPrivate = SeatInterfacePrivate::get(seat());
if (seatPrivate->drag.dragImplicitGrabSerial != d->drag.serial) {
d->drag.serial = seatPrivate->drag.dragImplicitGrabSerial.value();
}
d->drag.posConnection = connect(d->seat, &SeatInterface::touchMoved, this, [this](qint32 id, quint32 serial, const QPointF &globalPosition) {
Q_UNUSED(id);
if (serial != d->drag.serial) {
......
......@@ -14,6 +14,8 @@
#include <QPointer>
#include <QVector>
#include <optional>
#include "qwayland-server-wayland.h"
namespace KWaylandServer
......@@ -127,7 +129,7 @@ public:
QPointer<AbstractDropHandler> target;
QPointer<DragAndDropIcon> dragIcon;
QMatrix4x4 transformation;
quint32 dragImplicitGrabSerial = -1;
std::optional<quint32> dragImplicitGrabSerial;
QMetaObject::Connection dragSourceDestroyConnection;
};
Drag drag;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment