pub struct WlDataOffer { /* private fields */ }
Expand description
offer to transfer data
A wl_data_offer represents a piece of data offered for transfer by another client (the source client). It is used by the copy-and-paste and drag-and-drop mechanisms. The offer describes the different mime types that the data can be converted to and provides the mechanism for transferring the data directly from the source client.
See also the Request enum for this interface.
Implementations§
Source§impl WlDataOffer
impl WlDataOffer
Sourcepub fn offer(&self, mime_type: String)
pub fn offer(&self, mime_type: String)
advertise offered mime type
Sent immediately after creating the wl_data_offer object. One event per offered mime type.
Sourcepub fn source_actions(&self, source_actions: DndAction)
pub fn source_actions(&self, source_actions: DndAction)
notify the source-side available actions
This event indicates the actions offered by the data source. It will be sent immediately after creating the wl_data_offer object, or anytime the source side changes its offered actions through wl_data_source.set_actions.
Sourcepub fn action(&self, dnd_action: DndAction)
pub fn action(&self, dnd_action: DndAction)
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 in response to destination side action changes through wl_data_offer.set_actions.
This event will no longer be emitted after wl_data_device.drop happened on the drag-and-drop destination, the client must honor the last action received, or the last preferred one set through wl_data_offer.set_actions when handling an “ask” action.
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. Prior to receiving wl_data_device.drop, the chosen action may change (e.g. due to keyboard modifiers being pressed). At the time of receiving wl_data_device.drop the drag-and-drop destination must honor the last action received.
Action changes may still happen after wl_data_device.drop, especially on “ask” actions, where the drag-and-drop destination may choose another action afterwards. Action changes happening at this stage are always the result of inter-client negotiation, the compositor shall no longer be able to induce a different action.
Upon “ask” actions, it is expected that the drag-and-drop destination may potentially choose a different action and/or mime type, based on wl_data_offer.source_actions and finally chosen by the user (e.g. popping up a menu with the available options). The final wl_data_offer.set_actions and wl_data_offer.accept requests must happen before the call to wl_data_offer.finish.
Trait Implementations§
Source§impl Borrow<ObjectId> for WlDataOffer
impl Borrow<ObjectId> for WlDataOffer
Source§impl Clone for WlDataOffer
impl Clone for WlDataOffer
Source§fn clone(&self) -> WlDataOffer
fn clone(&self) -> WlDataOffer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WlDataOffer
impl Debug for WlDataOffer
Source§impl Hash for WlDataOffer
impl Hash for WlDataOffer
Source§impl PartialEq<Weak<WlDataOffer>> for WlDataOffer
impl PartialEq<Weak<WlDataOffer>> for WlDataOffer
Source§impl PartialEq for WlDataOffer
impl PartialEq for WlDataOffer
Source§impl Resource for WlDataOffer
impl Resource for WlDataOffer
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 send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>
fn send_event(&self, evt: Self::Event<'_>) -> Result<(), 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<'a>(
&self,
conn: &DisplayHandle,
msg: Self::Event<'a>,
) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
fn write_event<'a>( &self, conn: &DisplayHandle, msg: Self::Event<'a>, ) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
Source§fn is_alive(&self) -> bool
fn is_alive(&self) -> bool
impl Eq for WlDataOffer
Auto Trait Implementations§
impl Freeze for WlDataOffer
impl !RefUnwindSafe for WlDataOffer
impl Send for WlDataOffer
impl Sync for WlDataOffer
impl Unpin for WlDataOffer
impl !UnwindSafe for WlDataOffer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.