1use glib::translate::*;
4
5#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct EventCrossing(crate::Event);
8
9event_wrapper!(EventCrossing, GdkEventCrossing);
10event_subtype!(EventCrossing, ffi::GDK_ENTER_NOTIFY | ffi::GDK_LEAVE_NOTIFY);
11
12impl EventCrossing {
13 #[doc(alias = "get_position")]
14 pub fn position(&self) -> (f64, f64) {
15 let x = self.as_ref().x;
16 let y = self.as_ref().y;
17 (x, y)
18 }
19
20 #[doc(alias = "get_subwindow")]
21 pub fn subwindow(&self) -> Option<crate::Window> {
22 unsafe { from_glib_none(self.as_ref().subwindow) }
23 }
24
25 #[doc(alias = "get_mode")]
26 pub fn mode(&self) -> crate::CrossingMode {
27 unsafe { from_glib(self.as_ref().mode) }
28 }
29
30 #[doc(alias = "get_detail")]
31 pub fn detail(&self) -> crate::NotifyType {
32 unsafe { from_glib(self.as_ref().detail) }
33 }
34
35 #[doc(alias = "get_state")]
36 pub fn state(&self) -> crate::ModifierType {
37 unsafe { from_glib(self.as_ref().state) }
38 }
39
40 #[doc(alias = "get_time")]
41 pub fn time(&self) -> u32 {
42 self.as_ref().time
43 }
44
45 #[doc(alias = "get_root")]
46 pub fn root(&self) -> (f64, f64) {
47 let x_root = self.as_ref().x_root;
48 let y_root = self.as_ref().y_root;
49 (x_root, y_root)
50 }
51
52 #[doc(alias = "get_focus")]
53 pub fn gets_focus(&self) -> bool {
54 unsafe { from_glib(self.as_ref().focus) }
55 }
56}