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