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