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