pub struct WlPointer { /* private fields */ }
Expand description

pointer input device

The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus of a seat.

The wl_pointer interface generates motion, enter and leave events for the surfaces that the pointer is located over, and button and axis events for button presses, button releases and scrolling.

See also the Request enum for this interface.

Implementations§

source§

impl WlPointer

source

pub fn enter( &self, serial: u32, surface: &WlSurface, surface_x: f64, surface_y: f64 )

enter event

Notification that this seat’s pointer is focused on a certain surface.

When a seat’s focus enters a surface, the pointer image is undefined and a client should respond to this event by setting an appropriate pointer image with the set_cursor request.

source

pub fn leave(&self, serial: u32, surface: &WlSurface)

leave event

Notification that this seat’s pointer is no longer focused on a certain surface.

The leave notification is sent before the enter notification for the new focus.

source

pub fn motion(&self, time: u32, surface_x: f64, surface_y: f64)

pointer motion event

Notification of pointer location change. The arguments surface_x and surface_y are the location relative to the focused surface.

source

pub fn button(&self, serial: u32, time: u32, button: u32, state: ButtonState)

pointer button event

Mouse button click and release notifications.

The location of the click is given by the last motion or enter event. The time argument is a timestamp with millisecond granularity, with an undefined base.

The button is a button code as defined in the Linux kernel’s linux/input-event-codes.h header file, e.g. BTN_LEFT.

Any 16-bit button code value is reserved for future additions to the kernel’s event code list. All other button codes above 0xFFFF are currently undefined but may be used in future versions of this protocol.

source

pub fn axis(&self, time: u32, axis: Axis, value: f64)

axis event

Scroll and other axis notifications.

For scroll events (vertical and horizontal scroll axes), the value parameter is the length of a vector along the specified axis in a coordinate space identical to those of motion events, representing a relative movement along the specified axis.

For devices that support movements non-parallel to axes multiple axis events will be emitted.

When applicable, for example for touch pads, the server can choose to emit scroll events where the motion vector is equivalent to a motion event vector.

When applicable, a client can transform its content relative to the scroll distance.

source

pub fn frame(&self)

end of a pointer event sequence

Indicates the end of a set of events that logically belong together. A client is expected to accumulate the data in all events within the frame before proceeding.

All wl_pointer events before a wl_pointer.frame event belong logically together. For example, in a diagonal scroll motion the compositor will send an optional wl_pointer.axis_source event, two wl_pointer.axis events (horizontal and vertical) and finally a wl_pointer.frame event. The client may use this information to calculate a diagonal vector for scrolling.

When multiple wl_pointer.axis events occur within the same frame, the motion vector is the combined motion of all events. When a wl_pointer.axis and a wl_pointer.axis_stop event occur within the same frame, this indicates that axis movement in one axis has stopped but continues in the other axis. When multiple wl_pointer.axis_stop events occur within the same frame, this indicates that these axes stopped in the same instance.

A wl_pointer.frame event is sent for every logical event group, even if the group only contains a single wl_pointer event. Specifically, a client may get a sequence: motion, frame, button, frame, axis, frame, axis_stop, frame.

The wl_pointer.enter and wl_pointer.leave events are logical events generated by the compositor and not the hardware. These events are also grouped by a wl_pointer.frame. When a pointer moves from one surface to another, a compositor should group the wl_pointer.leave event within the same wl_pointer.frame. However, a client must not rely on wl_pointer.leave and wl_pointer.enter being in the same wl_pointer.frame. Compositor-specific policies may require the wl_pointer.leave and wl_pointer.enter event being split across multiple wl_pointer.frame groups.

source

pub fn axis_source(&self, axis_source: AxisSource)

axis source event

Source information for scroll and other axes.

This event does not occur on its own. It is sent before a wl_pointer.frame event and carries the source information for all events within that frame.

The source specifies how this event was generated. If the source is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be sent when the user lifts the finger off the device.

If the source is wl_pointer.axis_source.wheel, wl_pointer.axis_source.wheel_tilt or wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may or may not be sent. Whether a compositor sends an axis_stop event for these sources is hardware-specific and implementation-dependent; clients must not rely on receiving an axis_stop event for these scroll sources and should treat scroll sequences from these scroll sources as unterminated by default.

This event is optional. If the source is unknown for a particular axis event sequence, no event is sent. Only one wl_pointer.axis_source event is permitted per frame.

The order of wl_pointer.axis_discrete and wl_pointer.axis_source is not guaranteed.

source

pub fn axis_stop(&self, time: u32, axis: Axis)

axis stop event

Stop notification for scroll and other axes.

For some wl_pointer.axis_source types, a wl_pointer.axis_stop event is sent to notify a client that the axis sequence has terminated. This enables the client to implement kinetic scrolling. See the wl_pointer.axis_source documentation for information on when this event may be generated.

Any wl_pointer.axis events with the same axis_source after this event should be considered as the start of a new axis motion.

The timestamp is to be interpreted identical to the timestamp in the wl_pointer.axis event. The timestamp value may be the same as a preceding wl_pointer.axis event.

source

