Wayland++
0.2.6
C++ Bindings for Wayland
|
offer to transfer data 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 | offer (std::string mime_type) |
add an offered mime type More... | |
void | set_actions (data_device_manager_dnd_action dnd_actions) |
set the available drag-and-drop actions More... | |
bool | can_set_actions () const |
Check whether the set_actions function is available with the currently bound version of the protocol. More... | |
std::function< void(std::string)> & | on_target () |
a target accepts an offered mime type More... | |
std::function< void(std::string, int)> & | on_send () |
send the data More... | |
std::function< void()> & | on_cancelled () |
selection was cancelled More... | |
std::function< void()> & | on_dnd_drop_performed () |
the drag-and-drop operation physically finished More... | |
std::function< void()> & | on_dnd_finished () |
the drag-and-drop operation concluded More... | |
std::function< void(data_device_manager_dnd_action)> & | on_action () |
notify the selected action 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 | offer_since_version = 1 |
Minimum protocol version required for the offer function. More... | |
static constexpr std::uint32_t | set_actions_since_version = 3 |
Minimum protocol version required for the set_actions function. More... | |
offer to transfer data
The wl_data_source object is the source side of a wl_data_offer. It is created by the source client in a data transfer and provides a way to describe the offered data and a way to respond to requests to transfer the data.
Definition at line 898 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_source_t::can_set_actions | ( | ) | const |
Check whether the set_actions function is available with the currently bound version of the protocol.
Definition at line 2106 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.
void data_source_t::offer | ( | std::string | mime_type | ) |
add an offered mime type
mime_type | mime type offered by the data source |
This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types.
Definition at line 2097 of file wayland-client-protocol.cpp.
std::function< void(data_device_manager_dnd_action)> & data_source_t::on_action | ( | ) |
notify the selected action
dnd_action | action selected by the compositor |
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.
This event can be emitted multiple times during the drag-and-drop operation, mainly in response to destination side changes through wl_data_offer.set_actions, and as the data device enters/leaves surfaces.
It is only possible to receive this event after wl_data_source.dnd_drop_performed if the drag-and-drop operation ended in an "ask" action, in which case the final wl_data_source.action event will happen immediately before wl_data_source.dnd_finished.
Compositors may also change the selected action on the fly, mainly in response to keyboard modifier changes during the drag-and-drop operation.
The most recent action received is always the valid one. The chosen action may change alongside negotiation (e.g. an "ask" action can turn into a "move" operation), so the effects of the final action must always be applied in wl_data_offer.dnd_finished.
Clients can trigger cursor surface changes from this point, so they reflect the current action.
Definition at line 2136 of file wayland-client-protocol.cpp.
std::function< void()> & data_source_t::on_cancelled | ( | ) |
selection was cancelled
This data source is no longer valid. There are several reasons why this could happen:
The client should clean up and destroy this data source.
For objects of version 2 or older, wl_data_source.cancelled will only be emitted if the data source was replaced by another data source.
Definition at line 2121 of file wayland-client-protocol.cpp.
std::function< void()> & data_source_t::on_dnd_drop_performed | ( | ) |
the drag-and-drop operation physically finished
The user performed the drop action. This event does not indicate acceptance, wl_data_source.cancelled may still be emitted afterwards if the drop destination does not accept any mime type.
However, this event might however not be received if the compositor cancelled the drag-and-drop operation before this event could happen.
Note that the data_source may still be used in the future and should not be destroyed here.
Definition at line 2126 of file wayland-client-protocol.cpp.
std::function< void()> & data_source_t::on_dnd_finished | ( | ) |
the drag-and-drop operation concluded
The drop destination finished interoperating with this data source, so the client is now free to destroy this data source and free all associated data.
If the action used to perform the operation was "move", the source can now delete the transferred data.
Definition at line 2131 of file wayland-client-protocol.cpp.
std::function< void(std::string, int)> & data_source_t::on_send | ( | ) |
send the data
mime_type | mime type for the data |
fd | file descriptor for the data |
Request for data from the client. Send the data as the specified mime type over the passed file descriptor, then close it.
Definition at line 2116 of file wayland-client-protocol.cpp.
std::function< void(std::string)> & data_source_t::on_target | ( | ) |
a target accepts an offered mime type
mime_type | mime type accepted by the target |
Sent when a target accepts pointer_focus or motion events. If a target does not accept any of the offered types, type is NULL.
Used for feedback during drag-and-drop.
Definition at line 2111 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_source_t::set_actions | ( | data_device_manager_dnd_action | dnd_actions | ) |
set the available drag-and-drop actions
dnd_actions | actions supported by the data source |
Sets the actions that the source side client supports for this operation. This request may trigger wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action.
The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, otherwise it will result in a protocol error.
This request must be made once only, and can only be made on sources used in drag-and-drop, so it must be performed before wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error.
Definition at line 2102 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().
|
staticconstexpr |
Minimum protocol version required for the offer function.
Definition at line 938 of file wayland-client-protocol.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_actions function.
Definition at line 962 of file wayland-client-protocol.hpp.