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