Trait PointerScrollEvent

Source
pub trait PointerScrollEvent: AsRaw<libinput_event_pointer> {
    // Provided methods
    fn has_axis(&self, axis: Axis) -> bool { ... }
    fn scroll_value(&self, axis: Axis) -> f64 { ... }
}
Expand description

Common functions of PointerScroll type events

Provided Methods§

Source

fn has_axis(&self, axis: Axis) -> bool

Check if the event has a valid value for the given axis.

If this function returns true for an axis and axis_value returns a value of 0, the event is a scroll stop event.

Source

fn scroll_value(&self, axis: Axis) -> f64

Return the axis value of the given axis.

The interpretation of the value depends on the axis. For the two scrolling axes Axis::Vertical and Axis::Horizontal, the value of the event is in relative scroll units, with the positive direction being down or right, respectively. If PointerScrollEvent::has_axis returns false for an axis, this function returns 0 for that axis.

If the event is a PointerScrollFingerEvent, libinput guarantees that a scroll sequence is terminated with a scroll value of 0. A caller may use this information to decide on whether kinetic scrolling should be triggered on this scroll sequence. The coordinate system is identical to the cursor movement, i.e. a scroll value of 1 represents the equivalent relative motion of 1.

If the event is a PointerScrollWheelEvent, no terminating event is guaranteed (though it may happen). Scrolling is in discrete steps, the value is the angle the wheel moved in degrees. The default is 15 degrees per wheel click, but some mice may have differently grained wheels. It is up to the caller how to interpret such different step sizes. Callers should use PointerScrollWheelEvent::scroll_value_v120 for a simpler API of handling scroll wheel events of different step sizes.

If the event is a PointerScrollContinuousEvent, libinput guarantees that a scroll sequence is terminated with a scroll value of 0. The coordinate system is identical to the cursor movement, i.e. a scroll value of 1 represents the equivalent relative motion of 1.

Implementors§