pub struct WlDataDevice { /* private fields */ }Expand description
A wl_data_device object.
See the documentation of the module for the interface description.
Implementations§
Source§impl WlDataDevice
impl WlDataDevice
Sourcepub fn set_handler(&self, handler: impl WlDataDeviceHandler)
pub fn set_handler(&self, handler: impl WlDataDeviceHandler)
Sets a new handler.
Sourcepub fn set_boxed_handler(&self, handler: Box<dyn WlDataDeviceHandler>)
pub fn set_boxed_handler(&self, handler: Box<dyn WlDataDeviceHandler>)
Sets a new, already boxed handler.
Source§impl WlDataDevice
impl WlDataDevice
Sourcepub const MSG__START_DRAG__SINCE: u32 = 1u32
pub const MSG__START_DRAG__SINCE: u32 = 1u32
Since when the start_drag message is available.
Sourcepub const MSG__SET_SELECTION__SINCE: u32 = 1u32
pub const MSG__SET_SELECTION__SINCE: u32 = 1u32
Since when the set_selection message is available.
Sourcepub const MSG__DATA_OFFER__SINCE: u32 = 1u32
pub const MSG__DATA_OFFER__SINCE: u32 = 1u32
Since when the data_offer message is available.
Sourcepub const MSG__ENTER__SINCE: u32 = 1u32
pub const MSG__ENTER__SINCE: u32 = 1u32
Since when the enter message is available.
Sourcepub const MSG__LEAVE__SINCE: u32 = 1u32
pub const MSG__LEAVE__SINCE: u32 = 1u32
Since when the leave message is available.
Sourcepub const MSG__MOTION__SINCE: u32 = 1u32
pub const MSG__MOTION__SINCE: u32 = 1u32
Since when the motion message is available.
Sourcepub const MSG__DROP__SINCE: u32 = 1u32
pub const MSG__DROP__SINCE: u32 = 1u32
Since when the drop message is available.
Sourcepub const MSG__SELECTION__SINCE: u32 = 1u32
pub const MSG__SELECTION__SINCE: u32 = 1u32
Since when the selection message is available.
Sourcepub const MSG__RELEASE__SINCE: u32 = 2u32
pub const MSG__RELEASE__SINCE: u32 = 2u32
Since when the release message is available.
Sourcepub fn try_send_start_drag(
&self,
source: Option<&Rc<WlDataSource>>,
origin: &Rc<WlSurface>,
icon: Option<&Rc<WlSurface>>,
serial: u32,
) -> Result<(), ObjectError>
pub fn try_send_start_drag( &self, source: Option<&Rc<WlDataSource>>, origin: &Rc<WlSurface>, icon: Option<&Rc<WlSurface>>, serial: u32, ) -> Result<(), ObjectError>
start drag-and-drop operation
This request asks the compositor to start a drag-and-drop operation on behalf of the client.
The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled.
The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial.
The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error.
The input region is ignored for wl_surfaces with the role of a drag-and-drop icon.
The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
§Arguments
source: data source for the eventual transferorigin: surface where the drag originatesicon: drag-and-drop icon surfaceserial: serial number of the implicit grab on the origin
Sourcepub fn send_start_drag(
&self,
source: Option<&Rc<WlDataSource>>,
origin: &Rc<WlSurface>,
icon: Option<&Rc<WlSurface>>,
serial: u32,
)
pub fn send_start_drag( &self, source: Option<&Rc<WlDataSource>>, origin: &Rc<WlSurface>, icon: Option<&Rc<WlSurface>>, serial: u32, )
start drag-and-drop operation
This request asks the compositor to start a drag-and-drop operation on behalf of the client.
The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled.
The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial.
The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error.
The input region is ignored for wl_surfaces with the role of a drag-and-drop icon.
The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
§Arguments
source: data source for the eventual transferorigin: surface where the drag originatesicon: drag-and-drop icon surfaceserial: serial number of the implicit grab on the origin
Sourcepub fn try_send_set_selection(
&self,
source: Option<&Rc<WlDataSource>>,
serial: u32,
) -> Result<(), ObjectError>
pub fn try_send_set_selection( &self, source: Option<&Rc<WlDataSource>>, serial: u32, ) -> Result<(), ObjectError>
copy data to the selection
This request asks the compositor to set the selection to the data from the source on behalf of the client.
To unset the selection, set the source to NULL.
The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
§Arguments
source: data source for the selectionserial: serial number of the event that triggered this request
Sourcepub fn send_set_selection(&self, source: Option<&Rc<WlDataSource>>, serial: u32)
pub fn send_set_selection(&self, source: Option<&Rc<WlDataSource>>, serial: u32)
copy data to the selection
This request asks the compositor to set the selection to the data from the source on behalf of the client.
To unset the selection, set the source to NULL.
The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
§Arguments
source: data source for the selectionserial: serial number of the event that triggered this request
Sourcepub fn try_send_data_offer(
&self,
id: &Rc<WlDataOffer>,
) -> Result<(), ObjectError>
pub fn try_send_data_offer( &self, id: &Rc<WlDataOffer>, ) -> Result<(), ObjectError>
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.
§Arguments
id: the new data_offer object
Sourcepub fn send_data_offer(&self, id: &Rc<WlDataOffer>)
pub fn send_data_offer(&self, id: &Rc<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.
§Arguments
id: the new data_offer object
Sourcepub fn new_try_send_data_offer(&self) -> Result<Rc<WlDataOffer>, ObjectError>
pub fn new_try_send_data_offer(&self) -> Result<Rc<WlDataOffer>, ObjectError>
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 new_send_data_offer(&self) -> Rc<WlDataOffer>
pub fn new_send_data_offer(&self) -> Rc<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 try_send_enter(
&self,
serial: u32,
surface: &Rc<WlSurface>,
x: Fixed,
y: Fixed,
id: Option<&Rc<WlDataOffer>>,
) -> Result<(), ObjectError>
pub fn try_send_enter( &self, serial: u32, surface: &Rc<WlSurface>, x: Fixed, y: Fixed, id: Option<&Rc<WlDataOffer>>, ) -> Result<(), ObjectError>
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.
§Arguments
serial: serial number of the enter eventsurface: client surface enteredx: surface-local x coordinatey: surface-local y coordinateid: source data_offer object
Sourcepub fn send_enter(
&self,
serial: u32,
surface: &Rc<WlSurface>,
x: Fixed,
y: Fixed,
id: Option<&Rc<WlDataOffer>>,
)
pub fn send_enter( &self, serial: u32, surface: &Rc<WlSurface>, x: Fixed, y: Fixed, id: Option<&Rc<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.
§Arguments
serial: serial number of the enter eventsurface: client surface enteredx: surface-local x coordinatey: surface-local y coordinateid: source data_offer object
Sourcepub fn try_send_leave(&self) -> Result<(), ObjectError>
pub fn try_send_leave(&self) -> Result<(), ObjectError>
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 send_leave(&self)
pub fn send_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 try_send_motion(
&self,
time: u32,
x: Fixed,
y: Fixed,
) -> Result<(), ObjectError>
pub fn try_send_motion( &self, time: u32, x: Fixed, y: Fixed, ) -> Result<(), ObjectError>
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.
§Arguments
time: timestamp with millisecond granularityx: surface-local x coordinatey: surface-local y coordinate
Sourcepub fn send_motion(&self, time: u32, x: Fixed, y: Fixed)
pub fn send_motion(&self, time: u32, x: Fixed, y: Fixed)
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.
§Arguments
time: timestamp with millisecond granularityx: surface-local x coordinatey: surface-local y coordinate
Sourcepub fn try_send_drop(&self) -> Result<(), ObjectError>
pub fn try_send_drop(&self) -> Result<(), ObjectError>
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 send_drop(&self)
pub fn send_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 try_send_selection(
&self,
id: Option<&Rc<WlDataOffer>>,
) -> Result<(), ObjectError>
pub fn try_send_selection( &self, id: Option<&Rc<WlDataOffer>>, ) -> Result<(), ObjectError>
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.
§Arguments
id: selection data_offer object
Sourcepub fn send_selection(&self, id: Option<&Rc<WlDataOffer>>)
pub fn send_selection(&self, id: Option<&Rc<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.
§Arguments
id: selection data_offer object
Sourcepub fn try_send_release(&self) -> Result<(), ObjectError>
pub fn try_send_release(&self) -> Result<(), ObjectError>
destroy data device
This request destroys the data device.
Sourcepub fn send_release(&self)
pub fn send_release(&self)
destroy data device
This request destroys the data device.
Source§impl WlDataDevice
impl WlDataDevice
Sourcepub const ENM__ERROR_ROLE__SINCE: u32 = 1u32
pub const ENM__ERROR_ROLE__SINCE: u32 = 1u32
Since when the error.role enum variant is available.
Sourcepub const ENM__ERROR_USED_SOURCE__SINCE: u32 = 1u32
pub const ENM__ERROR_USED_SOURCE__SINCE: u32 = 1u32
Since when the error.used_source enum variant is available.
Trait Implementations§
Source§impl ConcreteObject for WlDataDevice
impl ConcreteObject for WlDataDevice
Source§const XML_VERSION: u32 = 3u32
const XML_VERSION: u32 = 3u32
Source§const INTERFACE: ObjectInterface = ObjectInterface::WlDataDevice
const INTERFACE: ObjectInterface = ObjectInterface::WlDataDevice
Source§const INTERFACE_NAME: &str = "wl_data_device"
const INTERFACE_NAME: &str = "wl_data_device"
Source§impl Debug for WlDataDevice
impl Debug for WlDataDevice
Source§impl Object for WlDataDevice
impl Object for WlDataDevice
Source§fn core(&self) -> &ObjectCore
fn core(&self) -> &ObjectCore
ObjectCore of this object.Source§fn unset_handler(&self)
fn unset_handler(&self)
Source§fn get_handler_any_ref(
&self,
) -> Result<HandlerRef<'_, dyn Any>, HandlerAccessError>
fn get_handler_any_ref( &self, ) -> Result<HandlerRef<'_, dyn Any>, HandlerAccessError>
Source§fn get_handler_any_mut(
&self,
) -> Result<HandlerMut<'_, dyn Any>, HandlerAccessError>
fn get_handler_any_mut( &self, ) -> Result<HandlerMut<'_, dyn Any>, HandlerAccessError>
Auto Trait Implementations§
impl !Freeze for WlDataDevice
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> ObjectCoreApi for T
impl<T> ObjectCoreApi for T
Source§fn client(&self) -> Option<Rc<Client>>
fn client(&self) -> Option<Rc<Client>>
Client associated with this object, if any.Source§fn interface(&self) -> ObjectInterface
fn interface(&self) -> ObjectInterface
ObjectInterface of this object.