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.
This commit is contained in:
parent
c793dd93d2
commit
e6c1ccbd3b
2 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue