.TH "wayland::data_device_t" 3 "Wed May 3 2023" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::data_device_t \- data transfer device .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 \fBstart_drag\fP (\fBdata_source_t\fP const &source, \fBsurface_t\fP const &origin, \fBsurface_t\fP const &icon, uint32_t serial)" .br .RI "start drag-and-drop operation " .ti -1c .RI "void \fBset_selection\fP (\fBdata_source_t\fP const &source, uint32_t serial)" .br .RI "copy data to the selection " .ti -1c .RI "void \fBrelease\fP ()" .br .RI "destroy data device " .ti -1c .RI "bool \fBcan_release\fP () const" .br .RI "Check whether the \fBrelease\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "std::function< void(\fBdata_offer_t\fP)> & \fBon_data_offer\fP ()" .br .RI "introduce a new wl_data_offer " .ti -1c .RI "std::function< void(uint32_t, \fBsurface_t\fP, double, double, \fBdata_offer_t\fP)> & \fBon_enter\fP ()" .br .RI "initiate drag-and-drop session " .ti -1c .RI "std::function< void()> & \fBon_leave\fP ()" .br .RI "end drag-and-drop session " .ti -1c .RI "std::function< void(uint32_t, double, double)> & \fBon_motion\fP ()" .br .RI "drag-and-drop session motion " .ti -1c .RI "std::function< void()> & \fBon_drop\fP ()" .br .RI "end drag-and-drop session successfully " .ti -1c .RI "std::function< void(\fBdata_offer_t\fP)> & \fBon_selection\fP ()" .br .RI "advertise new selection " .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 \fBstart_drag_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBstart_drag\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBset_selection_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBset_selection\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBrelease_since_version\fP = 2" .br .RI "Minimum protocol version required for the \fBrelease\fP function\&. " .in -1c .SH "Detailed Description" .PP data transfer device There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton\&. .PP A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop\&. .PP Definition at line \fB1202\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 \fB115\fP of file \fBwayland\-client\&.hpp\fP\&. .SH "Member Function Documentation" .PP .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_device_t::can_release () const" .PP Check whether the \fBrelease\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB2288\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 \fB301\fP of file \fBwayland\-client\&.hpp\fP\&. .SS "std::function< void(\fBdata_offer_t\fP)> & data_device_t::on_data_offer ()" .PP introduce a new wl_data_offer .PP \fBParameters\fP .RS 4 \fIid\fP the new data_offer object .RE .PP The data_offer event introduces a new wl_data_offer object, which will subsequently be used in either the data_device\&.enter event (for drag-and-drop) or the data_device\&.selection event (for selections)\&. Immediately following the data_device\&.data_offer event, the new data_offer object will send out data_offer\&.offer events to describe the mime types it offers\&. .PP Definition at line \fB2294\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void()> & data_device_t::on_drop ()" .PP end drag-and-drop session successfully The event is sent when a drag-and-drop operation is ended because the implicit grab is removed\&. .PP The drag-and-drop destination is expected to honor the last action received through wl_data_offer\&.action, if the resulting action is 'copy' or 'move', the destination can still perform wl_data_offer\&.receive requests, and is expected to end all transfers with a wl_data_offer\&.finish request\&. .PP If the resulting action is 'ask', the action will not be considered final\&. The drag-and-drop destination is expected to perform one last wl_data_offer\&.set_actions request, or wl_data_offer\&.destroy in order to cancel the operation\&. .PP Definition at line \fB2314\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, \fBsurface_t\fP, double, double, \fBdata_offer_t\fP)> & data_device_t::on_enter ()" .PP initiate drag-and-drop session .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the enter event .br \fIsurface\fP client surface entered .br \fIx\fP surface-local x coordinate .br \fIy\fP surface-local y coordinate .br \fIid\fP source data_offer object .RE .PP This event is sent when an active drag-and-drop pointer enters a surface owned by the client\&. The position of the pointer at enter time is provided by the x and y arguments, in surface-local coordinates\&. .PP Definition at line \fB2299\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void()> & data_device_t::on_leave ()" .PP end drag-and-drop session This event is sent when the drag-and-drop pointer leaves the surface and the session ends\&. The client must destroy the wl_data_offer introduced at enter time at this point\&. .PP Definition at line \fB2304\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, double, double)> & data_device_t::on_motion ()" .PP drag-and-drop session motion .PP \fBParameters\fP .RS 4 \fItime\fP timestamp with millisecond granularity .br \fIx\fP surface-local x coordinate .br \fIy\fP surface-local y coordinate .RE .PP This event is sent when the drag-and-drop pointer moves within the currently focused surface\&. The new position of the pointer is provided by the x and y arguments, in surface-local coordinates\&. .PP Definition at line \fB2309\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(\fBdata_offer_t\fP)> & data_device_t::on_selection ()" .PP advertise new selection .PP \fBParameters\fP .RS 4 \fIid\fP selection data_offer object .RE .PP The selection event is sent out to notify the client of a new wl_data_offer for the selection for this device\&. The data_device\&.data_offer and the data_offer\&.offer events are sent out immediately before this event to introduce the data offer object\&. The selection event is sent to a client immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus\&. The data_offer is valid until a new data_offer or NULL is received or until the client loses keyboard focus\&. Switching surface with keyboard focus within the same client doesn't mean a new selection will be sent\&. The client must destroy the previous selection data_offer, if any, upon receiving this event\&. .PP Definition at line \fB2319\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_device_t::release ()" .PP destroy data device This request destroys the data device\&. .PP Definition at line \fB2283\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\&. .SS "void data_device_t::set_selection (\fBdata_source_t\fP const & source, uint32_t serial)" .PP copy data to the selection .PP \fBParameters\fP .RS 4 \fIsource\fP data source for the selection .br \fIserial\fP serial number of the event that triggered this request .RE .PP This request asks the compositor to set the selection to the data from the source on behalf of the client\&. .PP To unset the selection, set the source to NULL\&. .PP Definition at line \fB2277\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void data_device_t::start_drag (\fBdata_source_t\fP const & source, \fBsurface_t\fP const & origin, \fBsurface_t\fP const & icon, uint32_t serial)" .PP start drag-and-drop operation .PP \fBParameters\fP .RS 4 \fIsource\fP data source for the eventual transfer .br \fIorigin\fP surface where the drag originates .br \fIicon\fP drag-and-drop icon surface .br \fIserial\fP serial number of the implicit grab on the origin .RE .PP This request asks the compositor to start a drag-and-drop operation on behalf of the client\&. .PP The source argument is the data source that provides the data for the eventual data transfer\&. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally\&. If source is destroyed, the drag-and-drop session will be cancelled\&. .PP The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial\&. .PP The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor\&. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface\&.attach request can move the relative position\&. Attach requests must be confirmed with wl_surface\&.commit as usual\&. The icon surface is given the role of a drag-and-drop icon\&. If the icon surface already has another role, it raises a protocol error\&. .PP The current and pending input regions of the icon wl_surface are cleared, and wl_surface\&.set_input_region is ignored until the wl_surface is no longer used as the icon surface\&. When the use as an icon ends, the current and pending input regions become undefined, and the wl_surface is unmapped\&. .PP Definition at line \fB2271\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SH "Member Data Documentation" .PP .SS "constexpr std::uint32_t wayland::data_device_t::release_since_version = 2\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBrelease\fP function\&. .PP Definition at line \fB1297\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::data_device_t::set_selection_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBset_selection\fP function\&. .PP Definition at line \fB1286\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::data_device_t::start_drag_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBstart_drag\fP function\&. .PP Definition at line \fB1270\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.