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_uchar,
9   c_uint,
10   c_ulong,
11   c_void,
12 };
13 use libc::FILE;
14 
15 use ::xlib::{
16   Display,
17   GC,
18   Screen,
19   XColor,
20   XComposeStatus,
21   XErrorEvent,
22   XEvent,
23   XKeyEvent,
24   XrmValue,
25   XSizeHints,
26   XStandardColormap,
27   XVisualInfo,
28 };
29 use ::xt::{
30   Widget,
31   XtAppContext,
32 };
33 
34 
35 //
36 // functions
37 //
38 
39 
40 x11_link! { Xmu, xmu, ["libXmu.so.6", "libXmu.so"], 132,
41   pub fn XmuAddCloseDisplayHook (_3: *mut Display, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> *mut c_char,
42   pub fn XmuAddInitializer (_2: Option<unsafe extern "C" fn (XtAppContext, *mut c_char)>, _1: *mut c_char) -> (),
43   pub fn XmuAllStandardColormaps (_1: *mut Display) -> c_int,
44   pub fn XmuAppendSegment (_2: *mut XmuSegment, _1: *mut XmuSegment) -> c_int,
45   pub fn XmuAreaAnd (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea,
46   pub fn XmuAreaCopy (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea,
47   pub fn XmuAreaDup (_1: *mut XmuArea) -> *mut XmuArea,
48   pub fn XmuAreaNot (_5: *mut XmuArea, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea,
49   pub fn XmuAreaOrXor (_3: *mut XmuArea, _2: *mut XmuArea, _1: c_int) -> *mut XmuArea,
50   pub fn XmuCallInitializers (_1: XtAppContext) -> (),
51   pub fn XmuClientWindow (_2: *mut Display, _1: c_ulong) -> c_ulong,
52   pub fn XmuCompareISOLatin1 (_2: *const c_char, _1: *const c_char) -> c_int,
53   pub fn XmuConvertStandardSelection (_8: Widget, _7: c_ulong, _6: *mut c_ulong, _5: *mut c_ulong, _4: *mut c_ulong, _3: *mut *mut c_char, _2: *mut c_ulong, _1: *mut c_int) -> c_char,
54   pub fn XmuCopyISOLatin1Lowered (_2: *mut c_char, _1: *const c_char) -> (),
55   pub fn XmuCopyISOLatin1Uppered (_2: *mut c_char, _1: *const c_char) -> (),
56   pub fn XmuCreateColormap (_2: *mut Display, _1: *mut XStandardColormap) -> c_int,
57   pub fn XmuCreatePixmapFromBitmap (_8: *mut Display, _7: c_ulong, _6: c_ulong, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_ulong,
58   pub fn XmuCreateStippledPixmap (_4: *mut Screen, _3: c_ulong, _2: c_ulong, _1: c_uint) -> c_ulong,
59   pub fn XmuCursorNameToIndex (_1: *const c_char) -> c_int,
60   pub fn XmuCvtBackingStoreToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
61   pub fn XmuCvtFunctionToCallback (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
62   pub fn XmuCvtGravityToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
63   pub fn XmuCvtJustifyToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
64   pub fn XmuCvtLongToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
65   pub fn XmuCvtOrientationToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
66   pub fn XmuCvtShapeStyleToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
67   pub fn XmuCvtStringToBackingStore (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
68   pub fn XmuCvtStringToBitmap (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
69   pub fn XmuCvtStringToColorCursor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
70   pub fn XmuCvtStringToCursor (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
71   pub fn XmuCvtStringToGravity (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
72   pub fn XmuCvtStringToJustify (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
73   pub fn XmuCvtStringToLong (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
74   pub fn XmuCvtStringToOrientation (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
75   pub fn XmuCvtStringToShapeStyle (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
76   pub fn XmuCvtStringToWidget (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
77   pub fn XmuCvtWidgetToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
78   pub fn XmuDeleteStandardColormap (_3: *mut Display, _2: c_int, _1: c_ulong) -> (),
79   pub fn XmuDestroyScanlineList (_1: *mut XmuScanline) -> (),
80   pub fn XmuDestroySegmentList (_1: *mut XmuSegment) -> (),
81   pub fn XmuDistinguishableColors (_2: *mut XColor, _1: c_int) -> c_int,
82   pub fn XmuDistinguishablePixels (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int,
83   pub fn XmuDQAddDisplay (_3: *mut XmuDisplayQueue, _2: *mut Display, _1: *mut c_char) -> *mut XmuDisplayQueueEntry,
84   pub fn XmuDQCreate (_3: Option<unsafe extern "C" fn (*mut XmuDisplayQueue, *mut XmuDisplayQueueEntry) -> c_int>, _2: Option<unsafe extern "C" fn (*mut XmuDisplayQueue) -> c_int>, _1: *mut c_char) -> *mut XmuDisplayQueue,
85   pub fn XmuDQDestroy (_2: *mut XmuDisplayQueue, _1: c_int) -> c_int,
86   pub fn XmuDQLookupDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> *mut XmuDisplayQueueEntry,
87   pub fn XmuDQRemoveDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> c_int,
88   pub fn XmuDrawLogo (_8: *mut Display, _7: c_ulong, _6: GC, _5: GC, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
89   pub fn XmuDrawRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (),
90   pub fn XmuFillRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (),
91   pub fn XmuGetAtomName (_2: *mut Display, _1: c_ulong) -> *mut c_char,
92   pub fn XmuGetColormapAllocation (_5: *mut XVisualInfo, _4: c_ulong, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> c_int,
93   pub fn XmuGetHostname (_2: *mut c_char, _1: c_int) -> c_int,
94   pub fn XmuInternAtom (_2: *mut Display, _1: AtomPtr) -> c_ulong,
95   pub fn XmuInternStrings (_4: *mut Display, _3: *mut *mut c_char, _2: c_uint, _1: *mut c_ulong) -> (),
96   pub fn XmuLocateBitmapFile (_8: *mut Screen, _7: *const c_char, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong,
97   pub fn XmuLocatePixmapFile (_11: *mut Screen, _10: *const c_char, _9: c_ulong, _8: c_ulong, _7: c_uint, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong,
98   pub fn XmuLookupAPL (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
99   pub fn XmuLookupArabic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
100   pub fn XmuLookupCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> c_int,
101   pub fn XmuLookupCyrillic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
102   pub fn XmuLookupGreek (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
103   pub fn XmuLookupHebrew (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
104   pub fn XmuLookupJISX0201 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
105   pub fn XmuLookupKana (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
106   pub fn XmuLookupLatin1 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
107   pub fn XmuLookupLatin2 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
108   pub fn XmuLookupLatin3 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
109   pub fn XmuLookupLatin4 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
110   pub fn XmuLookupStandardColormap (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_uint, _3: c_ulong, _2: c_int, _1: c_int) -> c_int,
111   pub fn XmuLookupString (_6: *mut XKeyEvent, _5: *mut c_uchar, _4: c_int, _3: *mut c_ulong, _2: *mut XComposeStatus, _1: c_ulong) -> c_int,
112   pub fn XmuMakeAtom (_1: *const c_char) -> AtomPtr,
113   pub fn XmuNameOfAtom (_1: AtomPtr) -> *mut c_char,
114   pub fn XmuNCopyISOLatin1Lowered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (),
115   pub fn XmuNCopyISOLatin1Uppered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (),
116   pub fn XmuNewArea (_4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea,
117   pub fn XmuNewCvtStringToWidget (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
118   pub fn XmuNewScanline (_3: c_int, _2: c_int, _1: c_int) -> *mut XmuScanline,
119   pub fn XmuNewSegment (_2: c_int, _1: c_int) -> *mut XmuSegment,
120   pub fn XmuOptimizeArea (_1: *mut XmuArea) -> *mut XmuArea,
121   pub fn XmuOptimizeScanline (_1: *mut XmuScanline) -> *mut XmuScanline,
122   pub fn XmuPrintDefaultErrorMessage (_3: *mut Display, _2: *mut XErrorEvent, _1: *mut FILE) -> c_int,
123   pub fn XmuReadBitmapData (_6: *mut FILE, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int,
124   pub fn XmuReadBitmapDataFromFile (_6: *const c_char, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int,
125   pub fn XmuRegisterExternalAgent (_4: Widget, _3: *mut c_void, _2: *mut XEvent, _1: *mut c_char) -> (),
126   pub fn XmuReleaseStippledPixmap (_2: *mut Screen, _1: c_ulong) -> (),
127   pub fn XmuRemoveCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> c_int,
128   pub fn XmuReshapeWidget (_4: Widget, _3: c_int, _2: c_int, _1: c_int) -> c_char,
129   pub fn XmuScanlineAnd (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
130   pub fn XmuScanlineAndSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
131   pub fn XmuScanlineCopy (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
132   pub fn XmuScanlineEqu (_2: *mut XmuScanline, _1: *mut XmuScanline) -> c_int,
133   pub fn XmuScanlineNot (_3: *mut XmuScanline, _2: c_int, _1: c_int) -> *mut XmuScanline,
134   pub fn XmuScanlineOr (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
135   pub fn XmuScanlineOrSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
136   pub fn XmuScanlineXor (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
137   pub fn XmuScanlineXorSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
138   pub fn XmuScreenOfWindow (_2: *mut Display, _1: c_ulong) -> *mut Screen,
139   pub fn XmuSimpleErrorHandler (_2: *mut Display, _1: *mut XErrorEvent) -> c_int,
140   pub fn XmuStandardColormap (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_uint, _5: c_ulong, _4: c_ulong, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> *mut XStandardColormap,
141   pub fn XmuUpdateMapHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int,
142   pub fn XmuValidArea (_1: *mut XmuArea) -> c_int,
143   pub fn XmuValidScanline (_1: *mut XmuScanline) -> c_int,
144   pub fn XmuVisualStandardColormaps (_6: *mut Display, _5: c_int, _4: c_ulong, _3: c_uint, _2: c_int, _1: c_int) -> c_int,
145   pub fn XmuWnCountOwnedResources (_3: *mut XmuWidgetNode, _2: *mut XmuWidgetNode, _1: c_int) -> c_int,
146   pub fn XmuWnFetchResources (_3: *mut XmuWidgetNode, _2: Widget, _1: *mut XmuWidgetNode) -> (),
147   pub fn XmuWnInitializeNodes (_2: *mut XmuWidgetNode, _1: c_int) -> (),
148   pub fn XmuWnNameToNode (_3: *mut XmuWidgetNode, _2: c_int, _1: *const c_char) -> *mut XmuWidgetNode,
149 variadic:
150   pub fn XmuSnprintf (_3: *mut c_char, _2: c_int, _1: *const c_char) -> c_int,
151 globals:
152   pub static _XA_ATOM_PAIR: AtomPtr,
153   pub static _XA_CHARACTER_POSITION: AtomPtr,
154   pub static _XA_CLASS: AtomPtr,
155   pub static _XA_CLIENT_WINDOW: AtomPtr,
156   pub static _XA_CLIPBOARD: AtomPtr,
157   pub static _XA_COMPOUND_TEXT: AtomPtr,
158   pub static _XA_DECNET_ADDRESS: AtomPtr,
159   pub static _XA_DELETE: AtomPtr,
160   pub static _XA_FILENAME: AtomPtr,
161   pub static _XA_HOSTNAME: AtomPtr,
162   pub static _XA_IP_ADDRESS: AtomPtr,
163   pub static _XA_LENGTH: AtomPtr,
164   pub static _XA_LIST_LENGTH: AtomPtr,
165   pub static _XA_NAME: AtomPtr,
166   pub static _XA_NET_ADDRESS: AtomPtr,
167   pub static _XA_NULL: AtomPtr,
168   pub static _XA_OWNER_OS: AtomPtr,
169   pub static _XA_SPAN: AtomPtr,
170   pub static _XA_TARGETS: AtomPtr,
171   pub static _XA_TEXT: AtomPtr,
172   pub static _XA_TIMESTAMP: AtomPtr,
173   pub static _XA_USER: AtomPtr,
174   pub static _XA_UTF8_STRING: AtomPtr,
175 }
176 
177 
178 //
179 // types
180 //
181 
182 
183 // TODO structs
184 #[repr(C)] pub struct _AtomRec;
185 #[repr(C)] pub struct _XmuArea;
186 #[repr(C)] pub struct _XmuDisplayQueue;
187 #[repr(C)] pub struct _XmuDisplayQueueEntry;
188 #[repr(C)] pub struct _XmuScanline;
189 #[repr(C)] pub struct _XmuSegment;
190 #[repr(C)] pub struct _XmuWidgetNode;
191 
192 // struct typedefs
193 pub type AtomPtr = *mut _AtomRec;
194 pub type XmuArea = _XmuArea;
195 pub type XmuDisplayQueue = _XmuDisplayQueue;
196 pub type XmuDisplayQueueEntry = _XmuDisplayQueueEntry;
197 pub type XmuScanline = _XmuScanline;
198 pub type XmuSegment = _XmuSegment;
199 pub type XmuWidgetNode = _XmuWidgetNode;
200