Product SiteDocumentation Site

A.8. wl_data_offer - offer to transfer data

A wl_data_offer represents a piece of data offered for transfer by another client (the source client). It is used by the copy-and-paste and drag-and-drop mechanisms. The offer describes the different mime types that the data can be converted to and provides the mechanism for transferring the data directly from the source client.

A.8.1. Requests provided by wl_data_offer

A.8.1.1. wl_data_offer::accept - accept one of the offered mime types

Indicate that the client can accept the given mime type, or NULL for not accepted.
Used for feedback during drag-and-drop.

wl_data_offer::accept arguments

serial
Type: uint
mime_type
Type: string

A.8.1.2. wl_data_offer::receive - request that the data is transferred

To transfer the offered data, the client issues this request and indicates the mime type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor.
The receiving client reads from the read end of the pipe until EOF and the closes its end, at which point the transfer is complete.

wl_data_offer::receive arguments

mime_type
Type: string
fd
Type: fd

A.8.1.3. wl_data_offer::destroy - destroy data offer

Destroy the data offer.

A.8.2. Events provided by wl_data_offer

A.8.2.1. wl_data_offer::offer - advertise offered mime type

Sent immediately after creating the wl_data_offer object. One event per offered mime type.

wl_data_offer::offer arguments

mime_type
Type: string