Struct wayland_server::protocol::wl_data_device::WlDataDevice
source · pub struct WlDataDevice { /* private fields */ }
Expand 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.
See also the Request enum for this interface.
Implementations§
source§impl WlDataDevice
impl WlDataDevice
sourcepub fn data_offer(&self, id: &WlDataOffer)
pub fn data_offer(&self, id: &WlDataOffer)
introduce a new wl_data_offer
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.
sourcepub fn enter(
&self,
serial: u32,
surface: &WlSurface,
x: f64,
y: f64,
id: Option<&WlDataOffer>
)
pub fn enter( &self, serial: u32, surface: &WlSurface, x: f64, y: f64, id: Option<&WlDataOffer> )
initiate drag-and-drop session
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.
sourcepub fn leave(&self)
pub fn leave(&self)
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.
sourcepub fn motion(&self, time: u32, x: f64, y: f64)
pub fn motion(&self, time: u32, x: f64, y: f64)
drag-and-drop session motion
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.
sourcepub fn drop(&self)
pub fn drop(&self)
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.
sourcepub fn selection(&self, id: Option<&WlDataOffer>)
pub fn selection(&self, id: Option<&WlDataOffer>)
advertise new selection
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.
Trait Implementations§
source§impl Clone for WlDataDevice
impl Clone for WlDataDevice
source§fn clone(&self) -> WlDataDevice
fn clone(&self) -> WlDataDevice
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WlDataDevice
impl Debug for WlDataDevice
source§impl PartialEq<Weak<WlDataDevice>> for WlDataDevice
impl PartialEq<Weak<WlDataDevice>> for WlDataDevice
source§impl PartialEq<WlDataDevice> for WlDataDevice
impl PartialEq<WlDataDevice> for WlDataDevice
source§fn eq(&self, other: &WlDataDevice) -> bool
fn eq(&self, other: &WlDataDevice) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Resource for WlDataDevice
impl Resource for WlDataDevice
source§fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
source§fn handle(&self) -> &WeakHandle
fn handle(&self) -> &WeakHandle
source§fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
source§fn parse_request(
conn: &DisplayHandle,
msg: Message<ObjectId, OwnedFd>
) -> Result<(Self, Self::Request), DispatchError>
fn parse_request( conn: &DisplayHandle, msg: Message<ObjectId, OwnedFd> ) -> Result<(Self, Self::Request), DispatchError>
source§fn write_event(
&self,
conn: &DisplayHandle,
msg: Self::Event
) -> Result<Message<ObjectId, RawFd>, InvalidId>
fn write_event( &self, conn: &DisplayHandle, msg: Self::Event ) -> Result<Message<ObjectId, RawFd>, InvalidId>
source§fn is_alive(&self) -> bool
fn is_alive(&self) -> bool
impl Eq for WlDataDevice
Auto Trait Implementations§
impl !RefUnwindSafe for WlDataDevice
impl Send for WlDataDevice
impl Sync for WlDataDevice
impl Unpin for WlDataDevice
impl !UnwindSafe for WlDataDevice
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.