Struct smithay_client_toolkit::data_device::DataOffer
source · [−]pub struct DataOffer { /* private fields */ }
Expand description
A data offer for receiving data though copy/paste or drag and drop
Implementations
sourceimpl DataOffer
impl DataOffer
sourcepub fn with_mime_types<F, T>(&self, f: F) -> T where
F: FnOnce(&[String]) -> T,
pub fn with_mime_types<F, T>(&self, f: F) -> T where
F: FnOnce(&[String]) -> T,
Access the list of mime types proposed by this offer
sourcepub fn get_available_actions(&self) -> DndAction
pub fn get_available_actions(&self) -> DndAction
Get the list of available actions for this offer
sourcepub fn get_current_action(&self) -> DndAction
pub fn get_current_action(&self) -> DndAction
Get the currently set final action for this offer
sourcepub fn accept(&self, mime_type: Option<String>)
pub fn accept(&self, mime_type: Option<String>)
Accept a mime type for receiving data through this offer
sourcepub fn receive(&self, mime_type: String) -> Result<ReadPipe>
pub fn receive(&self, mime_type: String) -> Result<ReadPipe>
Request to receive the data of a given mime type
You can do this several times, as a reaction to motion of the dnd cursor, or to inspect the data in order to choose your response.
Note that you should not read the contents right away in a blocking way, as you may deadlock your application doing so. At least make sure you flush your events to the server before doing so.
Fails if too many file descriptors were already open and a pipe could not be created.
sourcepub fn set_actions(&self, supported: DndAction, preferred: DndAction)
pub fn set_actions(&self, supported: DndAction, preferred: DndAction)
Notify the send and compositor of the dnd actions you accept
You need to provide the set of supported actions, as well as a single preferred action.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for DataOffer
impl Send for DataOffer
impl Sync for DataOffer
impl Unpin for DataOffer
impl !UnwindSafe for DataOffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more