gdk/
event_touchpad_swipe.rs1use glib::translate::*;
4
5#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct EventTouchpadSwipe(crate::Event);
8
9event_wrapper!(EventTouchpadSwipe, GdkEventTouchpadSwipe);
10event_subtype!(EventTouchpadSwipe, ffi::GDK_TOUCHPAD_SWIPE);
11
12impl EventTouchpadSwipe {
13 pub fn is_phase(&self) -> bool {
14 unsafe { from_glib(self.as_ref().phase as _) }
15 }
16
17 #[doc(alias = "get_n_fingers")]
18 pub fn n_fingers(&self) -> i8 {
19 self.as_ref().n_fingers
20 }
21
22 #[doc(alias = "get_time")]
23 pub fn time(&self) -> u32 {
24 self.as_ref().time
25 }
26
27 #[doc(alias = "get_position")]
28 pub fn position(&self) -> (f64, f64) {
29 let x = self.as_ref().x;
30 let y = self.as_ref().y;
31 (x, y)
32 }
33
34 #[doc(alias = "get_delta")]
35 pub fn delta(&self) -> (f64, f64) {
36 let dx = self.as_ref().dx;
37 let dy = self.as_ref().dy;
38 (dx, dy)
39 }
40
41 #[doc(alias = "get_root")]
42 pub fn root(&self) -> (f64, f64) {
43 let x_root = self.as_ref().x_root;
44 let y_root = self.as_ref().y_root;
45 (x_root, y_root)
46 }
47
48 #[doc(alias = "get_state")]
49 pub fn state(&self) -> crate::ModifierType {
50 unsafe { from_glib(self.as_ref().state) }
51 }
52}