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