WlDataDevice

Struct WlDataDevice 

Source
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

Source

pub fn set_handler(&self, handler: impl WlDataDeviceHandler)

Sets a new handler.

Source

pub fn set_boxed_handler(&self, handler: Box<dyn WlDataDeviceHandler>)

Sets a new, already boxed handler.

Source§

impl WlDataDevice

Source

pub const MSG__START_DRAG__SINCE: u32 = 1u32

Since when the start_drag message is available.

Source

pub const MSG__SET_SELECTION__SINCE: u32 = 1u32

Since when the set_selection message is available.

Source

pub const MSG__DATA_OFFER__SINCE: u32 = 1u32

Since when the data_offer message is available.

Source

pub const MSG__ENTER__SINCE: u32 = 1u32

Since when the enter message is available.

Source

pub const MSG__LEAVE__SINCE: u32 = 1u32

Since when the leave message is available.

Source

pub const MSG__MOTION__SINCE: u32 = 1u32

Since when the motion message is available.

Source

pub const MSG__DROP__SINCE: u32 = 1u32

Since when the drop message is available.

Source

pub const MSG__SELECTION__SINCE: u32 = 1u32

Since when the selection message is available.

Source

pub const MSG__RELEASE__SINCE: u32 = 2u32

Since when the release message is available.

Source

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 transfer
  • origin: surface where the drag originates
  • icon: drag-and-drop icon surface
  • serial: serial number of the implicit grab on the origin
Source

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 transfer
  • origin: surface where the drag originates
  • icon: drag-and-drop icon surface
  • serial: serial number of the implicit grab on the origin
Source

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 selection
  • serial: serial number of the event that triggered this request
Source

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 selection
  • serial: serial number of the event that triggered this request
Source

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
Source

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
Source

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.

Source

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.

Source

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 event
  • surface: client surface entered
  • x: surface-local x coordinate
  • y: surface-local y coordinate
  • id: source data_offer object
Source

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 event
  • surface: client surface entered
  • x: surface-local x coordinate
  • y: surface-local y coordinate
  • id: source data_offer object
Source

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.

Source

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.

Source

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 granularity
  • x: surface-local x coordinate
  • y: surface-local y coordinate
Source

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 granularity
  • x: surface-local x coordinate
  • y: surface-local y coordinate
Source

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.

Source

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.

Source

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
Source

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
Source

pub fn try_send_release(&self) -> Result<(), ObjectError>

destroy data device

This request destroys the data device.

Source

pub fn send_release(&self)

destroy data device

This request destroys the data device.

Source§

impl WlDataDevice

Source

pub const ENM__ERROR_ROLE__SINCE: u32 = 1u32

Since when the error.role enum variant is available.

Source

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

Source§

const XML_VERSION: u32 = 3u32

The interface version from the XML file that the interface was generated from.
Source§

const INTERFACE: ObjectInterface = ObjectInterface::WlDataDevice

The interface of the object.
Source§

const INTERFACE_NAME: &str = "wl_data_device"

The interface of the object as a string.
Source§

impl Debug for WlDataDevice

Source§

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

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

impl Object for WlDataDevice

Source§

fn core(&self) -> &ObjectCore

Returns the ObjectCore of this object.
Source§

fn unset_handler(&self)

Unsets the handler of this object. Read more
Source§

fn get_handler_any_ref( &self, ) -> Result<HandlerRef<'_, dyn Any>, HandlerAccessError>

Returns a shared reference to the handler.
Source§

fn get_handler_any_mut( &self, ) -> Result<HandlerMut<'_, dyn Any>, HandlerAccessError>

Returns a mutable reference to the handler.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> ObjectCoreApi for T
where T: Object + ?Sized,

Source§

fn state(&self) -> &Rc<State>

Returns the State of this object.
Source§

fn client(&self) -> Option<Rc<Client>>

Returns the Client associated with this object, if any.
Source§

fn create_child<P>(&self) -> Rc<P>
where P: Object,

Creates a child of this object. Read more
Source§

fn interface(&self) -> ObjectInterface

Returns the ObjectInterface of this object.
Source§

fn version(&self) -> u32

Returns the version of this object.
Source§

fn unique_id(&self) -> u64

Returns the unique ID of this object. Read more
Source§

fn client_id(&self) -> Option<u32>

Returns the client ID of this object, if any.
Source§

fn server_id(&self) -> Option<u32>

Returns the server ID of this object, if any.
Source§

fn delete_id(&self)

Sends a wl_display.delete_id event for this object. Read more
Source§

fn try_delete_id(&self) -> Result<(), ObjectError>

Tries to send a wl_display.delete_id event for this object. Read more
Source§

fn set_forward_to_client(&self, enabled: bool)

Enables or disables automatic forwarding of events to the client. Read more
Source§

fn set_forward_to_server(&self, enabled: bool)

Enables or disables automatic forwarding of requests to the server. Read more
Source§

impl<T> ObjectUtils for T
where T: Object + ?Sized,

Source§

fn try_get_handler_ref<T>( &self, ) -> Result<HandlerRef<'_, T>, HandlerAccessError>
where T: 'static,

Tries to get a shared reference to the handler.
Source§

fn get_handler_ref<T>(&self) -> HandlerRef<'_, T>
where T: 'static,

Gets a shared reference to the handler. Read more
Source§

fn try_get_handler_mut<T>( &self, ) -> Result<HandlerMut<'_, T>, HandlerAccessError>
where T: 'static,

Tries to get a mutable reference to the handler.
Source§

fn get_handler_mut<T>(&self) -> HandlerMut<'_, T>
where T: 'static,

Gets a mutable reference to the handler. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.