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