pub fn axis_discrete(&self, axis: Axis, discrete: i32)

axis click event

Discrete step information for scroll and other axes.

This event carries the axis value of the wl_pointer.axis event in discrete steps (e.g. mouse wheel clicks).

This event is deprecated with wl_pointer version 8 - this event is not sent to clients supporting version 8 or later.

This event does not occur on its own, it is coupled with a wl_pointer.axis event that represents this axis value on a continuous scale. The protocol guarantees that each axis_discrete event is always followed by exactly one axis event with the same axis number within the same wl_pointer.frame. Note that the protocol allows for other events to occur between the axis_discrete and its coupled axis event, including other axis_discrete or axis events. A wl_pointer.frame must not contain more than one axis_discrete event per axis type.

This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete steps and do not generate this event.

The discrete value carries the directional information. e.g. a value of -2 is two steps towards the negative direction of this axis.

The axis number is identical to the axis number in the associated axis event.

The order of wl_pointer.axis_discrete and wl_pointer.axis_source is not guaranteed.

source

pub fn axis_value120(&self, axis: Axis, value120: i32)

axis high-resolution scroll event

Discrete high-resolution scroll information.

This event carries high-resolution wheel scroll information, with each multiple of 120 representing one logical scroll step (a wheel detent). For example, an axis_value120 of 30 is one quarter of a logical scroll step in the positive direction, a value120 of -240 are two logical scroll steps in the negative direction within the same hardware event. Clients that rely on discrete scrolling should accumulate the value120 to multiples of 120 before processing the event.

The value120 must not be zero.

This event replaces the wl_pointer.axis_discrete event in clients supporting wl_pointer version 8 or later.

Where a wl_pointer.axis_source event occurs in the same wl_pointer.frame, the axis source applies to this event.

The order of wl_pointer.axis_value120 and wl_pointer.axis_source is not guaranteed.

source

pub fn axis_relative_direction( &self, axis: Axis, direction: AxisRelativeDirection )

axis relative physical direction event

Relative directional information of the entity causing the axis motion.

For a wl_pointer.axis event, the wl_pointer.axis_relative_direction event specifies the movement direction of the entity causing the wl_pointer.axis event. For example:

  • if a user’s fingers on a touchpad move down and this causes a wl_pointer.axis vertical_scroll down event, the physical direction is ‘identical’
  • if a user’s fingers on a touchpad move down and this causes a wl_pointer.axis vertical_scroll up scroll up event (‘natural scrolling’), the physical direction is ‘inverted’.

A client may use this information to adjust scroll motion of components. Specifically, enabling natural scrolling causes the content to change direction compared to traditional scrolling. Some widgets like volume control sliders should usually match the physical direction regardless of whether natural scrolling is active. This event enables clients to match the scroll direction of a widget to the physical direction.

This event does not occur on its own, it is coupled with a wl_pointer.axis event that represents this axis value. The protocol guarantees that each axis_relative_direction event is always followed by exactly one axis event with the same axis number within the same wl_pointer.frame. Note that the protocol allows for other events to occur between the axis_relative_direction and its coupled axis event.

The axis number is identical to the axis number in the associated axis event.

The order of wl_pointer.axis_relative_direction, wl_pointer.axis_discrete and wl_pointer.axis_source is not guaranteed.

Trait Implementations§

source§

impl Borrow<ObjectId> for WlPointer

source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
source§

impl Clone for WlPointer

source§

fn clone(&self) -> WlPointer

Returns a copy 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 WlPointer

source§

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

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

impl Hash for WlPointer

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<Weak<WlPointer>> for WlPointer

source§

fn eq(&self, other: &Weak<WlPointer>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for WlPointer

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Resource for WlPointer

§

type Request = Request

The request enum for this interface
§

type Event<'event> = Event<'event>

The event enum for this interface
source§

fn interface() -> &'static Interface

The interface description
source§

fn id(&self) -> ObjectId

The ID of this object
source§

fn version(&self) -> u32

The version of this object
source§

fn data<U: 'static>(&self) -> Option<&U>

Access the user-data associated with this object
source§

fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>

Access the raw data associated with this object. Read more
source§

fn handle(&self) -> &WeakHandle

Access the backend handle associated with this object
source§

fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>

Create an object resource from its ID Read more
source§

fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>

Send an event to this object
source§

fn parse_request( conn: &DisplayHandle, msg: Message<ObjectId, OwnedFd> ) -> Result<(Self, Self::Request), DispatchError>

Parse a event for this object Read more
source§

fn write_event<'a>( &self, conn: &DisplayHandle, msg: Self::Event<'a> ) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>

Serialize an event for this object Read more
source§

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

The client owning this object Read more
source§

fn is_alive(&self) -> bool

Checks if the Wayland object associated with this proxy is still alive
source§

fn post_error(&self, code: impl Into<u32>, error: impl Into<String>)

Trigger a protocol error on this object Read more
source§

fn downgrade(&self) -> Weak<Self>

Creates a weak handle to this object Read more
source§

impl Eq for WlPointer

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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,

§

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>,

§

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>,

§

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.