wayland_data_device_t - Man Page

data transfer device

Synopsis

#include <wayland-client-protocol.hpp>

Inherits wayland::proxy_t.

Public Types

enum class wrapper_type { standard, display, foreign, proxy_wrapper }

Public Member Functions

void start_drag (data_source_t const &source, surface_t const &origin, surface_t const &icon, uint32_t serial)
start drag-and-drop operation
void set_selection (data_source_t const &source, uint32_t serial)
copy data to the selection
void release ()
destroy data device
bool can_release () const
Check whether the release function is available with the currently bound version of the protocol.
std::function< void(data_offer_t)> & on_data_offer ()
introduce a new wl_data_offer
std::function< void(uint32_t, surface_t, double, double, data_offer_t)> & on_enter ()
initiate drag-and-drop session
std::function< void()> & on_leave ()
end drag-and-drop session
std::function< void(uint32_t, double, double)> & on_motion ()
drag-and-drop session motion
std::function< void()> & on_drop ()
end drag-and-drop session successfully
std::function< void(data_offer_t)> & on_selection ()
advertise new selection
uint32_t get_id () const
Get the id of a proxy object.
std::string get_class () const
Get the interface name (class) of a proxy object.
uint32_t get_version () const
Get the protocol object version of a proxy object.
wrapper_type get_wrapper_type () const
Get the type of a proxy object.
void set_queue (event_queue_t queue)
Assign a proxy to an event queue.
wl_proxy * c_ptr () const
Get a pointer to the underlying C struct.
bool proxy_has_object () const
Check whether this wrapper actually wraps an object.
operator bool () const
Check whether this wrapper actually wraps an object.
bool operator== (const proxy_t &right) const
Check whether two wrappers refer to the same object.
bool operator!= (const proxy_t &right) const
Check whether two wrappers refer to different objects.
void proxy_release ()
Release the wrapped object (if any), making this an empty wrapper.

Static Public Attributes

static constexpr std::uint32_t start_drag_since_version = 1
Minimum protocol version required for the start_drag function.
static constexpr std::uint32_t set_selection_since_version = 1
Minimum protocol version required for the set_selection function.
static constexpr std::uint32_t release_since_version = 2
Minimum protocol version required for the release 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 1203 of file wayland-client-protocol.hpp.

Member Enumeration Documentation

enum class wayland::proxy_t::wrapper_type [strong], [inherited]

Underlying wl_proxy type and properties of a proxy_t that affect construction, destruction, and event handling

Enumerator

standard

C pointer is a standard type compatible with wl_proxy*. Events are dispatched and it is destructed when the proxy_t is destructed. User data is set.

display

C pointer is a wl_display*. No events are dispatched, wl_display_disconnect is called when the proxy_t is destructed. User data is set.

foreign

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 proxy_t is destructed, user data is not touched. Consequently, there is no reference counting for the proxy_t. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl_proxy.

proxy_wrapper

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 proxy_t is destroyed. Reference counting is active. A reference to the proxy_t creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed.

Definition at line 116 of file wayland-client.hpp.

Member Function Documentation

wl_proxy * wayland::proxy_t::c_ptr () const [inherited]

Get a pointer to the underlying C struct.

Returns

The underlying wl_proxy wrapped by this proxy_t if it exists, otherwise an exception is thrown

bool data_device_t::can_release () const

Check whether the release function is available with the currently bound version of the protocol.

Definition at line 2288 of file wayland-client-protocol.cpp.

std::string wayland::proxy_t::get_class () const [inherited]

Get the interface name (class) of a proxy object.

Returns

The interface name of the object associated with the proxy

uint32_t wayland::proxy_t::get_id () const [inherited]

Get the id of a proxy object.

Returns

The id the object associated with the proxy

uint32_t wayland::proxy_t::get_version () const [inherited]

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.

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.

display_t will always return version 0.

Returns

The protocol object version of the proxy or 0

wrapper_type wayland::proxy_t::get_wrapper_type () const [inline], [inherited]

Get the type of a proxy object.

Definition at line 302 of file wayland-client.hpp.

std::function< void(data_offer_t)> & data_device_t::on_data_offer ()

introduce a new wl_data_offer

Parameters

id 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 2294 of file wayland-client-protocol.cpp.

std::function< void()> & data_device_t::on_drop ()

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 2314 of file wayland-client-protocol.cpp.

std::function< void(uint32_t, surface_t, double, double, data_offer_t)> & data_device_t::on_enter ()

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 2299 of file wayland-client-protocol.cpp.

std::function< void()> & data_device_t::on_leave ()

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 2304 of file wayland-client-protocol.cpp.

std::function< void(uint32_t, double, double)> & data_device_t::on_motion ()

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 2309 of file wayland-client-protocol.cpp.

std::function< void(data_offer_t)> & data_device_t::on_selection ()

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 2319 of file wayland-client-protocol.cpp.

wayland::proxy_t::operator bool () const [inherited]

Check whether this wrapper actually wraps an object.

Returns

true if there is an underlying object, false if this wrapper is empty

bool wayland::proxy_t::operator!= (const proxy_t & right) const [inherited]

Check whether two wrappers refer to different objects.

bool wayland::proxy_t::operator== (const proxy_t & right) const [inherited]

Check whether two wrappers refer to the same object.

bool wayland::proxy_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 wayland::proxy_t::proxy_release () [inherited]

Release the wrapped object (if any), making this an empty wrapper. Note that display_t instances cannot be released this way. Attempts to do so are ignored.

Examples foreign_display.cpp.

void data_device_t::release ()

destroy data device This request destroys the data device.

Definition at line 2283 of file wayland-client-protocol.cpp.

void wayland::proxy_t::set_queue (event_queue_t queue) [inherited]

Assign a proxy to an event queue.

Parameters

queue The event queue that will handle this proxy

Assign proxy to event queue. Events coming from proxy will be queued in queue instead of the display's main queue.

See also: display_t::dispatch_queue().

Examples proxy_wrapper.cpp.

void data_device_t::set_selection (data_source_t const & source, uint32_t serial)

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 2277 of file wayland-client-protocol.cpp.

void data_device_t::start_drag (data_source_t const & source, surface_t const & origin, surface_t const & icon, uint32_t serial)

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 2271 of file wayland-client-protocol.cpp.

Member Data Documentation

constexpr std::uint32_t wayland::data_device_t::release_since_version = 2 [static], [constexpr]

Minimum protocol version required for the release function.

Definition at line 1298 of file wayland-client-protocol.hpp.

constexpr std::uint32_t wayland::data_device_t::set_selection_since_version = 1 [static], [constexpr]

Minimum protocol version required for the set_selection function.

Definition at line 1287 of file wayland-client-protocol.hpp.

constexpr std::uint32_t wayland::data_device_t::start_drag_since_version = 1 [static], [constexpr]

Minimum protocol version required for the start_drag function.

Definition at line 1271 of file wayland-client-protocol.hpp.

Author

Generated automatically by Doxygen for Wayland++ from the source code.

Info

Sat Jan 27 2024 00:00:00 Version 1.0.0 Wayland++