gtk4/gesture_stylus.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use gdk::AxisUse;
4use glib::translate::*;
5
6use crate::{ffi, GestureStylus};
7
8impl GestureStylus {
9 #[doc(alias = "gtk_gesture_stylus_get_axes")]
10 #[doc(alias = "get_axes")]
11 pub fn axes(&self, axes: Vec<AxisUse>) -> Option<Vec<f64>> {
12 let mut values = std::ptr::null_mut();
13 unsafe {
14 let mut axes1: Vec<gdk::ffi::GdkAxisUse> = axes.iter().map(|a| a.into_glib()).collect();
15 axes1.push(gdk::ffi::GDK_AXIS_IGNORE);
16 if from_glib(ffi::gtk_gesture_stylus_get_axes(
17 self.to_glib_none().0,
18 axes1.as_mut_ptr(),
19 &mut values,
20 )) {
21 Some(FromGlibContainer::from_glib_container_num(
22 values,
23 axes.len(),
24 ))
25 } else {
26 None
27 }
28 }
29 }
30}