summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-01-17 17:30:42 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-01-17 17:31:16 +0100
commit314c70fb77c39f32ad98657411c6d9fcc9eb2d7e (patch)
treeb6b60ed8b58c2e3d0fb79636ab6f8603746fd03f /src/compositor/wayland_wrapper
parentd458c31998f5e4fcf85cf31e4b9033fd18f77052 (diff)
Offer the retained selection when no data source is available anymore
When retained selection is enabled, clipboard data will be available even after the client, that offered the data, exits. Change-Id: I8158eba29b14092ce150245410b62912011051fd Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/wldatadevice.cpp5
-rw-r--r--src/compositor/wayland_wrapper/wldatadevicemanager.cpp9
-rw-r--r--src/compositor/wayland_wrapper/wldatadevicemanager.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/src/compositor/wayland_wrapper/wldatadevice.cpp b/src/compositor/wayland_wrapper/wldatadevice.cpp
index bdabf29a4..248ee486e 100644
--- a/src/compositor/wayland_wrapper/wldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevice.cpp
@@ -107,12 +107,13 @@ void DataDevice::sendSelectionFocus()
return;
DataSource *source = m_data_device_manager->currentSelectionSource();
- if (!source) {
+ if (!source || !source->client()) {
+ m_data_device_manager->offerRetainedSelection(m_data_device_resource);
return;
}
if (source->time() > m_sent_selection_time) { //this makes sure we don't resend
if (source->client() != m_data_device_resource->client) { //don't send selection to the client that owns the selection
- DataOffer *data_offer = m_data_device_manager->currentSelectionSource()->dataOffer();
+ DataOffer *data_offer = source->dataOffer();
wl_resource *client_resource =
data_offer->addDataDeviceResource(m_data_device_resource);
qDebug() << "sending data_offer for source" << source;
diff --git a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
index d3e3fb784..19f6bf69d 100644
--- a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
@@ -257,6 +257,15 @@ bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDevic
return true;
}
+void DataDeviceManager::offerRetainedSelection(wl_resource *clientDataDeviceResource)
+{
+ if (m_retainedData.formats().isEmpty())
+ return;
+
+ m_compositorOwnsSelection = true;
+ offerFromCompositorToClient(clientDataDeviceResource);
+}
+
void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const char *)
{
}
diff --git a/src/compositor/wayland_wrapper/wldatadevicemanager.h b/src/compositor/wayland_wrapper/wldatadevicemanager.h
index 75844d207..09777c0a7 100644
--- a/src/compositor/wayland_wrapper/wldatadevicemanager.h
+++ b/src/compositor/wayland_wrapper/wldatadevicemanager.h
@@ -73,6 +73,7 @@ public:
void overrideSelection(const QMimeData &mimeData);
bool offerFromCompositorToClient(wl_resource *clientDataDeviceResource);
+ void offerRetainedSelection(wl_resource *clientDataDeviceResource);
private slots:
void readFromClient(int fd);