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_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort };
6 
7 use xlib::{ Atom, Bool, Display, Drawable, Status, Time, XEvent, XID, Window };
8 use xrender::{ XFixed, XTransform };
9 
10 
11 //
12 // functions
13 //
14 
15 
16 x11_link! { Xrandr, xrandr, ["libXrandr.so.2", "libXrandr.so"], 70,
17     pub fn XRRAddOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (),
18     pub fn XRRAllocGamma (size: c_int) -> *mut XRRCrtcGamma,
19     pub fn XRRAllocModeInfo (name: *const c_char, nameLength: c_int) -> *mut XRRModeInfo,
20     pub fn XRRAllocateMonitor (dpy: *mut Display, noutput: c_int) -> *mut XRRMonitorInfo,
21     pub fn XRRChangeOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (),
22     pub fn XRRChangeProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (),
23     pub fn XRRConfigCurrentConfiguration (config: *mut XRRScreenConfiguration, rotation: *mut Rotation) -> SizeID,
24     pub fn XRRConfigCurrentRate (config: *mut XRRScreenConfiguration) -> c_short,
25     pub fn XRRConfigRates (config: *mut XRRScreenConfiguration, sizeID: c_int, nrates: *mut c_int) -> *mut c_short,
26     pub fn XRRConfigRotations (config: *mut XRRScreenConfiguration, current_rotation: *mut Rotation) -> Rotation,
27     pub fn XRRConfigSizes (config: *mut XRRScreenConfiguration, nsizes: *mut c_int) -> *mut XRRScreenSize,
28     pub fn XRRConfigTimes (config: *mut XRRScreenConfiguration, config_timestamp: *mut Time) -> Time,
29     pub fn XRRConfigureOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (),
30     pub fn XRRConfigureProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (),
31     pub fn XRRCreateMode (dpy: *mut Display, window: Window, modeInfo: *mut XRRModeInfo) -> RRMode,
32     pub fn XRRDeleteMonitor (dpy: *mut Display, window: Window, name: Atom) -> (),
33     pub fn XRRDeleteOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (),
34     pub fn XRRDeleteOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> (),
35     pub fn XRRDeleteProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> (),
36     pub fn XRRDestroyMode (dpy: *mut Display, mode: RRMode) -> (),
37     pub fn XRRFreeCrtcInfo (crtcInfo: *mut XRRCrtcInfo) -> (),
38     pub fn XRRFreeGamma (gamma: *mut XRRCrtcGamma) -> (),
39     pub fn XRRFreeModeInfo (modeInfo: *mut XRRModeInfo) -> (),
40     pub fn XRRFreeMonitors (monitors: *mut XRRMonitorInfo) -> (),
41     pub fn XRRFreeOutputInfo (outputInfo: *mut XRROutputInfo) -> (),
42     pub fn XRRFreePanning (panning: *mut XRRPanning) -> (),
43     pub fn XRRFreeProviderInfo (provider: *mut XRRProviderInfo) -> (),
44     pub fn XRRFreeProviderResources (resources: *mut XRRProviderResources) -> (),
45     pub fn XRRFreeScreenConfigInfo (config: *mut XRRScreenConfiguration) -> (),
46     pub fn XRRFreeScreenResources (resources: *mut XRRScreenResources) -> (),
47     pub fn XRRGetCrtcGamma (dpy: *mut Display, crtc: RRCrtc) -> *mut XRRCrtcGamma,
48     pub fn XRRGetCrtcGammaSize (dpy: *mut Display, crtc: RRCrtc) -> c_int,
49     pub fn XRRGetCrtcInfo (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRCrtcInfo,
50     pub fn XRRGetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, attributes: *mut *mut XRRCrtcTransformAttributes) -> Status,
51     pub fn XRRGetMonitors (dpy: *mut Display, window: Window, get_active: Bool, nmonitors: *mut c_int) -> *mut XRRMonitorInfo,
52     pub fn XRRGetOutputInfo (dpy: *mut Display, resources: *mut XRRScreenResources, output: RROutput) -> *mut XRROutputInfo,
53     pub fn XRRGetOutputPrimary (dpy: *mut Display, window: Window) -> RROutput,
54     pub fn XRRGetOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int,
55     pub fn XRRGetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRPanning,
56     pub fn XRRGetProviderInfo (dpy: *mut Display, resources: *mut XRRScreenResources, provider: RRProvider) -> *mut XRRProviderInfo,
57     pub fn XRRGetProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int,
58     pub fn XRRGetProviderResources (dpy: *mut Display, window: Window) -> *mut XRRProviderResources,
59     pub fn XRRGetScreenInfo (dpy: *mut Display, window: Window) -> *mut XRRScreenConfiguration,
60     pub fn XRRGetScreenResources (dpy: *mut Display, window: Window) -> *mut XRRScreenResources,
61     pub fn XRRGetScreenResourcesCurrent (dpy: *mut Display, window: Window) -> *mut XRRScreenResources,
62     pub fn XRRGetScreenSizeRange (dpy: *mut Display, window: Window, minWidth: *mut c_int, minHeight: *mut c_int, maxWidth: *mut c_int, maxHeight: *mut c_int) -> Status,
63     pub fn XRRListOutputProperties (dpy: *mut Display, output: RROutput, nprop: *mut c_int) -> *mut Atom,
64     pub fn XRRListProviderProperties (dpy: *mut Display, provider: RRProvider, nprop: *mut c_int) -> *mut Atom,
65     pub fn XRRQueryExtension (dpy: *mut Display, event_base_return: *mut c_int, error_base_return: *mut c_int) -> Bool,
66     pub fn XRRQueryOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> *mut XRRPropertyInfo,
67     pub fn XRRQueryProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> *mut XRRPropertyInfo,
68     pub fn XRRQueryVersion (dpy: *mut Display, major_version_return: *mut c_int, minor_version_return: *mut c_int) -> Status,
69     pub fn XRRRates (dpy: *mut Display, screen: c_int, sizeID: c_int, nrates: *mut c_int) -> *mut c_short,
70     pub fn XRRRootToScreen (dpy: *mut Display, root: Window) -> c_int,
71     pub fn XRRRotations (dpy: *mut Display, screen: c_int, current_rotation: *mut Rotation) -> Rotation,
72     pub fn XRRSelectInput (dpy: *mut Display, window: Window, mask: c_int) -> (),
73     pub fn XRRSetCrtcConfig (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, timestamp: Time, x: c_int, y: c_int, mode: RRMode, rotation: Rotation, outputs: *mut RROutput, noutputs: c_int) -> Status,
74     pub fn XRRSetCrtcGamma (dpy: *mut Display, crtc: RRCrtc, gamma: *mut XRRCrtcGamma) -> (),
75     pub fn XRRSetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, transform: *mut XTransform, filter: *const c_char, params: *mut XFixed, nparams: c_int) -> (),
76     pub fn XRRSetMonitor (dpy: *mut Display, window: Window, monitor: *mut XRRMonitorInfo) -> (),
77     pub fn XRRSetOutputPrimary (dpy: *mut Display, window: Window, output: RROutput) -> (),
78     pub fn XRRSetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, panning: *mut XRRPanning) -> Status,
79     pub fn XRRSetProviderOffloadSink (dpy: *mut Display, provider: XID, sink_provider: XID) -> c_int,
80     pub fn XRRSetProviderOutputSource (dpy: *mut Display, provider: XID, source_provider: XID) -> c_int,
81     pub fn XRRSetScreenConfig (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, timestamp: Time) -> Status,
82     pub fn XRRSetScreenConfigAndRate (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, rate: c_short, timestamp: Time) -> Status,
83     pub fn XRRSetScreenSize (dpy: *mut Display, window: Window, width: c_int, height: c_int, mmWidth: c_int, mmHeight: c_int) -> (),
84     pub fn XRRSizes (dpy: *mut Display, screen: c_int, nsizes: *mut c_int) -> *mut XRRScreenSize,
85     pub fn XRRTimes (dpy: *mut Display, screen: c_int, config_timestamp: *mut Time) -> Time,
86     pub fn XRRUpdateConfiguration (event: *mut XEvent) -> c_int,
87 variadic:
88 globals:
89 }
90 
91 
92 //
93 // types
94 //
95 
96 
97 pub type Connection = c_ushort;
98 pub type Rotation = c_ushort;
99 pub type SizeID = c_ushort;
100 pub type SubpixelOrder = c_ushort;
101 
102 pub type RROutput = XID;
103 pub type RRCrtc = XID;
104 pub type RRMode = XID;
105 pub type RRProvider = XID;
106 
107 #[derive(Debug, Clone, Copy, PartialEq)]
108 #[repr(C)]
109 pub struct XRRScreenSize {
110     pub width: c_int,
111     pub height: c_int,
112     pub mwidth: c_int,
113     pub mheight: c_int,
114 }
115 
116 #[repr(C)] pub struct XRRScreenConfiguration;
117 
118 pub type XRRModeFlags = c_ulong;
119 
120 #[derive(Debug, Clone, Copy, PartialEq)]
121 #[repr(C)]
122 pub struct XRRModeInfo {
123     pub id: RRMode,
124     pub width: c_uint,
125     pub height: c_uint,
126     pub dotClock: c_ulong,
127     pub hSyncStart: c_uint,
128     pub hSyncEnd: c_uint,
129     pub hTotal: c_uint,
130     pub hSkew: c_uint,
131     pub vSyncStart: c_uint,
132     pub vSyncEnd: c_uint,
133     pub vTotal: c_uint,
134     pub name: *mut c_char,
135     pub nameLength: c_uint,
136     pub modeFlags: XRRModeFlags,
137 }
138 
139 #[derive(Debug, Clone, Copy, PartialEq)]
140 #[repr(C)]
141 pub struct XRRScreenResources {
142     pub timestamp: Time,
143     pub configTimestamp: Time,
144     pub ncrtc: c_int,
145     pub crtcs: *mut RRCrtc,
146     pub noutput: c_int,
147     pub outputs: *mut RROutput,
148     pub nmode: c_int,
149     pub modes: *mut XRRModeInfo,
150 }
151 
152 #[derive(Debug, Clone, Copy, PartialEq)]
153 #[repr(C)]
154 pub struct XRROutputInfo {
155     pub timestamp: Time,
156     pub crtc: RRCrtc,
157     pub name: *mut c_char,
158     pub nameLen: c_int,
159     pub mm_width: c_ulong,
160     pub mm_height: c_ulong,
161     pub connection: Connection,
162     pub subpixel_order: SubpixelOrder,
163     pub ncrtc: c_int,
164     pub crtcs: *mut RRCrtc,
165     pub nclone: c_int,
166     pub clones: *mut RROutput,
167     pub nmode: c_int,
168     pub npreferred: c_int,
169     pub modes: *mut RRMode,
170 }
171 
172 #[derive(Debug, Clone, Copy, PartialEq)]
173 #[repr(C)]
174 pub struct XRRPropertyInfo {
175     pub pending: Bool,
176     pub range: Bool,
177     pub immutable: Bool,
178     pub num_values: c_int,
179     pub values: *mut c_long,
180 }
181 
182 #[derive(Debug, Clone, Copy, PartialEq)]
183 #[repr(C)]
184 pub struct XRRCrtcInfo {
185     pub timestamp: Time,
186     pub x: c_int,
187     pub y: c_int,
188     pub width: c_uint,
189     pub height: c_uint,
190     pub mode: RRMode,
191     pub rotation: Rotation,
192     pub noutput: c_int,
193     pub outputs: *mut RROutput,
194     pub rotations: Rotation,
195     pub npossible: c_int,
196     pub possible: *mut RROutput,
197 }
198 
199 #[derive(Debug, Clone, Copy, PartialEq)]
200 #[repr(C)]
201 pub struct XRRCrtcGamma {
202     pub size: c_int,
203     pub red: *mut c_ushort,
204     pub green: *mut c_ushort,
205     pub blue: *mut c_ushort,
206 }
207 
208 #[derive(Debug, Clone, Copy, PartialEq)]
209 #[repr(C)]
210 pub struct XRRCrtcTransformAttributes {
211     pub pendingTransform: XTransform,
212     pub pendingFilter: *mut c_char,
213     pub pendingNparams: c_int,
214     pub pendingParams: *mut XFixed,
215     pub currentTransform: XTransform,
216     pub currentFilter: *mut c_char,
217     pub currentNparams: c_int,
218     pub currentParams: *mut XFixed,
219 }
220 
221 #[derive(Debug, Clone, Copy, PartialEq)]
222 #[repr(C)]
223 pub struct XRRPanning {
224     pub timestamp: Time,
225     pub left: c_uint,
226     pub top: c_uint,
227     pub width: c_uint,
228     pub height: c_uint,
229     pub track_left: c_uint,
230     pub track_top: c_uint,
231     pub track_width: c_uint,
232     pub track_height: c_uint,
233     pub border_left: c_int,
234     pub border_top: c_int,
235     pub border_right: c_int,
236     pub border_bottom: c_int,
237 }
238 
239 #[derive(Debug, Clone, Copy, PartialEq)]
240 #[repr(C)]
241 pub struct XRRProviderResources {
242     pub timestamp: Time,
243     pub nproviders: c_int,
244     pub providers: *mut RRProvider,
245 }
246 
247 #[derive(Debug, Clone, Copy, PartialEq)]
248 #[repr(C)]
249 pub struct XRRProviderInfo {
250     pub capabilities: c_uint,
251     pub ncrtcs: c_int,
252     pub crtcs: *mut RRCrtc,
253     pub noutputs: c_int,
254     pub outputs: *mut RROutput,
255     pub name: *mut c_char,
256     pub nassociatedproviders: c_int,
257     pub associated_providers: *mut RRProvider,
258     pub associated_capability: *mut c_uint,
259     pub nameLen: c_int,
260 }
261 
262 #[derive(Debug, Clone, Copy, PartialEq)]
263 #[repr(C)]
264 pub struct XRRMonitorInfo {
265     pub name: Atom,
266     pub primary: Bool,
267     pub automatic: Bool,
268     pub noutput: c_int,
269     pub x: c_int,
270     pub y: c_int,
271     pub width: c_int,
272     pub height: c_int,
273     pub mwidth: c_int,
274     pub mheight: c_int,
275     pub outputs: *mut RROutput,
276 }
277 
278 
279 //
280 // event structures
281 //
282 
283 
284 #[derive(Debug, Clone, Copy, PartialEq)]
285 #[repr(C)]
286 pub struct XRRScreenChangeNotifyEvent {
287     pub type_: c_int,
288     pub serial: c_ulong,
289     pub send_event: Bool,
290     pub display: *mut Display,
291     pub window: Window,
292     pub root: Window,
293     pub timestamp: Time,
294     pub config_timestamp: Time,
295     pub size_index: SizeID,
296     pub subpixel_order: SubpixelOrder,
297     pub rotation: Rotation,
298     pub width: c_int,
299     pub height: c_int,
300     pub mwidth: c_int,
301     pub mheight: c_int,
302 }
303 
304 #[derive(Debug, Clone, Copy, PartialEq)]
305 #[repr(C)]
306 pub struct XRRNotifyEvent {
307     pub type_: c_int,
308     pub serial: c_ulong,
309     pub send_event: Bool,
310     pub display: *mut Display,
311     pub window: Window,
312     pub subtype: c_int,
313 }
314 
315 #[derive(Debug, Clone, Copy, PartialEq)]
316 #[repr(C)]
317 pub struct XRROutputChangeNotifyEvent {
318     pub type_: c_int,
319     pub serial: c_ulong,
320     pub send_event: Bool,
321     pub display: *mut Display,
322     pub window: Window,
323     pub subtype: c_int,
324     pub output: RROutput,
325     pub crtc: RRCrtc,
326     pub mode: RRMode,
327     pub rotation: Rotation,
328     pub connection: Connection,
329     pub subpixel_order: SubpixelOrder,
330 }
331 
332 #[derive(Debug, Clone, Copy, PartialEq)]
333 #[repr(C)]
334 pub struct XRRCrtcChangeNotifyEvent {
335     pub type_: c_int,
336     pub serial: c_ulong,
337     pub send_event: Bool,
338     pub display: *mut Display,
339     pub window: Window,
340     pub subtype: c_int,
341     pub crtc: RRCrtc,
342     pub mode: RRMode,
343     pub rotation: Rotation,
344     pub x: c_int,
345     pub y: c_int,
346     pub width: c_uint,
347     pub height: c_uint,
348 }
349 
350 #[derive(Debug, Clone, Copy, PartialEq)]
351 #[repr(C)]
352 pub struct XRROutputPropertyNotifyEvent {
353     pub type_: c_int,
354     pub serial: c_ulong,
355     pub send_event: Bool,
356     pub display: *mut Display,
357     pub window: Window,
358     pub subtype: c_int,
359     pub output: RROutput,
360     pub property: Atom,
361     pub timestamp: Time,
362     pub state: c_int,
363 }
364 
365 #[derive(Debug, Clone, Copy, PartialEq)]
366 #[repr(C)]
367 pub struct XRRProviderChangeNotifyEvent {
368     pub type_: c_int,
369     pub serial: c_ulong,
370     pub send_event: Bool,
371     pub display: *mut Display,
372     pub window: Window,
373     pub subtype: c_int,
374     pub provider: RRProvider,
375     pub timestamp: Time,
376     pub current_role: c_uint,
377 }
378 
379 #[derive(Debug, Clone, Copy, PartialEq)]
380 #[repr(C)]
381 pub struct XRRProviderPropertyNotifyEvent {
382     pub type_: c_int,
383     pub serial: c_ulong,
384     pub send_event: Bool,
385     pub display: *mut Display,
386     pub window: Window,
387     pub subtype: c_int,
388     pub provider: RRProvider,
389     pub property: Atom,
390     pub timestamp: Time,
391     pub state: c_int,
392 }
393 
394 #[derive(Debug, Clone, Copy, PartialEq)]
395 #[repr(C)]
396 pub struct XRRResourceChangeNotifyEvent {
397     pub type_: c_int,
398     pub serial: c_ulong,
399     pub send_event: Bool,
400     pub display: *mut Display,
401     pub window: Window,
402     pub subtype: c_int,
403     pub timestamp: Time,
404 }
405 
406 event_conversions_and_tests! {
407   xrr_screen_change_notify: XRRScreenChangeNotifyEvent,
408   xrr_notify: XRRNotifyEvent,
409   xrr_output_change_notify: XRROutputChangeNotifyEvent,
410   xrr_crtc_change_notify: XRRCrtcChangeNotifyEvent,
411   xrr_output_property_notify: XRROutputPropertyNotifyEvent,
412   xrr_provider_change_notify: XRRProviderChangeNotifyEvent,
413   xrr_provider_property_notify: XRRProviderPropertyNotifyEvent,
414   xrr_resource_change_notify: XRRResourceChangeNotifyEvent,
415 }
416 
417 
418 //
419 // constants
420 //
421 
422 
423 pub const RANDR_NAME: &'static str = "RANDR";
424 pub const RANDR_MAJOR: c_int = 1;
425 pub const RANDR_MINOR: c_int = 5;
426 
427 pub const RRNumberErrors: c_int = 4;
428 pub const RRNumberEvents: c_int = 2;
429 pub const RRNumberRequests: c_int = 45;
430 
431 pub const X_RRQueryVersion:               c_int = 0;
432 pub const X_RROldGetScreenInfo:           c_int = 1;
433 pub const X_RRSetScreenConfig:            c_int = 2;
434 pub const X_RROldScreenChangeSelectInput: c_int = 3;
435 pub const X_RRSelectInput:                c_int = 4;
436 pub const X_RRGetScreenInfo:              c_int = 5;
437 
438 pub const X_RRGetScreenSizeRange:      c_int = 6;
439 pub const X_RRSetScreenSize:           c_int = 7;
440 pub const X_RRGetScreenResources:      c_int = 8;
441 pub const X_RRGetOutputInfo:           c_int = 9;
442 pub const X_RRListOutputProperties:    c_int = 10;
443 pub const X_RRQueryOutputProperty:     c_int = 11;
444 pub const X_RRConfigureOutputProperty: c_int = 12;
445 pub const X_RRChangeOutputProperty:    c_int = 13;
446 pub const X_RRDeleteOutputProperty:    c_int = 14;
447 pub const X_RRGetOutputProperty:       c_int = 15;
448 pub const X_RRCreateMode:              c_int = 16;
449 pub const X_RRDestroyMode:             c_int = 17;
450 pub const X_RRAddOutputMode:           c_int = 18;
451 pub const X_RRDeleteOutputMode:        c_int = 19;
452 pub const X_RRGetCrtcInfo:             c_int = 20;
453 pub const X_RRSetCrtcConfig:           c_int = 21;
454 pub const X_RRGetCrtcGammaSize:        c_int = 22;
455 pub const X_RRGetCrtcGamma:            c_int = 23;
456 pub const X_RRSetCrtcGamma:            c_int = 24;
457 
458 pub const X_RRGetScreenResourcesCurrent: c_int = 25;
459 pub const X_RRSetCrtcTransform:          c_int = 26;
460 pub const X_RRGetCrtcTransform:          c_int = 27;
461 pub const X_RRGetPanning:                c_int = 28;
462 pub const X_RRSetPanning:                c_int = 29;
463 pub const X_RRSetOutputPrimary:          c_int = 30;
464 pub const X_RRGetOutputPrimary:          c_int = 31;
465 
466 pub const X_RRGetProviders:              c_int = 32;
467 pub const X_RRGetProviderInfo:           c_int = 33;
468 pub const X_RRSetProviderOffloadSink:    c_int = 34;
469 pub const X_RRSetProviderOutputSource:   c_int = 35;
470 pub const X_RRListProviderProperties:    c_int = 36;
471 pub const X_RRQueryProviderProperty:     c_int = 37;
472 pub const X_RRConfigureProviderProperty: c_int = 38;
473 pub const X_RRChangeProviderProperty:    c_int = 39;
474 pub const X_RRDeleteProviderProperty:    c_int = 40;
475 pub const X_RRGetProviderProperty:       c_int = 41;
476 
477 pub const X_RRGetMonitors:   c_int = 42;
478 pub const X_RRSetMonitor:    c_int = 43;
479 pub const X_RRDeleteMonitor: c_int = 44;
480 
481 pub const RRTransformUnit:       c_int = 1 << 0;
482 pub const RRTransformScaleUp:    c_int = 1 << 1;
483 pub const RRTransformScaleDown:  c_int = 1 << 2;
484 pub const RRTransformProjective: c_int = 1 << 3;
485 
486 pub const RRScreenChangeNotifyMask:     c_int = 1 << 0;
487 pub const RRCrtcChangeNotifyMask:       c_int = 1 << 1;
488 pub const RROutputChangeNotifyMask:     c_int = 1 << 2;
489 pub const RROutputPropertyNotifyMask:   c_int = 1 << 3;
490 pub const RRProviderChangeNotifyMask:   c_int = 1 << 4;
491 pub const RRProviderPropertyNotifyMask: c_int = 1 << 5;
492 pub const RRResourceChangeNotifyMask:   c_int = 1 << 6;
493 
494 pub const RRScreenChangeNotify:      c_int = 0;
495 pub const RRNotify:                  c_int = 1;
496 pub const RRNotify_CrtcChange:       c_int = 0;
497 pub const RRNotify_OutputChange:     c_int = 1;
498 pub const RRNotify_OutputProperty:   c_int = 2;
499 pub const RRNotify_ProviderChange:   c_int = 3;
500 pub const RRNotify_ProviderProperty: c_int = 4;
501 pub const RRNotify_ResourceChange:   c_int = 5;
502 
503 pub const RR_Rotate_0:   c_int = 1;
504 pub const RR_Rotate_90:  c_int = 2;
505 pub const RR_Rotate_180: c_int = 4;
506 pub const RR_Rotate_270: c_int = 8;
507 
508 pub const RR_Reflect_X: c_int = 16;
509 pub const RR_Reflect_Y: c_int = 32;
510 
511 pub const RRSetConfigSuccess:           c_int = 0;
512 pub const RRSetConfigInvalidConfigTime: c_int = 1;
513 pub const RRSetConfigInvalidTime:       c_int = 2;
514 pub const RRSetConfigFailed:            c_int = 3;
515 
516 pub const RR_HSyncPositive:  c_int = 0x00000001;
517 pub const RR_HSyncNegative:  c_int = 0x00000002;
518 pub const RR_VSyncPositive:  c_int = 0x00000004;
519 pub const RR_VSyncNegative:  c_int = 0x00000008;
520 pub const RR_Interlace:      c_int = 0x00000010;
521 pub const RR_DoubleScan:     c_int = 0x00000020;
522 pub const RR_CSync:          c_int = 0x00000040;
523 pub const RR_CSyncPositive:  c_int = 0x00000080;
524 pub const RR_CSyncNegative:  c_int = 0x00000100;
525 pub const RR_HSkewPresent:   c_int = 0x00000200;
526 pub const RR_BCast:          c_int = 0x00000400;
527 pub const RR_PixelMultiplex: c_int = 0x00000800;
528 pub const RR_DoubleClock:    c_int = 0x00001000;
529 pub const RR_ClockDivideBy2: c_int = 0x00002000;
530 
531 pub const RR_Connected:         c_int = 0;
532 pub const RR_Disconnected:      c_int = 1;
533 pub const RR_UnknownConnection: c_int = 2;
534 
535 pub const BadRROutput:   c_int = 0;
536 pub const BadRRCrtc:     c_int = 1;
537 pub const BadRRMode:     c_int = 2;
538 pub const BadRRProvider: c_int = 3;
539 
540 pub const RR_PROPERTY_BACKLIGHT:          &'static str = "Backlight";
541 pub const RR_PROPERTY_RANDR_EDID:         &'static str = "EDID";
542 pub const RR_PROPERTY_SIGNAL_FORMAT:      &'static str = "SignalFormat";
543 pub const RR_PROPERTY_SIGNAL_PROPERTIES:  &'static str = "SignalProperties";
544 pub const RR_PROPERTY_CONNECTOR_TYPE:     &'static str = "ConnectorType";
545 pub const RR_PROPERTY_CONNECTOR_NUMBER:   &'static str = "ConnectorNumber";
546 pub const RR_PROPERTY_COMPATIBILITY_LIST: &'static str = "CompatibilityList";
547 pub const RR_PROPERTY_CLONE_LIST:         &'static str = "CloneList";
548 pub const RR_PROPERTY_BORDER:             &'static str = "Border";
549 pub const RR_PROPERTY_BORDER_DIMENSIONS:  &'static str = "BorderDimensions";
550 pub const RR_PROPERTY_GUID:               &'static str = "GUID";
551 pub const RR_PROPERTY_RANDR_TILE:         &'static str = "TILE";
552 
553 pub const RR_Capability_None:          c_int = 0;
554 pub const RR_Capability_SourceOutput:  c_int = 1;
555 pub const RR_Capability_SinkOutput:    c_int = 2;
556 pub const RR_Capability_SourceOffload: c_int = 4;
557 pub const RR_Capability_SinkOffload:   c_int = 8;
558 
559