12#include <QtGui/private/qshapedpixmapdndwindow_p.h>
17#if QT_CONFIG(draganddrop)
18namespace QtWaylandClient {
20QWaylandDrag::QWaylandDrag(QWaylandDisplay *display)
25QWaylandDrag::~QWaylandDrag()
29void QWaylandDrag::startDrag()
34 m_display->currentInputDevice()->handleStartDrag();
36 QBasicDrag::startDrag();
37 QWaylandWindow *icon =
static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle());
38 if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), drag()->supportedActions(), icon)) {
39 icon->addAttachOffset(-drag()->hotSpot());
43 QMetaObject::invokeMethod(
this, [
this](){ cancelDrag(); }, Qt::QueuedConnection);
47void QWaylandDrag::cancel()
51 m_display->currentInputDevice()->dataDevice()->cancelDrag();
54 drag()->deleteLater();
57void QWaylandDrag::move(
const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
65void QWaylandDrag::drop(
const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
67 QBasicDrag::drop(globalPos, b, mods);
70void QWaylandDrag::endDrag()
72 m_display->currentInputDevice()->handleEndDrag();
75void QWaylandDrag::setResponse(
bool accepted)
78 Qt::DropAction action = defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers());
79 setResponse(QPlatformDropQtResponse(accepted, action));
82void QWaylandDrag::setResponse(
const QPlatformDropQtResponse &response)
84 setCanDrop(response.isAccepted());
87 updateCursor(response.acceptedAction());
89 updateCursor(Qt::IgnoreAction);
93void QWaylandDrag::setDropResponse(
const QPlatformDropQtResponse &response)
95 setExecutedDropAction(response.acceptedAction());
98void QWaylandDrag::finishDrag()
100 QKeyEvent event(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier);
101 eventFilter(shapedPixmapWindow(), &event);
104 drag()->deleteLater();
107bool QWaylandDrag::ownsDragObject()
const
Combined button and popup list for selecting options.