summaryrefslogtreecommitdiff
path: root/src/client/qwaylanddatadevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/qwaylanddatadevice.cpp')
-rw-r--r--src/client/qwaylanddatadevice.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 6b2a408e..990f92ba 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -102,19 +102,22 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
return m_dragOffer.data();
}
-void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
+bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
{
- m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
- connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
-
QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus();
if (!origin)
origin = m_display->currentInputDevice()->touchFocus();
- if (origin)
- start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial());
- else
+ if (!origin) {
qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found.";
+ return false;
+ }
+
+ m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
+ connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
+
+ start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial());
+ return true;
}
void QWaylandDataDevice::cancelDrag()