wayland_server_data_device_t - Man Page
data transfer device
Synopsis
#include <wayland-server-protocol.hpp>
Inherits wayland::server::resource_t.
Public Member Functions
std::function< void(data_source_t, surface_t, surface_t, uint32_t)> & on_start_drag ()
start drag-and-drop operation
std::function< void(data_source_t, uint32_t)> & on_set_selection ()
copy data to the selection
std::function< void()> & on_release ()
destroy data device
void data_offer (bool post=true)
introduce a new wl_data_offer
void enter (uint32_t serial, surface_t const &surface, double x, double y, data_offer_t const &id, bool post=true)
initiate drag-and-drop session
void leave (bool post=true)
end drag-and-drop session
void motion (uint32_t time, double x, double y, bool post=true)
drag-and-drop session motion
void drop (bool post=true)
end drag-and-drop session successfully
void selection (data_offer_t const &id, bool post=true)
advertise new selection
void post_role (std::string const &msg)
Post error: given wl_surface has another role.
bool proxy_has_object () const
Check whether this wrapper actually wraps an object.
void post_no_memory () const
uint32_t get_id () const
client_t get_client () const
unsigned int get_version () const
std::string get_class ()
Static Public Attributes
static constexpr std::uint32_t data_offer_since_version = 1
Minimum protocol version required for the data_offer function.
static constexpr std::uint32_t enter_since_version = 1
Minimum protocol version required for the enter function.
static constexpr std::uint32_t leave_since_version = 1
Minimum protocol version required for the leave function.
static constexpr std::uint32_t motion_since_version = 1
Minimum protocol version required for the motion function.
static constexpr std::uint32_t drop_since_version = 1
Minimum protocol version required for the drop function.
static constexpr std::uint32_t selection_since_version = 1
Minimum protocol version required for the selection function.
Detailed Description
data transfer device
There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton.
A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop.
Definition at line 1334 of file wayland-server-protocol.hpp.
Member Function Documentation
void data_device_t::data_offer (bool post = true)
introduce a new wl_data_offer
- Returns
the new data_offer object
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.
Definition at line 2096 of file wayland-server-protocol.cpp.
void data_device_t::drop (bool post = true)
end drag-and-drop session successfully The event is sent when a drag-and-drop operation is ended because the implicit grab is removed.
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.
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.
Definition at line 2116 of file wayland-server-protocol.cpp.
void data_device_t::enter (uint32_t serial, surface_t const & surface, double x, double y, data_offer_t const & id, bool post = true)
initiate drag-and-drop session
- Parameters
serial serial number of the enter event
surface client surface entered
x surface-local x coordinate
y surface-local y coordinate
id source data_offer object
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.
Definition at line 2101 of file wayland-server-protocol.cpp.
std::string wayland::server::resource_t::get_class () [inherited]
Retrieve the interface name (class) of a resource object.
- Returns
Interface name of the resource object.
client_t wayland::server::resource_t::get_client () const [inherited]
Get the associated client
- Returns
the client that owns the resource.
uint32_t wayland::server::resource_t::get_id () const [inherited]
Get the internal ID of the resource
- Returns
the internal ID of the resource
unsigned int wayland::server::resource_t::get_version () const [inherited]
Get interface version
- Returns
Interface version this resource has been constructed with.
void data_device_t::leave (bool post = true)
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.
Definition at line 2106 of file wayland-server-protocol.cpp.
void data_device_t::motion (uint32_t time, double x, double y, bool post = true)
drag-and-drop session motion
- Parameters
time timestamp with millisecond granularity
x surface-local x coordinate
y surface-local y coordinate
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.
Definition at line 2111 of file wayland-server-protocol.cpp.
std::function< void()> & data_device_t::on_release ()
destroy data device This request destroys the data device.
Definition at line 2090 of file wayland-server-protocol.cpp.
std::function< void(data_source_t, uint32_t)> & data_device_t::on_set_selection ()
copy data to the selection
- Parameters
source data source for the selection
serial serial number of the event that triggered this request
This request asks the compositor to set the selection to the data from the source on behalf of the client.
To unset the selection, set the source to NULL.
Definition at line 2084 of file wayland-server-protocol.cpp.
std::function< void(data_source_t, surface_t, surface_t, uint32_t)> & data_device_t::on_start_drag ()
start drag-and-drop operation
- Parameters
source data source for the eventual transfer
origin surface where the drag originates
icon drag-and-drop icon surface
serial serial number of the implicit grab on the origin
This request asks the compositor to start a drag-and-drop operation on behalf of the client.
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.
The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial.
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.
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.
Definition at line 2078 of file wayland-server-protocol.cpp.
void wayland::server::resource_t::post_no_memory () const [inherited]
Post 'not enough memory' error to the client
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.
void data_device_t::post_role (std::string const & msg)
Post error: given wl_surface has another role.
Definition at line 2126 of file wayland-server-protocol.cpp.
bool wayland::server::resource_t::proxy_has_object () const [inherited]
Check whether this wrapper actually wraps an object.
- Returns
true if there is an underlying object, false if this wrapper is empty
void data_device_t::selection (data_offer_t const & id, bool post = true)
advertise new selection
- Parameters
id selection data_offer object
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.
Definition at line 2121 of file wayland-server-protocol.cpp.
Member Data Documentation
std::uint32_t wayland::server::data_device_t::data_offer_since_version = 1 [static], [constexpr]
Minimum protocol version required for the data_offer function.
Definition at line 1435 of file wayland-server-protocol.hpp.
std::uint32_t wayland::server::data_device_t::drop_since_version = 1 [static], [constexpr]
Minimum protocol version required for the drop function.
Definition at line 1507 of file wayland-server-protocol.hpp.
std::uint32_t wayland::server::data_device_t::enter_since_version = 1 [static], [constexpr]
Minimum protocol version required for the enter function.
Definition at line 1454 of file wayland-server-protocol.hpp.
std::uint32_t wayland::server::data_device_t::leave_since_version = 1 [static], [constexpr]
Minimum protocol version required for the leave function.
Definition at line 1467 of file wayland-server-protocol.hpp.
std::uint32_t wayland::server::data_device_t::motion_since_version = 1 [static], [constexpr]
Minimum protocol version required for the motion function.
Definition at line 1484 of file wayland-server-protocol.hpp.
std::uint32_t wayland::server::data_device_t::selection_since_version = 1 [static], [constexpr]
Minimum protocol version required for the selection function.
Definition at line 1530 of file wayland-server-protocol.hpp.
Author
Generated automatically by Doxygen for Wayland++ from the source code.