pub struct DragOffer {
pub serial: u32,
pub surface: WlSurface,
pub x: f64,
pub y: f64,
pub time: Option<u32>,
pub source_actions: DndAction,
pub selected_action: DndAction,
pub dropped: bool,
pub left: bool,
/* private fields */
}Fields§
§serial: u32the serial for this data offer’s enter event
surface: WlSurfacethe surface that this DnD is active on
x: f64the x position on the surface
y: f64the y position on this surface
time: Option<u32>the timestamp a motion event was received in millisecond granularity
source_actions: DndActionthe advertised drag actions
selected_action: DndActionthe compositor selected drag action
dropped: boolwhether or not the drag has been dropped
left: boolwhether or not the drag has left
Implementations§
source§impl DragOffer
impl DragOffer
pub fn finish(&self)
sourcepub fn with_mime_types<T, F: Fn(&[String]) -> T>(&self, callback: F) -> T
pub fn with_mime_types<T, F: Fn(&[String]) -> T>(&self, callback: F) -> T
Inspect the mime types available on the given offer.
sourcepub fn set_actions(&self, actions: DndAction, preferred_action: DndAction)
pub fn set_actions(&self, actions: DndAction, preferred_action: DndAction)
Set the accepted and preferred drag and drop actions. This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, the drag source will receive wl_data_source.cancelled.
sourcepub fn receive(&self, mime_type: String) -> Result<ReadPipe>
pub fn receive(&self, mime_type: String) -> Result<ReadPipe>
Receive data with the given mime type. This request may happen multiple times for different mime types, both before and after wl_data_device.drop. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance.
sourcepub fn accept_mime_type(&self, serial: u32, mime_type: Option<String>)
pub fn accept_mime_type(&self, serial: u32, mime_type: Option<String>)
Accept the given mime type, or None to reject the offer. In version 2, this request is used for feedback, but doesn’t affect the final result of the drag-and-drop operation. In version 3, this request determines the final result of the drag-and-drop operation.
sourcepub fn inner(&self) -> &WlDataOffer
pub fn inner(&self) -> &WlDataOffer
Retrieve a reference to the inner wl_data_offer.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DragOffer
impl Send for DragOffer
impl Sync for DragOffer
impl Unpin for DragOffer
impl !UnwindSafe for DragOffer
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.