Don't generate spurious selection events

By calling destroy() on the active wl_data_source before replacing
it with a new one and calling set_selection() we trigger a spurious
selection(null) event before the one with the offer for the source
we are going to set.

Change-Id: I6c2f2fd029fa523312b9892c6a5050805dfa83b0
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Giulio Camuffo 2015-04-30 22:07:49 +03:00
parent f57dbc0358
commit 202573e946

View File

@ -94,10 +94,10 @@ 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() : Q_NULLPTR, m_inputDevice->serial());
m_selectionSource.reset(source);
}
QWaylandDataOffer *QWaylandDataDevice::dragOffer() const