libspnav_sys/
lib.rs

1/* automatically generated by rust-bindgen */
2
3pub const SPNAV_EVENT_ANY: _bindgen_ty_1 = 0;
4pub const SPNAV_EVENT_MOTION: _bindgen_ty_1 = 1;
5pub const SPNAV_EVENT_BUTTON: _bindgen_ty_1 = 2;
6pub type _bindgen_ty_1 = u32;
7#[repr(C)]
8#[derive(Debug, Copy, Clone)]
9pub struct spnav_event_motion {
10    pub type_: ::std::os::raw::c_int,
11    pub x: ::std::os::raw::c_int,
12    pub y: ::std::os::raw::c_int,
13    pub z: ::std::os::raw::c_int,
14    pub rx: ::std::os::raw::c_int,
15    pub ry: ::std::os::raw::c_int,
16    pub rz: ::std::os::raw::c_int,
17    pub period: ::std::os::raw::c_uint,
18    pub data: *mut ::std::os::raw::c_int,
19}
20#[test]
21fn bindgen_test_layout_spnav_event_motion() {
22    assert_eq!(
23        ::std::mem::size_of::<spnav_event_motion>(),
24        40usize,
25        concat!("Size of: ", stringify!(spnav_event_motion))
26    );
27    assert_eq!(
28        ::std::mem::align_of::<spnav_event_motion>(),
29        8usize,
30        concat!("Alignment of ", stringify!(spnav_event_motion))
31    );
32    assert_eq!(
33        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).type_ as *const _ as usize },
34        0usize,
35        concat!(
36            "Offset of field: ",
37            stringify!(spnav_event_motion),
38            "::",
39            stringify!(type_)
40        )
41    );
42    assert_eq!(
43        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).x as *const _ as usize },
44        4usize,
45        concat!(
46            "Offset of field: ",
47            stringify!(spnav_event_motion),
48            "::",
49            stringify!(x)
50        )
51    );
52    assert_eq!(
53        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).y as *const _ as usize },
54        8usize,
55        concat!(
56            "Offset of field: ",
57            stringify!(spnav_event_motion),
58            "::",
59            stringify!(y)
60        )
61    );
62    assert_eq!(
63        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).z as *const _ as usize },
64        12usize,
65        concat!(
66            "Offset of field: ",
67            stringify!(spnav_event_motion),
68            "::",
69            stringify!(z)
70        )
71    );
72    assert_eq!(
73        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).rx as *const _ as usize },
74        16usize,
75        concat!(
76            "Offset of field: ",
77            stringify!(spnav_event_motion),
78            "::",
79            stringify!(rx)
80        )
81    );
82    assert_eq!(
83        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).ry as *const _ as usize },
84        20usize,
85        concat!(
86            "Offset of field: ",
87            stringify!(spnav_event_motion),
88            "::",
89            stringify!(ry)
90        )
91    );
92    assert_eq!(
93        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).rz as *const _ as usize },
94        24usize,
95        concat!(
96            "Offset of field: ",
97            stringify!(spnav_event_motion),
98            "::",
99            stringify!(rz)
100        )
101    );
102    assert_eq!(
103        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).period as *const _ as usize },
104        28usize,
105        concat!(
106            "Offset of field: ",
107            stringify!(spnav_event_motion),
108            "::",
109            stringify!(period)
110        )
111    );
112    assert_eq!(
113        unsafe { &(*(::std::ptr::null::<spnav_event_motion>())).data as *const _ as usize },
114        32usize,
115        concat!(
116            "Offset of field: ",
117            stringify!(spnav_event_motion),
118            "::",
119            stringify!(data)
120        )
121    );
122}
123impl Default for spnav_event_motion {
124    fn default() -> Self {
125        unsafe { ::std::mem::zeroed() }
126    }
127}
128#[repr(C)]
129#[derive(Debug, Default, Copy, Clone)]
130pub struct spnav_event_button {
131    pub type_: ::std::os::raw::c_int,
132    pub press: ::std::os::raw::c_int,
133    pub bnum: ::std::os::raw::c_int,
134}
135#[test]
136fn bindgen_test_layout_spnav_event_button() {
137    assert_eq!(
138        ::std::mem::size_of::<spnav_event_button>(),
139        12usize,
140        concat!("Size of: ", stringify!(spnav_event_button))
141    );
142    assert_eq!(
143        ::std::mem::align_of::<spnav_event_button>(),
144        4usize,
145        concat!("Alignment of ", stringify!(spnav_event_button))
146    );
147    assert_eq!(
148        unsafe { &(*(::std::ptr::null::<spnav_event_button>())).type_ as *const _ as usize },
149        0usize,
150        concat!(
151            "Offset of field: ",
152            stringify!(spnav_event_button),
153            "::",
154            stringify!(type_)
155        )
156    );
157    assert_eq!(
158        unsafe { &(*(::std::ptr::null::<spnav_event_button>())).press as *const _ as usize },
159        4usize,
160        concat!(
161            "Offset of field: ",
162            stringify!(spnav_event_button),
163            "::",
164            stringify!(press)
165        )
166    );
167    assert_eq!(
168        unsafe { &(*(::std::ptr::null::<spnav_event_button>())).bnum as *const _ as usize },
169        8usize,
170        concat!(
171            "Offset of field: ",
172            stringify!(spnav_event_button),
173            "::",
174            stringify!(bnum)
175        )
176    );
177}
178#[repr(C)]
179#[derive(Copy, Clone)]
180pub union spnav_event {
181    pub type_: ::std::os::raw::c_int,
182    pub motion: spnav_event_motion,
183    pub button: spnav_event_button,
184    _bindgen_union_align: [u64; 5usize],
185}
186#[test]
187fn bindgen_test_layout_spnav_event() {
188    assert_eq!(
189        ::std::mem::size_of::<spnav_event>(),
190        40usize,
191        concat!("Size of: ", stringify!(spnav_event))
192    );
193    assert_eq!(
194        ::std::mem::align_of::<spnav_event>(),
195        8usize,
196        concat!("Alignment of ", stringify!(spnav_event))
197    );
198    assert_eq!(
199        unsafe { &(*(::std::ptr::null::<spnav_event>())).type_ as *const _ as usize },
200        0usize,
201        concat!(
202            "Offset of field: ",
203            stringify!(spnav_event),
204            "::",
205            stringify!(type_)
206        )
207    );
208    assert_eq!(
209        unsafe { &(*(::std::ptr::null::<spnav_event>())).motion as *const _ as usize },
210        0usize,
211        concat!(
212            "Offset of field: ",
213            stringify!(spnav_event),
214            "::",
215            stringify!(motion)
216        )
217    );
218    assert_eq!(
219        unsafe { &(*(::std::ptr::null::<spnav_event>())).button as *const _ as usize },
220        0usize,
221        concat!(
222            "Offset of field: ",
223            stringify!(spnav_event),
224            "::",
225            stringify!(button)
226        )
227    );
228}
229impl Default for spnav_event {
230    fn default() -> Self {
231        unsafe { ::std::mem::zeroed() }
232    }
233}
234extern "C" {
235    pub fn spnav_open() -> ::std::os::raw::c_int;
236}
237extern "C" {
238    pub fn spnav_close() -> ::std::os::raw::c_int;
239}
240extern "C" {
241    pub fn spnav_fd() -> ::std::os::raw::c_int;
242}
243extern "C" {
244    pub fn spnav_sensitivity(sens: f64) -> ::std::os::raw::c_int;
245}
246extern "C" {
247    pub fn spnav_wait_event(event: *mut spnav_event) -> ::std::os::raw::c_int;
248}
249extern "C" {
250    pub fn spnav_poll_event(event: *mut spnav_event) -> ::std::os::raw::c_int;
251}
252extern "C" {
253    pub fn spnav_remove_events(type_: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
254}