summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-12-10 11:18:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-17 22:04:35 +0100
commit1a37f72617acb2c1416f351753787ea25832aa84 (patch)
treec5cb9c763af933ef9cf13a3de388f3aac287b97d /src/compositor
parentef3894e40bd4a2e0de02ba8e0d0c2dcdeaf96f62 (diff)
downloadqtwayland-1a37f72617acb2c1416f351753787ea25832aa84.tar.gz
QtCompositor: Provide a way to update the clipboard on a client
Clipboard synchronization happens when a client is keyboard-focused, but some clients may require clipboard access even when not in focus. Add an updateSelection() slot to QWaylandSurface so that the compositor implementor can synchronize the clipboard manually or through a signal-slot connection. Change-Id: I31475e120ae6efd7bdec4dda453c9ebf20099442 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp21
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 8ed8bcbd..c5ae0854 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -47,6 +47,9 @@
#include "wayland_wrapper/qwlsubsurface_p.h"
#include "wayland_wrapper/qwlcompositor_p.h"
#include "wayland_wrapper/qwlshellsurface_p.h"
+#include "wayland_wrapper/qwlinputdevice_p.h"
+#include "wayland_wrapper/qwldatadevice_p.h"
+#include "wayland_wrapper/qwldatadevicemanager_p.h"
#include "qwaylandcompositor.h"
#include "waylandwindowmanagerintegration.h"
@@ -373,4 +376,22 @@ void QWaylandSurface::ping()
d->surface->shellSurface()->ping();
}
+/*!
+ Updates the surface with the compositor's retained clipboard selection. While this
+ is done automatically when the surface receives keyboard focus, this function is
+ useful for updating clients which do not have keyboard focus.
+*/
+void QWaylandSurface::updateSelection()
+{
+ Q_D(QWaylandSurface);
+ const QtWayland::InputDevice *inputDevice = d->surface->compositor()->defaultInputDevice();
+ if (inputDevice) {
+ const QtWayland::DataDevice *dataDevice = inputDevice->dataDevice();
+ if (dataDevice) {
+ d->surface->compositor()->dataDeviceManager()->offerRetainedSelection(
+ dataDevice->resourceMap().value(d->surface->resource()->client())->handle);
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 333144a6..c260416a 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -175,6 +175,10 @@ public:
Q_INVOKABLE void destroySurface();
Q_INVOKABLE void destroySurfaceByForce();
Q_INVOKABLE void ping();
+
+public slots:
+ void updateSelection();
+
signals:
void mapped();
void unmapped();