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_float, 8 c_int, 9 c_uchar, 10 c_uint, 11 c_ulong, 12 c_ushort, 13 }; 14 15 use ::xlib::{ 16 Bool, 17 Display, 18 Time, 19 Window, 20 XEvent, 21 }; 22 23 24 // 25 // functions 26 // 27 28 29 x11_link! { Xf86vmode, xxf86vm, ["libXxf86vm.so.1", "libXxf86vm.so"], 22, 30 pub fn XF86VidModeAddModeLine (_4: *mut Display, _3: c_int, _2: *mut XF86VidModeModeInfo, _1: *mut XF86VidModeModeInfo) -> c_int, 31 pub fn XF86VidModeDeleteModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, 32 pub fn XF86VidModeGetAllModeLines (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut *mut *mut XF86VidModeModeInfo) -> c_int, 33 pub fn XF86VidModeGetDotClocks (_6: *mut Display, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut *mut c_int) -> c_int, 34 pub fn XF86VidModeGetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int, 35 pub fn XF86VidModeGetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int, 36 pub fn XF86VidModeGetGammaRampSize (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int, 37 pub fn XF86VidModeGetModeLine (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut XF86VidModeModeLine) -> c_int, 38 pub fn XF86VidModeGetMonitor (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeMonitor) -> c_int, 39 pub fn XF86VidModeGetPermissions (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int, 40 pub fn XF86VidModeGetViewPort (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, 41 pub fn XF86VidModeLockModeSwitch (_3: *mut Display, _2: c_int, _1: c_int) -> c_int, 42 pub fn XF86VidModeModModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeLine) -> c_int, 43 pub fn XF86VidModeQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, 44 pub fn XF86VidModeQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, 45 pub fn XF86VidModeSetClientVersion (_1: *mut Display) -> c_int, 46 pub fn XF86VidModeSetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int, 47 pub fn XF86VidModeSetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int, 48 pub fn XF86VidModeSetViewPort (_4: *mut Display, _3: c_int, _2: c_int, _1: c_int) -> c_int, 49 pub fn XF86VidModeSwitchMode (_3: *mut Display, _2: c_int, _1: c_int) -> c_int, 50 pub fn XF86VidModeSwitchToMode (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, 51 pub fn XF86VidModeValidateModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, 52 variadic: 53 globals: 54 } 55 56 57 // 58 // types 59 // 60 61 62 #[derive(Debug, Clone, Copy)] 63 #[repr(C)] 64 pub struct XF86VidModeGamma { 65 pub red: c_float, 66 pub green: c_float, 67 pub blue: c_float, 68 } 69 70 #[derive(Debug, Clone, Copy, PartialEq)] 71 #[repr(C)] 72 pub struct XF86VidModeModeInfo { 73 pub dotclock: c_uint, 74 pub hdisplay: c_ushort, 75 pub hsyncstart: c_ushort, 76 pub hsyncend: c_ushort, 77 pub htotal: c_ushort, 78 pub hskew: c_ushort, 79 pub vdisplay: c_ushort, 80 pub vsyncstart: c_ushort, 81 pub vsyncend: c_ushort, 82 pub vtotal: c_ushort, 83 pub flags: c_uint, 84 pub privsize: c_int, 85 pub private: *mut i32, 86 } 87 88 #[derive(Debug, Clone, Copy)] 89 #[repr(C)] 90 pub struct XF86VidModeModeLine { 91 pub hdisplay: c_ushort, 92 pub hsyncstart: c_ushort, 93 pub hsyncend: c_ushort, 94 pub htotal: c_ushort, 95 pub hskew: c_ushort, 96 pub vdisplay: c_ushort, 97 pub vsyncstart: c_ushort, 98 pub vsyncend: c_ushort, 99 pub vtotal: c_ushort, 100 pub flags: c_uint, 101 pub privsize: c_int, 102 pub private: *mut i32, 103 } 104 105 #[derive(Debug, Clone, Copy)] 106 #[repr(C)] 107 pub struct XF86VidModeMonitor { 108 pub vendor: *mut c_char, 109 pub model: *mut c_char, 110 pub EMPTY: c_float, 111 pub nhsync: c_uchar, 112 pub hsync: *mut XF86VidModeSyncRange, 113 pub nvsync: c_uchar, 114 pub vsync: *mut XF86VidModeSyncRange, 115 } 116 117 #[derive(Debug, Clone, Copy)] 118 #[repr(C)] 119 pub struct XF86VidModeSyncRange { 120 pub hi: c_float, 121 pub lo: c_float, 122 } 123 124 125 // 126 // event structures 127 // 128 129 130 #[derive(Debug, Clone, Copy)] 131 #[repr(C)] 132 pub struct XF86VidModeNotifyEvent { 133 pub type_: c_int, 134 pub serial: c_ulong, 135 pub send_event: Bool, 136 pub display: *mut Display, 137 pub root: Window, 138 pub state: c_int, 139 pub kind: c_int, 140 pub forced: bool, 141 pub time: Time, 142 } 143 144 event_conversions_and_tests! { 145 xf86vm_notify: XF86VidModeNotifyEvent, 146 } 147