pub struct DataDevice {
    device: WlDataDevice,
    inner: Arc<Mutex<Inner>>,
}
Expand description

Handle to support data exchange on a given seat

This type provides you with functionality to send and receive data through drag’n’drop or copy/paste actions. It is associated with a seat upon creation.

Fields§

§device: WlDataDevice§inner: Arc<Mutex<Inner>>

Implementations§

source§

impl DataDevice

source

pub fn init_for_seat<F>( manager: &WlDataDeviceManager, seat: &WlSeat, callback: F ) -> DataDevicewhere for<'a> F: FnMut(DndEvent<'a>, DispatchData<'_>) + 'static,

Create the DataDevice helper for this seat.

You need to provide an implementation that will handle drag’n’drop events.

source

pub fn start_drag( &self, origin: &WlSurface, source: Option<DataSource>, actions: DndAction, icon: Option<&WlSurface>, serial: u32 )

Start a drag’n’drop offer

You need to specify the origin surface, as well a serial associated to an implicit grab on this surface (for example received by a pointer click).

An optional DataSource can be provided. If it is None, this drag’n’drop will be considered as internal to your application, and other applications will not be notified of it. You are then responsible for acting accordingly on drop.

You also need to specify which possible drag’n’drop actions are associated to this drag (copy, move, or ask), the final action will be chosen by the target and/or compositor.

You can finally provide a surface that will be used as an icon associated with this drag’n’drop for user visibility.

source

pub fn set_selection(&self, source: &Option<DataSource>, serial: u32)

Provide a data source as the new content for the selection

Correspond to traditional copy/paste behavior. Setting the source to None will clear the selection.

source

pub fn with_selection<F, T>(&self, f: F) -> Twhere F: FnOnce(Option<&DataOffer>) -> T,

Access the DataOffer currently associated with the selection buffer

source

pub fn with_dnd<F, T>(&self, f: F) -> Twhere F: FnOnce(Option<&DataOffer>) -> T,

Access the DataOffer currently associated with current DnD

Trait Implementations§

source§

impl Debug for DataDevice

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for DataDevice

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.