diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-04-24 13:59:39 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-24 15:13:38 +0200 |
commit | c551e6df6c77f65a0db62b3ad4db539e86b75a30 (patch) | |
tree | 3a6e672c97882c67c9a2e2455f1b90caea2c0456 /src/client/qwaylanddatadevice.cpp | |
parent | 187363886582ba236cf6fed0f956953b699eca53 (diff) |
Discard the selection and drag source when not active anymore
If another client sets a selection or starts a drag the active
wl_data_source, if any, gets a 'cancelled' event. We must listen to
this and discard the wl_data_source, else e.g. checking the clipboard
content will still return the data of the source instead of the current
wl_data_offer.
Change-Id: I80b202baf95fbc8abe19496a991cb30bc0b78bb0
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/client/qwaylanddatadevice.cpp')
-rw-r--r-- | src/client/qwaylanddatadevice.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index 2d6a6f4b6..f5056f6d0 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -84,6 +84,8 @@ QWaylandDataSource *QWaylandDataDevice::selectionSource() const void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) { m_selectionSource.reset(source); + if (source) + connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */); } @@ -95,7 +97,7 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const void 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(); start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); |