x11_dl/
xinput.rs

1// x11-rs: Rust bindings for X11 libraries
2// The X11 libraries are available under the MIT license.
3// These bindings are public domain.
4
5use std::os::raw::{c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong};
6
7use super::xlib::{Atom, Display, Time, XEvent, XModifierKeymap, XID};
8
9//
10// functions
11//
12
13x11_link! { XInput, xi, ["libXi.so.6", "libXi.so"], 44,
14  pub fn XAllowDeviceEvents (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_ulong) -> c_int,
15  pub fn XChangeDeviceControl (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: *mut XDeviceControl) -> c_int,
16  pub fn XChangeDeviceDontPropagateList (_5: *mut Display, _4: c_ulong, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int,
17  pub fn XChangeDeviceKeyMapping (_6: *mut Display, _5: *mut XDevice, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int,
18  pub fn XChangeDeviceProperty (_8: *mut Display, _7: *mut XDevice, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *const c_uchar, _1: c_int) -> (),
19  pub fn XChangeFeedbackControl (_4: *mut Display, _3: *mut XDevice, _2: c_ulong, _1: *mut XFeedbackControl) -> c_int,
20  pub fn XChangeKeyboardDevice (_2: *mut Display, _1: *mut XDevice) -> c_int,
21  pub fn XChangePointerDevice (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_int) -> c_int,
22  pub fn XCloseDevice (_2: *mut Display, _1: *mut XDevice) -> c_int,
23  pub fn XDeleteDeviceProperty (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> (),
24  pub fn XDeviceBell (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_ulong, _1: c_int) -> c_int,
25  pub fn XFreeDeviceControl (_1: *mut XDeviceControl) -> (),
26  pub fn XFreeDeviceList (_1: *mut XDeviceInfo) -> (),
27  pub fn XFreeDeviceMotionEvents (_1: *mut XDeviceTimeCoord) -> (),
28  pub fn XFreeDeviceState (_1: *mut XDeviceState) -> (),
29  pub fn XFreeFeedbackList (_1: *mut XFeedbackState) -> (),
30  pub fn XGetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_uint) -> c_int,
31  pub fn XGetDeviceControl (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> *mut XDeviceControl,
32  pub fn XGetDeviceDontPropagateList (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut c_ulong,
33  pub fn XGetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: *mut c_ulong, _2: *mut c_int, _1: *mut c_ulong) -> c_int,
34  pub fn XGetDeviceKeyMapping (_5: *mut Display, _4: *mut XDevice, _3: c_uchar, _2: c_int, _1: *mut c_int) -> *mut c_ulong,
35  pub fn XGetDeviceModifierMapping (_2: *mut Display, _1: *mut XDevice) -> *mut XModifierKeymap,
36  pub fn XGetDeviceMotionEvents (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_ulong, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> *mut XDeviceTimeCoord,
37  pub fn XGetDeviceProperty (_12: *mut Display, _11: *mut XDevice, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int,
38  pub fn XGetExtensionVersion (_2: *mut Display, _1: *const c_char) -> *mut XExtensionVersion,
39  pub fn XGetFeedbackControl (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut XFeedbackState,
40  pub fn XGetSelectedExtensionEvents (_6: *mut Display, _5: c_ulong, _4: *mut c_int, _3: *mut *mut c_ulong, _2: *mut c_int, _1: *mut *mut c_ulong) -> c_int,
41  pub fn XGrabDevice (_9: *mut Display, _8: *mut XDevice, _7: c_ulong, _6: c_int, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
42  pub fn XGrabDeviceButton (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int,
43  pub fn XGrabDeviceKey (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int,
44
45  pub fn XListDeviceProperties (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut c_ulong,
46  pub fn XListInputDevices (_2: *mut Display, _1: *mut c_int) -> *mut XDeviceInfo,
47  pub fn XOpenDevice (_2: *mut Display, _1: c_ulong) -> *mut XDevice,
48  pub fn XQueryDeviceState (_2: *mut Display, _1: *mut XDevice) -> *mut XDeviceState,
49  pub fn XSelectExtensionEvent (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int,
50  pub fn XSendExtensionEvent (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: *mut XEvent) -> c_int,
51  pub fn XSetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_int) -> c_int,
52  pub fn XSetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int,
53  pub fn XSetDeviceMode (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> c_int,
54  pub fn XSetDeviceModifierMapping (_3: *mut Display, _2: *mut XDevice, _1: *mut XModifierKeymap) -> c_int,
55  pub fn XSetDeviceValuators (_5: *mut Display, _4: *mut XDevice, _3: *mut c_int, _2: c_int, _1: c_int) -> c_int,
56  pub fn XUngrabDevice (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> c_int,
57  pub fn XUngrabDeviceButton (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int,
58  pub fn XUngrabDeviceKey (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int,
59variadic:
60globals:
61}
62
63//
64// types
65//
66
67pub enum _XAnyClassinfo {}
68
69pub type XAnyClassPtr = *mut _XAnyClassinfo;
70
71#[derive(Debug, Clone, Copy, PartialEq)]
72#[repr(C)]
73pub struct XDevice {
74    pub device_id: XID,
75    pub num_classes: c_int,
76    pub classes: *mut XInputClassInfo,
77}
78
79#[derive(Debug, Clone, Copy, PartialEq)]
80#[repr(C)]
81pub struct XDeviceControl {
82    pub control: XID,
83    pub length: c_int,
84}
85
86#[derive(Debug, Clone, Copy, PartialEq)]
87#[repr(C)]
88pub struct XDeviceInfo {
89    pub id: XID,
90    pub type_: Atom,
91    pub name: *mut c_char,
92    pub num_classes: c_int,
93    pub use_: c_int,
94    pub inputclassinfo: XAnyClassPtr,
95}
96
97#[derive(Debug, Clone, Copy, PartialEq)]
98#[repr(C)]
99pub struct XDeviceState {
100    pub device_id: XID,
101    pub num_classes: c_int,
102    pub data: *mut XInputClass,
103}
104
105#[derive(Debug, Clone, Copy, PartialEq)]
106#[repr(C)]
107pub struct XDeviceTimeCoord {
108    pub time: Time,
109    pub data: *mut c_int,
110}
111
112#[derive(Debug, Clone, Copy, PartialEq)]
113#[repr(C)]
114pub struct XExtensionVersion {
115    pub present: c_int,
116    pub major_version: c_short,
117    pub minor_version: c_short,
118}
119
120#[derive(Debug, Clone, Copy, PartialEq)]
121#[repr(C)]
122pub struct XFeedbackControl {
123    pub class: XID,
124    pub length: c_int,
125    pub id: XID,
126}
127
128#[derive(Debug, Clone, Copy, PartialEq)]
129#[repr(C)]
130pub struct XFeedbackState {
131    pub class: XID,
132    pub length: c_int,
133    pub id: XID,
134}
135
136#[derive(Debug, Clone, Copy, PartialEq)]
137#[repr(C)]
138pub struct XInputClass {
139    pub class: c_uchar,
140    pub length: c_uchar,
141}
142
143#[derive(Debug, Clone, Copy, PartialEq)]
144#[repr(C)]
145pub struct XInputClassInfo {
146    pub input_class: c_uchar,
147    pub event_type_base: c_uchar,
148}