Struct wayland_server::protocol::wl_data_source::WlDataSource
[−]
[src]
pub struct WlDataSource { /* fields omitted */ }
Methods
impl WlDataSource
[src]
fn target(&self, mime_type: Option<String>) -> EventResult<()>
[src]
a target accepts an offered mime type
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.
fn send(&self, mime_type: String, fd: RawFd) -> EventResult<()>
[src]
send the data
Request for data from the client. Send the data as the specified mime type over the passed file descriptor, then close it.
fn cancelled(&self) -> EventResult<()>
[src]
selection was cancelled
This data source is no longer valid. There are several reasons why this could happen:
- The data source has been replaced by another data source.
- The drag-and-drop operation was performed, but the drop destination did not accept any of the mime types offered through wl_data_source.target.
- The drag-and-drop operation was performed, but the drop destination did not select any of the actions present in the mask offered through wl_data_source.action.
- The drag-and-drop operation was performed but didn't happen over a surface.
- The compositor cancelled the drag-and-drop operation (e.g. compositor dependent timeouts to avoid stale drag-and-drop transfers).
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.
fn dnd_drop_performed(&self) -> EventResult<()>
[src]
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.
This event is only available since version 3 of the interface
fn dnd_finished(&self) -> EventResult<()>
[src]
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.
This event is only available since version 3 of the interface
fn action(&self, dnd_action: u32) -> EventResult<()>
[src]
notify the selected action
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.
This event is only available since version 3 of the interface
Trait Implementations
impl Send for WlDataSource
[src]
impl Sync for WlDataSource
[src]
impl Resource for WlDataSource
[src]
fn ptr(&self) -> *mut wl_resource
[src]
Pointer to the underlying wayland proxy object
unsafe fn from_ptr_new(ptr: *mut wl_resource) -> WlDataSource
[src]
Create an instance from a wayland pointer Read more
unsafe fn from_ptr_initialized(ptr: *mut wl_resource) -> WlDataSource
[src]
Create an instance from a wayland pointer Read more
fn interface_ptr() -> *const wl_interface
[src]
Pointer to the interface representation
fn interface_name() -> &'static str
[src]
Internal wayland name of this interface
fn supported_version() -> u32
[src]
Max version of this interface supported
fn version(&self) -> i32
[src]
Current version of the interface this resource is instantiated with
fn status(&self) -> Liveness
[src]
Check if the resource behind this handle is actually still alive
fn equals(&self, other: &WlDataSource) -> bool
[src]
Check of two handles are actually the same wayland object Read more
fn set_user_data(&self, ptr: *mut ())
[src]
Set a pointer associated as user data on this resource Read more
fn get_user_data(&self) -> *mut ()
[src]
Get the pointer associated as user data on this resource Read more
unsafe fn clone_unchecked(&self) -> WlDataSource
[src]
Unsafely clone this resource handle Read more
fn post_error(&self, error_code: u32, msg: String)
[src]
Posts a protocol error to this resource Read more
fn clone(&self) -> Option<Self> where
Self: Sized,
[src]
Self: Sized,
Clone this resource handle Read more
fn same_client_as<R: Resource>(&self, other: &R) -> bool
[src]
Checks wether this resource and the other are from the same client Read more
impl<ID: 'static> Implementable<ID> for WlDataSource
[src]
type Implementation = Implementation<ID>
The type containing the implementation for the event callbacks
unsafe fn __dispatch_msg(
&self,
client: &Client,
opcode: u32,
args: *const wl_argument
) -> Result<(), ()>
[src]
&self,
client: &Client,
opcode: u32,
args: *const wl_argument
) -> Result<(), ()>