pub trait TabletToolEventTrait: AsRaw<libinput_event_tablet_tool> + Context {
Show 31 methods
// Provided methods
fn time(&self) -> u32 { ... }
fn time_usec(&self) -> u64 { ... }
fn distance_has_changed(&self) -> bool { ... }
fn distance(&self) -> f64 { ... }
fn dx(&self) -> f64 { ... }
fn dy(&self) -> f64 { ... }
fn pressure_has_changed(&self) -> bool { ... }
fn pressure(&self) -> f64 { ... }
fn rotation_has_changed(&self) -> bool { ... }
fn rotation(&self) -> f64 { ... }
fn slider_has_changed(&self) -> bool { ... }
fn slider_position(&self) -> f64 { ... }
fn tilt_x_has_changed(&self) -> bool { ... }
fn tilt_y_has_changed(&self) -> bool { ... }
fn tilt_x(&self) -> f64 { ... }
fn tilt_y(&self) -> f64 { ... }
fn size_major_has_changed(&self) -> bool { ... }
fn size_minor_has_changed(&self) -> bool { ... }
fn size_major(&self) -> f64 { ... }
fn size_minor(&self) -> f64 { ... }
fn wheel_has_changed(&self) -> bool { ... }
fn wheel_delta(&self) -> f64 { ... }
fn wheel_delta_discrete(&self) -> f64 { ... }
fn x_has_changed(&self) -> bool { ... }
fn y_has_changed(&self) -> bool { ... }
fn x(&self) -> f64 { ... }
fn y(&self) -> f64 { ... }
fn x_transformed(&self, width: u32) -> f64 { ... }
fn y_transformed(&self, height: u32) -> f64 { ... }
fn tool(&self) -> TabletTool { ... }
fn into_tablet_tool_event(self) -> TabletToolEvent
where Self: Sized { ... }
}
Expand description
Common functions all TabletTool-Events implement.
Provided Methods§
Sourcefn distance_has_changed(&self) -> bool
fn distance_has_changed(&self) -> bool
Check if the distance axis was updated in this event.
For TabletToolProximityEvent
s this function always returns true
. For
TabletToolButtonEvent
s this function always returns false
.
Sourcefn distance(&self) -> f64
fn distance(&self) -> f64
Returns the current distance from the tablet’s sensor, normalized to the range [0, 1].
If this axis does not exist on the current tool, this function returns 0.
Sourcefn dx(&self) -> f64
fn dx(&self) -> f64
Return the delta between the last event and the current event.
If the tool employs pointer acceleration, the delta returned by this function is the accelerated delta.
This value is in screen coordinate space, the delta is to be interpreted like
the return value of PointerMotionEvent::dx
. See
Relative motion for tablet tools
for more details.
Sourcefn dy(&self) -> f64
fn dy(&self) -> f64
Return the delta between the last event and the current event.
If the tool employs pointer acceleration, the delta returned by this function is the accelerated delta.
This value is in screen coordinate space, the delta is to be interpreted like
the return value of PointerMotionEvent::dy
. See
Relative motion for tablet tools
for more details.
Sourcefn pressure_has_changed(&self) -> bool
fn pressure_has_changed(&self) -> bool
Check if the pressure axis was updated in this event. For TabletToolButtonEvent
s this function always returns false
.
Sourcefn pressure(&self) -> f64
fn pressure(&self) -> f64
Returns the current pressure being applied on the tool in use, normalized to the range [0, 1].
If this axis does not exist on the current tool, this function returns 0.
Sourcefn rotation_has_changed(&self) -> bool
fn rotation_has_changed(&self) -> bool
Check if the z-rotation axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn rotation(&self) -> f64
fn rotation(&self) -> f64
Returns the current z rotation of the tool in degrees, clockwise from the tool’s logical neutral position.
For tools of type TabletToolType::Mouse
and TabletToolType::Lens
the logical
neutral position is pointing to the current logical north of the tablet. For
tools of type TabletToolType::Brush
, the logical neutral position is with the
buttons pointing up.
If this axis does not exist on the current tool, this function returns 0.
Sourcefn slider_has_changed(&self) -> bool
fn slider_has_changed(&self) -> bool
Check if the slider axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn slider_position(&self) -> f64
fn slider_position(&self) -> f64
Returns the current position of the slider on the tool, normalized to the range [-1, 1].
The logical zero is the neutral position of the slider, or the logical center of the axis. This axis is available on e.g. the Wacom Airbrush.
If this axis does not exist on the current tool, this function returns 0.
Sourcefn tilt_x_has_changed(&self) -> bool
fn tilt_x_has_changed(&self) -> bool
Check if the tilt x axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn tilt_y_has_changed(&self) -> bool
fn tilt_y_has_changed(&self) -> bool
Check if the tilt y axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn tilt_x(&self) -> f64
fn tilt_x(&self) -> f64
Returns the current tilt along the X axis of the tablet’s current logical orientation, in degrees off the tablet’s z axis.
That is, if the tool is perfectly orthogonal to the tablet, the tilt angle is 0. When the top tilts towards the logical top/left of the tablet, the x/y tilt angles are negative, if the top tilts towards the logical bottom/right of the tablet, the x/y tilt angles are positive.
If this axis does not exist on the current tool, this function returns 0.
Sourcefn tilt_y(&self) -> f64
fn tilt_y(&self) -> f64
Returns the current tilt along the Y axis of the tablet’s current logical orientation, in degrees off the tablet’s z axis.
That is, if the tool is perfectly orthogonal to the tablet, the tilt angle is 0. When the top tilts towards the logical top/left of the tablet, the x/y tilt angles are negative, if the top tilts towards the logical bottom/right of the tablet, the x/y tilt angles are positive.
If this axis does not exist on the current tool, this function returns 0.
Sourcefn size_major_has_changed(&self) -> bool
fn size_major_has_changed(&self) -> bool
Check if the size major axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
Sourcefn size_minor_has_changed(&self) -> bool
fn size_minor_has_changed(&self) -> bool
Check if the size minor axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
Sourcefn size_major(&self) -> f64
fn size_major(&self) -> f64
Returns the current size in mm along the major axis of the touching ellipse. This axis is not necessarily aligned with either x or y, the rotation must be taken into account.
Where no rotation is available on a tool, or where rotation is zero, the major axis aligns with the y axis and the minor axis with the x axis.
If the axis does not exist on the current tool, this function returns 0.
Sourcefn size_minor(&self) -> f64
fn size_minor(&self) -> f64
Returns the current size in mm along the minor axis of the touching ellipse. This axis is not necessarily aligned with either x or y, the rotation must be taken into account.
Where no rotation is available on a tool, or where rotation is zero, the minor axis aligns with the y axis and the major axis with the x axis.
If the axis does not exist on the current tool, this function returns 0.
Sourcefn wheel_has_changed(&self) -> bool
fn wheel_has_changed(&self) -> bool
Check if the wheel axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn wheel_delta(&self) -> f64
fn wheel_delta(&self) -> f64
Return the delta for the wheel in degrees.
Sourcefn wheel_delta_discrete(&self) -> f64
fn wheel_delta_discrete(&self) -> f64
Return the delta for the wheel in discrete steps (e.g. wheel clicks).
Sourcefn x_has_changed(&self) -> bool
fn x_has_changed(&self) -> bool
Check if the x axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn y_has_changed(&self) -> bool
fn y_has_changed(&self) -> bool
Check if the y axis was updated in this event.
For TabletToolButtonEvent
s this function always returns false
.
Sourcefn x(&self) -> f64
fn x(&self) -> f64
Returns the X coordinate of the tablet tool, in mm from the top left corner of the tablet in its current logical orientation.
Use x_transformed
for transforming the axis value into a different coordinate
space.
§Note
On some devices, returned value may be negative or larger than the width of the device. See Out-of-bounds motion events for more details.
Sourcefn y(&self) -> f64
fn y(&self) -> f64
Returns the Y coordinate of the tablet tool, in mm from the top left corner of the tablet in its current logical orientation.
Use y_transformed
for transforming the axis value into a different coordinate
space.
§Note
On some devices, returned value may be negative or larger than the width of the device. See Out-of-bounds motion events for more details.
Sourcefn x_transformed(&self, width: u32) -> f64
fn x_transformed(&self, width: u32) -> f64
Return the current absolute x coordinate of the tablet tool event, transformed to screen coordinates.
§Note
This function may be called for a specific axis even if x_has_changed
returns
false
for that axis. libinput always includes all device axes in the event.
On some devices, returned value may be negative or larger than the width of the device. See Out-of-bounds motion events for more details.
Sourcefn y_transformed(&self, height: u32) -> f64
fn y_transformed(&self, height: u32) -> f64
Return the current absolute y coordinate of the tablet tool event, transformed to screen coordinates.
§Note
This function may be called for a specific axis even if y_has_changed
returns
false
for that axis. libinput always includes all device axes in the event.
On some devices, returned value may be negative or larger than the width of the device. See Out-of-bounds motion events for more details.
Sourcefn tool(&self) -> TabletTool
fn tool(&self) -> TabletTool
Returns the tool that was in use during this event.
§Note
Physical tool tracking requires hardware support. If unavailable, libinput creates one tool per type per tablet. See Tracking unique tools for more details.
Sourcefn into_tablet_tool_event(self) -> TabletToolEventwhere
Self: Sized,
fn into_tablet_tool_event(self) -> TabletToolEventwhere
Self: Sized,
Convert into a general TabletToolEvent
again