Commit 60e342b8 authored by Erik Chen's avatar Erik Chen Committed by Chromium LUCI CQ

Update documentation for ozone/wayland clipboard/data_device APIs.

This CL has no intended behavior change.

Change-Id: Ic05292cb7f620cd02e2950bee17b48c0ae69b725
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2585541
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Reviewed-by: default avatarAntonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#836742}
parent 85d6b18c
......@@ -70,6 +70,12 @@ class ClipboardImpl final : public Clipboard, public DataSource::Delegate {
return GetDevice()->GetAvailableMimeTypes();
}
// Once this client sends wl_data_source::offer, it is responsible for holding
// onto its clipboard contents. At future points in time, the wayland server
// may send a wl_data_source::send event, in which case this client is
// responsible for writing the clipboard contents into the supplied fd. This
// client can only drop the clipboard contents when it receives a
// wl_data_source::cancelled event.
virtual void Write(const ui::PlatformClipboard::DataMap* data) override {
if (!data || data->empty()) {
data_.clear();
......
......@@ -25,7 +25,12 @@ namespace ui {
class WaylandConnection;
class WaylandDataDeviceManager;
// Handles clipboard operations.
// This class is a wrapper around Wayland data_device protocols that simulates
// typical clipboard operations. Unlike some other platforms, data-transfer is
// an async, lazy operation. This means that even after "writing" data to the
// system clipboard, this class must still hold on to a local cache of the
// clipboard contents, since it may be read (repeatedly) by other Wayland
// clients.
//
// WaylandDataDeviceManager singleton is required to be up and running for
// WaylandClipboard to be minimally functional.
......
......@@ -74,6 +74,15 @@ class WaylandDataDevice : public WaylandDataDeviceBase {
// Returns the underlying wl_data_device singleton object.
wl_data_device* data_device() const { return data_device_.get(); }
// wl_data_device::set_selection makes the corresponding wl_data_source the
// target of future wl_data_device::data_offer events. In non-Wayland terms,
// this is equivalent to "writing" to the clipboard or DnD, although the
// actual transfer of data happens asynchronously, on-demand-only.
//
// The API relies on the assumption that the Wayland client is responding to a
// keyboard or mouse event with a serial number. This is cached in
// WaylandConnection. However, this may not exist or be set properly in tests,
// resulting in the Wayland server ignoring the set_selection() request.
void SetSelectionSource(WaylandDataSource* source);
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment