.TH "wayland::data_offer_t" 3 "Wed May 1 2024 17:27:19" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::data_offer_t \- offer to transfer data .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBwayland::proxy_t\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum class \fBwrapper_type\fP { \fBstandard\fP, \fBdisplay\fP, \fBforeign\fP, \fBproxy_wrapper\fP }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "void \fBaccept\fP (uint32_t serial, std::string const &mime_type)" .br .RI "accept one of the offered mime types " .ti -1c .RI "void \fBreceive\fP (std::string const &mime_type, int fd)" .br .RI "request that the data is transferred " .ti -1c .RI "void \fBfinish\fP ()" .br .RI "the offer will no longer be used " .ti -1c .RI "bool \fBcan_finish\fP () const" .br .RI "Check whether the \fBfinish\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "void \fBset_actions\fP (\fBdata_device_manager_dnd_action\fP const &dnd_actions, \fBdata_device_manager_dnd_action\fP const &preferred_action)" .br .RI "set the available/preferred drag-and-drop actions " .ti -1c .RI "bool \fBcan_set_actions\fP () const" .br .RI "Check whether the \fBset_actions\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "std::function< void(std::string)> & \fBon_offer\fP ()" .br .RI "advertise offered mime type " .ti -1c .RI "std::function< void(\fBdata_device_manager_dnd_action\fP)> & \fBon_source_actions\fP ()" .br .RI "notify the source-side available actions " .ti -1c .RI "std::function< void(\fBdata_device_manager_dnd_action\fP)> & \fBon_action\fP ()" .br .RI "notify the selected action " .ti -1c .RI "uint32_t \fBget_id\fP () const" .br .RI "Get the id of a proxy object\&. " .ti -1c .RI "std::string \fBget_class\fP () const" .br .RI "Get the interface name (class) of a proxy object\&. " .ti -1c .RI "uint32_t \fBget_version\fP () const" .br .RI "Get the protocol object version of a proxy object\&. " .ti -1c .RI "\fBwrapper_type\fP \fBget_wrapper_type\fP () const" .br .RI "Get the type of a proxy object\&. " .ti -1c .RI "void \fBset_queue\fP (\fBevent_queue_t\fP queue)" .br .RI "Assign a proxy to an event queue\&. " .ti -1c .RI "wl_proxy * \fBc_ptr\fP () const" .br .RI "Get a pointer to the underlying C struct\&. " .ti -1c .RI "bool \fBproxy_has_object\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "\fBoperator bool\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "bool \fBoperator==\fP (const \fBproxy_t\fP &right) const" .br .RI "Check whether two wrappers refer to the same object\&. " .ti -1c .RI "bool \fBoperator!=\fP (const \fBproxy_t\fP &right) const" .br .RI "Check whether two wrappers refer to different objects\&. " .ti -1c .RI "void \fBproxy_release\fP ()" .br .RI "Release the wrapped object (if any), making this an empty wrapper\&. " .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static constexpr std::uint32_t \fBaccept_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBaccept\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBreceive_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBreceive\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBfinish_since_version\fP = 3" .br .RI "Minimum protocol version required for the \fBfinish\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBset_actions_since_version\fP = 3" .br .RI "Minimum protocol version required for the \fBset_actions\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 \fB759\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SH "Member Enumeration Documentation" .PP .SS "enum class \fBwayland::proxy_t::wrapper_type\fP\fC [strong]\fP, \fC [inherited]\fP" Underlying wl_proxy type and properties of a \fBproxy_t\fP that affect construction, destruction, and event handling .PP \fBEnumerator\fP .in +1c .TP \fB\fIstandard \fP\fP C pointer is a standard type compatible with wl_proxy*\&. Events are dispatched and it is destructed when the \fBproxy_t\fP is destructed\&. User data is set\&. .TP \fB\fIdisplay \fP\fP C pointer is a wl_display*\&. No events are dispatched, wl_display_disconnect is called when the \fBproxy_t\fP is destructed\&. User data is set\&. .TP \fB\fIforeign \fP\fP C pointer is a standard type compatible with wl_proxy*, but another library owns it and it should not be touched in a way that could affect the operation of the other library\&. No events are dispatched, wl_proxy_destroy is not called when the \fBproxy_t\fP is destructed, user data is not touched\&. Consequently, there is no reference counting for the \fBproxy_t\fP\&. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl_proxy\&. .TP \fB\fIproxy_wrapper \fP\fP C pointer is a wl_proxy* that was constructed with wl_proxy_create_wrapper\&. No events are dispatched, wl_proxy_wrapper_destroy is called when the \fBproxy_t\fP is destroyed\&. Reference counting is active\&. A reference to the \fBproxy_t\fP creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed\&. .PP Definition at line \fB116\fP of file \fBwayland\-client\&.hpp\fP\&. .SH "Member Function Documentation" .PP .SS "void data_offer_t::accept (uint32_t serial, std::string const & mime_type)" .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 \fB2028\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "wl_proxy * wayland::proxy_t::c_ptr () const\fC [inherited]\fP" .PP Get a pointer to the underlying C struct\&. .PP \fBReturns\fP .RS 4 The underlying wl_proxy wrapped by this \fBproxy_t\fP if it exists, otherwise an exception is thrown .RE .PP .SS "bool data_offer_t::can_finish () const" .PP Check whether the \fBfinish\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB2045\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "bool data_offer_t::can_set_actions () const" .PP Check whether the \fBset_actions\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB2056\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void data_offer_t::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 \fB2040\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::string wayland::proxy_t::get_class () const\fC [inherited]\fP" .PP Get the interface name (class) of a proxy object\&. .PP \fBReturns\fP .RS 4 The interface name of the object associated with the proxy .RE .PP .SS "uint32_t wayland::proxy_t::get_id () const\fC [inherited]\fP" .PP Get the id of a proxy object\&. .PP \fBReturns\fP .RS 4 The id the object associated with the proxy .RE .PP .SS "uint32_t wayland::proxy_t::get_version () const\fC [inherited]\fP" .PP Get the protocol object version of a proxy object\&. Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API\&. .PP A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version\&. .PP \fBdisplay_t\fP will always return version 0\&. .PP \fBReturns\fP .RS 4 The protocol object version of the proxy or 0 .RE .PP .SS "\fBwrapper_type\fP wayland::proxy_t::get_wrapper_type () const\fC [inline]\fP, \fC [inherited]\fP" .PP Get the type of a proxy object\&. .PP Definition at line \fB302\fP of file \fBwayland\-client\&.hpp\fP\&. .SS "std::function< void(\fBdata_device_manager_dnd_action\fP)> & data_offer_t::on_action ()" .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 \fB2072\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(std::string)> & data_offer_t::on_offer ()" .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 \fB2062\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(\fBdata_device_manager_dnd_action\fP)> & data_offer_t::on_source_actions ()" .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 \fB2067\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "wayland::proxy_t::operator bool () 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 "bool wayland::proxy_t::operator!= (const \fBproxy_t\fP & right) const\fC [inherited]\fP" .PP Check whether two wrappers refer to different objects\&. .SS "bool wayland::proxy_t::operator== (const \fBproxy_t\fP & right) const\fC [inherited]\fP" .PP Check whether two wrappers refer to the same object\&. .SS "bool wayland::proxy_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 wayland::proxy_t::proxy_release ()\fC [inherited]\fP" .PP Release the wrapped object (if any), making this an empty wrapper\&. Note that \fBdisplay_t\fP instances cannot be released this way\&. Attempts to do so are ignored\&. .PP \fBExamples\fP .in +1c \fBforeign_display\&.cpp\fP\&. .SS "void data_offer_t::receive (std::string const & mime_type, int fd)" .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 \fB2034\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void data_offer_t::set_actions (\fBdata_device_manager_dnd_action\fP const & dnd_actions, \fBdata_device_manager_dnd_action\fP const & preferred_action)" .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 \fB2051\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void wayland::proxy_t::set_queue (\fBevent_queue_t\fP queue)\fC [inherited]\fP" .PP Assign a proxy to an event queue\&. .PP \fBParameters\fP .RS 4 \fIqueue\fP The event queue that will handle this proxy .RE .PP Assign proxy to event queue\&. Events coming from proxy will be queued in queue instead of the display's main queue\&. .PP See also: \fBdisplay_t::dispatch_queue()\fP\&. .PP \fBExamples\fP .in +1c \fBproxy_wrapper\&.cpp\fP\&. .SH "Member Data Documentation" .PP .SS "constexpr std::uint32_t wayland::data_offer_t::accept_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBaccept\fP function\&. .PP Definition at line \fB808\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::data_offer_t::finish_since_version = 3\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBfinish\fP function\&. .PP Definition at line \fB859\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::data_offer_t::receive_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBreceive\fP function\&. .PP Definition at line \fB835\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::data_offer_t::set_actions_since_version = 3\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBset_actions\fP function\&. .PP Definition at line \fB907\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.