clutter/auto/
event_button.rs

1use glib::translate::*;
2
3#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
4pub struct ButtonEvent(crate::Event);
5
6event_wrapper!(ButtonEvent, ClutterButtonEvent);
7event_subtype!(
8    ButtonEvent,
9    ffi::CLUTTER_BUTTON_PRESS
10        // | ffi::GDK_DOUBLE_BUTTON_PRESS
11        // | ffi::GDK_TRIPLE_BUTTON_PRESS
12        | ffi::CLUTTER_BUTTON_RELEASE
13);
14
15impl ButtonEvent {
16    //     pub fn get_position(&self) -> (f64, f64) {
17    //         let x = self.as_ref().x;
18    //         let y = self.as_ref().y;
19    //         (x, y)
20    //     }
21
22    //     pub fn get_state(&self) -> ::ModifierType {
23    //         from_glib(self.as_ref().state)
24    //     }
25
26    //     pub fn get_time(&self) -> u32 {
27    //         self.as_ref().time
28    //     }
29
30    //     pub fn get_button(&self) -> u32 {
31    //         self.as_ref().button
32    //     }
33
34    //     pub fn get_device(&self) -> Option<::Device> {
35    //         unsafe { from_glib_none(self.as_ref().device) }
36    //     }
37
38    //     pub fn get_axes(&self) -> Option<(f64, f64)> {
39    //         let axes = self.as_ref().axes;
40
41    //         if axes.is_null() {
42    //             None
43    //         } else {
44    //             unsafe { Some((*axes, *axes.offset(1))) }
45    //         }
46    //     }
47
48    //     pub fn get_root(&self) -> (f64, f64) {
49    //         let x_root = self.as_ref().x_root;
50    //         let y_root = self.as_ref().y_root;
51    //         (x_root, y_root)
52    //     }
53}