Skip to main content

gdk/
event_proximity.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::ffi;
4use glib::translate::*;
5
6/// Proximity events are generated when using GDK’s wrapper for the
7/// XInput extension. The XInput extension is an add-on for standard X
8/// that allows you to use nonstandard devices such as graphics tablets.
9/// A proximity event indicates that the stylus has moved in or out of
10/// contact with the tablet, or perhaps that the user’s finger has moved
11/// in or out of contact with a touch screen.
12///
13/// This event type will be used pretty rarely. It only is important for
14/// XInput aware programs that are drawing their own cursor.
15#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16pub struct EventProximity(crate::Event);
17
18event_wrapper!(EventProximity, GdkEventProximity);
19event_subtype!(
20    EventProximity,
21    ffi::GDK_PROXIMITY_IN | ffi::GDK_PROXIMITY_OUT
22);
23
24impl EventProximity {
25    #[doc(alias = "get_time")]
26    pub fn time(&self) -> u32 {
27        self.as_ref().time
28    }
29
30    #[doc(alias = "get_device")]
31    pub fn device(&self) -> Option<crate::Device> {
32        unsafe { from_glib_none(self.as_ref().device) }
33    }
34}