.TH "wayland::server::data_offer_t" 3 "Wed May 3 2023" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::server::data_offer_t \- offer to transfer data .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits wayland::server::resource_t\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "std::function< void(uint32_t, std::string)> & \fBon_accept\fP ()" .br .RI "accept one of the offered mime types " .ti -1c .RI "std::function< void(std::string, int)> & \fBon_receive\fP ()" .br .RI "request that the data is transferred " .ti -1c .RI "std::function< void()> & \fBon_destroy\fP ()" .br .RI "destroy data offer " .ti -1c .RI "std::function< void()> & \fBon_finish\fP ()" .br .RI "the offer will no longer be used " .ti -1c .RI "std::function< void(\fBdata_device_manager_dnd_action\fP, \fBdata_device_manager_dnd_action\fP)> & \fBon_set_actions\fP ()" .br .RI "set the available/preferred drag-and-drop actions " .ti -1c .RI "void \fBoffer\fP (std::string const &mime_type, bool post=true)" .br .RI "advertise offered mime type " .ti -1c .RI "void \fBsource_actions\fP (\fBdata_device_manager_dnd_action\fP const &source_actions, bool post=true)" .br .RI "notify the source-side available actions " .ti -1c .RI "bool \fBcan_source_actions\fP () const" .br .RI "Check whether the \fBsource_actions\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "void \fBaction\fP (\fBdata_device_manager_dnd_action\fP const &dnd_action, bool post=true)" .br .RI "notify the selected action " .ti -1c .RI "bool \fBcan_action\fP () const" .br .RI "Check whether the \fBaction\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "void \fBpost_invalid_finish\fP (std::string const &msg)" .br .RI "Post error: finish request was called untimely\&. " .ti -1c .RI "void \fBpost_invalid_action_mask\fP (std::string const &msg)" .br .RI "Post error: action mask contains invalid values\&. " .ti -1c .RI "void \fBpost_invalid_action\fP (std::string const &msg)" .br .RI "Post error: action argument has an invalid value\&. " .ti -1c .RI "void \fBpost_invalid_offer\fP (std::string const &msg)" .br .RI "Post error: offer doesn't accept this request\&. " .ti -1c .RI "bool \fBproxy_has_object\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "void \fBpost_no_memory\fP () const" .br .ti -1c .RI "uint32_t \fBget_id\fP () const" .br .ti -1c .RI "client_t \fBget_client\fP () const" .br .ti -1c .RI "unsigned int \fBget_version\fP () const" .br .ti -1c .RI "std::string \fBget_class\fP ()" .br .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static constexpr std::uint32_t \fBoffer_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBoffer\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBsource_actions_since_version\fP = 3" .br .RI "Minimum protocol version required for the \fBsource_actions\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBaction_since_version\fP = 3" .br .RI "Minimum protocol version required for the \fBaction\fP function\&. " .in -1c .SH "Detailed Description" .PP 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\&. .PP Definition at line \fB821\fP of file \fBwayland\-server\-protocol\&.hpp\fP\&. .SH "Member Function Documentation" .PP .SS "void data_offer_t::action (\fBdata_device_manager_dnd_action\fP const & dnd_action, bool post = \fCtrue\fP)" .PP notify the selected action .PP \fBParameters\fP .RS 4 \fIdnd_action\fP action selected by the compositor .RE .PP This event indicates the action selected by the compositor after matching the source/destination side actions\&. Only one action (or none) will be offered here\&. .PP This event can be emitted multiple times during the drag-and-drop operation in response to destination side action changes through wl_data_offer\&.set_actions\&. .PP This event will no longer be emitted after wl_data_device\&.drop happened on the drag-and-drop destination, the client must honor the last action received, or the last preferred one set through wl_data_offer\&.set_actions when handling an 'ask' action\&. .PP Compositors may also change the selected action on the fly, mainly in response to keyboard modifier changes during the drag-and-drop operation\&. .PP The most recent action received is always the valid one\&. Prior to receiving wl_data_device\&.drop, the chosen action may change (e\&.g\&. due to keyboard modifiers being pressed)\&. At the time of receiving wl_data_device\&.drop the drag-and-drop destination must honor the last action received\&. .PP Action changes may still happen after wl_data_device\&.drop, especially on 'ask' actions, where the drag-and-drop destination may choose another action afterwards\&. Action changes happening at this stage are always the result of inter-client negotiation, the compositor shall no longer be able to induce a different action\&. .PP Upon 'ask' actions, it is expected that the drag-and-drop destination may potentially choose a different action and/or mime type, based on wl_data_offer\&.source_actions and finally chosen by the user (e\&.g\&. popping up a menu with the available options)\&. The final wl_data_offer\&.set_actions and wl_data_offer\&.accept requests must happen before the call to wl_data_offer\&.finish\&. .PP Definition at line \fB1893\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "bool data_offer_t::can_action () const" .PP Check whether the \fBaction\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB1898\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "bool data_offer_t::can_source_actions () const" .PP Check whether the \fBsource_actions\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB1888\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::string wayland::server::resource_t::get_class ()\fC [inherited]\fP" Retrieve the interface name (class) of a resource object\&. .PP \fBReturns\fP .RS 4 Interface name of the resource object\&. .RE .PP .SS "client_t wayland::server::resource_t::get_client () const\fC [inherited]\fP" Get the associated client .PP \fBReturns\fP .RS 4 the client that owns the resource\&. .RE .PP .SS "uint32_t wayland::server::resource_t::get_id () const\fC [inherited]\fP" Get the internal ID of the resource .PP \fBReturns\fP .RS 4 the internal ID of the resource .RE .PP .SS "unsigned int wayland::server::resource_t::get_version () const\fC [inherited]\fP" Get interface version .PP \fBReturns\fP .RS 4 Interface version this resource has been constructed with\&. .RE .PP .SS "void data_offer_t::offer (std::string const & mime_type, bool post = \fCtrue\fP)" .PP advertise offered mime type .PP \fBParameters\fP .RS 4 \fImime_type\fP offered mime type .RE .PP Sent immediately after creating the wl_data_offer object\&. One event per offered mime type\&. .PP Definition at line \fB1878\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, std::string)> & data_offer_t::on_accept ()" .PP accept one of the offered mime types .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the accept request .br \fImime_type\fP mime type accepted by the client .RE .PP Indicate that the client can accept the given mime type, or NULL for not accepted\&. .PP For objects of version 2 or older, this request is used by the client to give feedback whether the client can receive the given mime type, or NULL if none is accepted; the feedback does not determine whether the drag-and-drop operation succeeds or not\&. .PP For objects of version 3 or newer, this request determines the final result of the drag-and-drop operation\&. If the end result is that no mime types were accepted, the drag-and-drop operation will be cancelled and the corresponding drag source will receive wl_data_source\&.cancelled\&. Clients may still use this event in conjunction with wl_data_source\&.action for feedback\&. .PP Definition at line \fB1848\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::function< void()> & data_offer_t::on_destroy ()" .PP destroy data offer Destroy the data offer\&. .PP Definition at line \fB1860\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::function< void()> & data_offer_t::on_finish ()" .PP the offer will no longer be used Notifies the compositor that the drag destination successfully finished the drag-and-drop operation\&. .PP Upon receiving this request, the compositor will emit wl_data_source\&.dnd_finished on the drag source client\&. .PP It is a client error to perform other requests than wl_data_offer\&.destroy after this one\&. It is also an error to perform this request after a NULL mime type has been set in wl_data_offer\&.accept or no action was received through wl_data_offer\&.action\&. .PP If wl_data_offer\&.finish request is received for a non drag and drop operation, the invalid_finish protocol error is raised\&. .PP Definition at line \fB1866\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::function< void(std::string, int)> & data_offer_t::on_receive ()" .PP request that the data is transferred .PP \fBParameters\fP .RS 4 \fImime_type\fP mime type desired by receiver .br \fIfd\fP file descriptor for data transfer .RE .PP 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\&. .PP The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete\&. .PP This request may happen multiple times for different mime types, both before and after wl_data_device\&.drop\&. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance\&. .PP Definition at line \fB1854\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "std::function< void(\fBdata_device_manager_dnd_action\fP, \fBdata_device_manager_dnd_action\fP)> & data_offer_t::on_set_actions ()" .PP set the available/preferred drag-and-drop actions .PP \fBParameters\fP .RS 4 \fIdnd_actions\fP actions supported by the destination client .br \fIpreferred_action\fP action preferred by the destination client .RE .PP Sets the actions that the destination side client supports for this operation\&. This request may trigger the emission of wl_data_source\&.action and wl_data_offer\&.action events if the compositor needs to change the selected action\&. .PP This request can be called multiple times throughout the drag-and-drop operation, typically in response to wl_data_device\&.enter or wl_data_device\&.motion events\&. .PP This request determines the final result of the drag-and-drop operation\&. If the end result is that no action is accepted, the drag source will receive wl_data_source\&.cancelled\&. .PP The dnd_actions argument must contain only values expressed in the wl_data_device_manager\&.dnd_actions enum, and the preferred_action argument must only contain one of those values set, otherwise it will result in a protocol error\&. .PP While managing an 'ask' action, the destination drag-and-drop client may perform further wl_data_offer\&.receive requests, and is expected to perform one last wl_data_offer\&.set_actions request with a preferred action other than 'ask' (and optionally wl_data_offer\&.accept) before requesting wl_data_offer\&.finish, in order to convey the action selected by the user\&. If the preferred action is not in the wl_data_offer\&.source_actions mask, an error will be raised\&. .PP If the 'ask' action is dismissed (e\&.g\&. user cancellation), the client is expected to perform wl_data_offer\&.destroy right away\&. .PP This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise\&. .PP Definition at line \fB1872\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "void data_offer_t::post_invalid_action (std::string const & msg)" .PP Post error: action argument has an invalid value\&. .PP Definition at line \fB1913\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "void data_offer_t::post_invalid_action_mask (std::string const & msg)" .PP Post error: action mask contains invalid values\&. .PP Definition at line \fB1908\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "void data_offer_t::post_invalid_finish (std::string const & msg)" .PP Post error: finish request was called untimely\&. .PP Definition at line \fB1903\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "void data_offer_t::post_invalid_offer (std::string const & msg)" .PP Post error: offer doesn't accept this request\&. .PP Definition at line \fB1918\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SS "void wayland::server::resource_t::post_no_memory () const\fC [inherited]\fP" Post 'not enough memory' error to the client .PP If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance\&. .SS "bool wayland::server::resource_t::proxy_has_object () const\fC [inherited]\fP" .PP Check whether this wrapper actually wraps an object\&. .PP \fBReturns\fP .RS 4 true if there is an underlying object, false if this wrapper is empty .RE .PP .SS "void data_offer_t::source_actions (\fBdata_device_manager_dnd_action\fP const & source_actions, bool post = \fCtrue\fP)" .PP notify the source-side available actions .PP \fBParameters\fP .RS 4 \fIsource_actions\fP actions offered by the data source .RE .PP This event indicates the actions offered by the data source\&. It will be sent right after wl_data_device\&.enter, or anytime the source side changes its offered actions through wl_data_source\&.set_actions\&. .PP Definition at line \fB1883\fP of file \fBwayland\-server\-protocol\&.cpp\fP\&. .SH "Member Data Documentation" .PP .SS "constexpr std::uint32_t wayland::server::data_offer_t::action_since_version = 3\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBaction\fP function\&. .PP Definition at line \fB1038\fP of file \fBwayland\-server\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::server::data_offer_t::offer_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBoffer\fP function\&. .PP Definition at line \fB973\fP of file \fBwayland\-server\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::server::data_offer_t::source_actions_since_version = 3\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBsource_actions\fP function\&. .PP Definition at line \fB987\fP of file \fBwayland\-server\-protocol\&.hpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.