Wayland++
0.2.6
C++ Bindings for Wayland
|
data transfer device More...
#include <wayland-client-protocol.hpp>
Public Types | |
enum | wrapper_type { wrapper_type::standard, wrapper_type::display, wrapper_type::foreign, wrapper_type::proxy_wrapper } |
Public Member Functions | |
void | start_drag (data_source_t source, surface_t origin, surface_t icon, uint32_t serial) |
start drag-and-drop operation More... | |
void | set_selection (data_source_t source, uint32_t serial) |
copy data to the selection More... | |
void | release () |
destroy data device More... | |
bool | can_release () const |
Check whether the release function is available with the currently bound version of the protocol. More... | |
std::function< void(data_offer_t)> & | on_data_offer () |
introduce a new wl_data_offer More... | |
std::function< void(uint32_t, surface_t, double, double, data_offer_t)> & | on_enter () |
initiate drag-and-drop session More... | |
std::function< void()> & | on_leave () |
end drag-and-drop session More... | |
std::function< void(uint32_t, double, double)> & | on_motion () |
drag-and-drop session motion More... | |
std::function< void()> & | on_drop () |
end drag-and-drop session successfully More... | |
std::function< void(data_offer_t)> & | on_selection () |
advertise new selection More... | |
uint32_t | get_id () const |
Get the id of a proxy object. More... | |
std::string | get_class () const |
Get the interface name (class) of a proxy object. More... | |
uint32_t | get_version () const |
Get the protocol object version of a proxy object. More... | |
wrapper_type | get_wrapper_type () const |
Get the type of a proxy object. More... | |
void | set_queue (event_queue_t queue) |
Assign a proxy to an event queue. More... | |
wl_proxy * | c_ptr () const |
Get a pointer to the underlying C struct. More... | |
bool | proxy_has_object () const |
Check whether this wrapper actually wraps an object. More... | |
operator bool () const | |
Check whether this wrapper actually wraps an object. More... | |
bool | operator== (const proxy_t &right) const |
Check whether two wrappers refer to the same object. More... | |
bool | operator!= (const proxy_t &right) const |
Check whether two wrappers refer to different objects. More... | |
void | proxy_release () |
Release the wrapped object (if any), making this an empty wrapper. More... | |
Static Public Attributes | |
static constexpr std::uint32_t | start_drag_since_version = 1 |
Minimum protocol version required for the start_drag function. More... | |
static constexpr std::uint32_t | set_selection_since_version = 1 |
Minimum protocol version required for the set_selection function. More... | |
static constexpr std::uint32_t | release_since_version = 2 |
Minimum protocol version required for the release function. More... | |
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 1099 of file wayland-client-protocol.hpp.
|
stronginherited |
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 105 of file wayland-client.hpp.
|
inherited |
Get a pointer to the underlying C struct.
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 2232 of file wayland-client-protocol.cpp.
|
inherited |
Get the interface name (class) of a proxy object.
|
inherited |
|
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.
|
inlineinherited |
Get the type of a proxy object.
Definition at line 288 of file wayland-client.hpp.
std::function< void(data_offer_t)> & data_device_t::on_data_offer | ( | ) |
introduce a new wl_data_offer
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 2237 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 2257 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
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 2242 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 2247 of file wayland-client-protocol.cpp.
std::function< void(uint32_t, double, double)> & data_device_t::on_motion | ( | ) |
drag-and-drop session motion
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 2252 of file wayland-client-protocol.cpp.
std::function< void(data_offer_t)> & data_device_t::on_selection | ( | ) |
advertise new selection
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. The client must destroy the previous selection data_offer, if any, upon receiving this event.
Definition at line 2262 of file wayland-client-protocol.cpp.
|
inherited |
Check whether this wrapper actually wraps an object.
|
inherited |
Check whether two wrappers refer to different objects.
|
inherited |
Check whether two wrappers refer to the same object.
|
inherited |
Check whether this wrapper actually wraps an object.
|
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.
void data_device_t::release | ( | ) |
destroy data device
This request destroys the data device.
Definition at line 2228 of file wayland-client-protocol.cpp.
|
inherited |
Assign a proxy to an event queue.
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().
void data_device_t::set_selection | ( | data_source_t | source, |
uint32_t | serial | ||
) |
copy data to the selection
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 2223 of file wayland-client-protocol.cpp.
void data_device_t::start_drag | ( | data_source_t | source, |
surface_t | origin, | ||
surface_t | icon, | ||
uint32_t | serial | ||
) |
start drag-and-drop operation
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.
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 2218 of file wayland-client-protocol.cpp.
|
staticconstexpr |
Minimum protocol version required for the release function.
Definition at line 1193 of file wayland-client-protocol.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_selection function.
Definition at line 1182 of file wayland-client-protocol.hpp.
|
staticconstexpr |
Minimum protocol version required for the start_drag function.
Definition at line 1166 of file wayland-client-protocol.hpp.