[go: up one dir, main page]

Struct Device

Source
pub struct Device(/* private fields */);

Implementations§

Source§

impl Device

Source

pub fn version(&self) -> u32

Source

pub fn is_alive(&self) -> bool

Source§

impl Device

Source

pub fn destroyed(&self, serial: u32)

This device has been removed and a client should release all associated resources.

This ei_device object will be destroyed by the EIS implementation immmediately after after this event is sent and as such the client must not attempt to use it after that point.

Source

pub fn name(&self, name: &str)

The name of this device, if any. This event is optional and sent once immediately after object creation.

It is a protocol violation to send this event after the ei_device.done event.

Source

pub fn device_type(&self, device_type: DeviceType)

The device type, one of virtual or physical.

Devices of type ei_device.device_type.physical are supported only clients of type ei_handshake.context_type.receiver.

This event is sent once immediately after object creation. It is a protocol violation to send this event after the ei_device.done event.

Source

pub fn dimensions(&self, width: u32, height: u32)

The device dimensions in mm. This event is optional and sent once immediately after object creation.

This event is only sent for devices of ei_device.device_type.physical.

It is a protocol violation to send this event after the ei_device.done event.

Source

pub fn region( &self, offset_x: u32, offset_y: u32, width: u32, hight: u32, scale: f32, )

Notifies the client of one region. The number of regions is constant for a device and all regions are announced immediately after object creation.

A region is rectangular and defined by an x/y offset and a width and a height. A region defines the area on an EIS desktop layout that is accessible by this device - this region may not be the full area of the desktop. Input events may only be sent for points within the regions.

The use of regions is private to the EIS compositor and coordinates may not match the size of the actual desktop. For example, a compositor may set a 1920x1080 region to represent a 4K monitor and transparently map input events into the respective true pixels.

Absolute devices may have different regions, it is up to the libei client to send events through the correct device to target the right pixel. For example, a dual-head setup my have two absolute devices, the first with a zero offset region spanning the left screen, the second with a nonzero offset spanning the right screen.

The physical scale denotes a constant multiplication factor that needs to be applied to any relative movement on this region for that movement to match the same physical movement on another region.

It is an EIS implementation bug to advertise the touch and/or absolute pointer capability on a device_type.virtual device without advertising an ei_region for this device.

This event is optional and sent immediately after object creation. Where a device has multiple regions, this event is sent once for each region. It is a protocol violation to send this event after the ei_device.done event.

Note: the fourth argument (‘hight’) was misspelled when the protocol was declared stable but changing the name is an API breaking change.

Source

pub fn interface<InterfaceName: Interface>(&self, version: u32) -> InterfaceName

Notification that a new device has a sub-interface.

This event may be sent for the following interfaces:

  • “ei_pointer”
  • “ei_pointer_absolute”
  • “ei_scroll”
  • “ei_button”
  • “ei_keyboard”
  • “ei_touchscreen” The interface version is equal or less to the client-supported version in ei_handshake.interface_version for the respective interface.

It is a protocol violation to send a notification for an interface that the client has not bound to with ei_seat.bind.

This event is optional and sent immediately after object creation and at most once per interface. It is a protocol violation to send this event after the ei_device.done event.

Source

pub fn done(&self)

Notification that the initial burst of events is complete and the client can set up this device now.

It is a protocol violation to send this event more than once per device.

Source

pub fn resumed(&self, serial: u32)

Notification that the device has been resumed by the EIS implementation and (depending on the ei_handshake.context_type) the client may request ei_device.start_emulating or the EIS implementation may ei_device.start_emulating events.

It is a client bug to request emulation of events on a device that is not resumed. The EIS implementation may silently discard such events.

A newly advertised device is in the ei_device.paused state.

Source

pub fn paused(&self, serial: u32)

Notification that the device has been paused by the EIS implementation and no futher events will be accepted on this device until it is resumed again.

For devices of ei_device_setup.context_type sender, the client thus does not need to request ei_device.stop_emulating and may request ei_device.start_emulating after a subsequent ei_device.resumed.

For devices of ei_device_setup.context_type receiver and where the EIS implementation did not send a ei_device.stop_emulating prior to this event, the device may send a ei_device.start_emulating event after a subsequent ei_device.resumed event.

Pausing a device resets the logical state of the device to neutral. This includes:

  • any buttons or keys logically down are released
  • any modifiers logically down are released
  • any touches logically down are released

It is a client bug to request emulation of events on a device that is not resumed. The EIS implementation may silently discard such events.

A newly advertised device is in the ei_device.paused state.

Source

pub fn start_emulating(&self, serial: u32, sequence: u32)

See the ei_device.start_emulating request for details.

It is a protocol violation to send this event for a client of an ei_handshake.context_type other than receiver.

Source

pub fn stop_emulating(&self, serial: u32)

See the ei_device.stop_emulating request for details.

It is a protocol violation to send this event for a client of an ei_handshake.context_type other than receiver.

Source

pub fn frame(&self, serial: u32, timestamp: u64)

See the ei_device.frame request for details.

It is a protocol violation to send this event for a client of an ei_handshake.context_type other than receiver.

Source

pub fn region_mapping_id(&self, mapping_id: &str)

Notifies the client that the region specified in the next ei_device.region event is to be assigned the given mapping_id.

This ID can be used by the client to identify an external resource that has a relationship with this region. For example the client may receive a data stream with the video data that this region represents. By attaching the same identifier to the data stream and this region the EIS implementation can inform the client that the video data stream and the region represent paired data.

This event is optional and sent immediately after object creation but before the corresponding ei_device.region event. Where a device has multiple regions, this event may be sent zero or one time for each region. It is a protocol violation to send this event after the ei_device.done event or to send this event without a corresponding following ei_device.region event.

Trait Implementations§

Source§

impl Clone for Device

Source§

fn clone(&self) -> Device

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Device

Source§

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

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

impl Hash for Device

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Device

Source§

fn eq(&self, other: &Device) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Device

Source§

impl StructuralPartialEq for Device

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.