1 /******************************************************************************
2     Based on the generated files from the BCD tool
3     modified by: Frank Benoit <keinfarbton@googlemail.com>
4 ******************************************************************************/
5 module org.eclipse.swt.internal.c.Xutil;
6 
7 import java.lang.all;
8 
9 public import org.eclipse.swt.internal.c.Xlib;
10 private import org.eclipse.swt.internal.c.X;
11 
12 version(Tango){
13     import tango.stdc.stdint;
14 } else { // Phobos
15     import std.stdint;
16 }
17 
18 extern(C):
19 
20 const c_int NoValue = 0x0000;
21 const c_int XValue = 0x0001;
22 const c_int YValue = 0x0002;
23 const c_int WidthValue = 0x0004;
24 const c_int HeightValue = 0x0008;
25 const c_int AllValues = 0x000F;
26 const c_int XNegative = 0x0010;
27 const c_int YNegative = 0x0020;
28 const c_int WithdrawnState = 0;
29 const c_int NormalState = 1;
30 const c_int IconicState = 3;
31 const c_int DontCareState = 0;
32 const c_int ZoomState = 2;
33 const c_int InactiveState = 4;
34 const c_int XNoMemory = -1;
35 const c_int XLocaleNotSupported = -2;
36 const c_int XConverterNotFound = -3;
37 const c_int RectangleOut = 0;
38 const c_int RectangleIn = 1;
39 const c_int RectanglePart = 2;
40 const c_int VisualNoMask = 0x0;
41 const c_int VisualIDMask = 0x1;
42 const c_int VisualScreenMask = 0x2;
43 const c_int VisualDepthMask = 0x4;
44 const c_int VisualClassMask = 0x8;
45 const c_int VisualRedMaskMask = 0x10;
46 const c_int VisualGreenMaskMask = 0x20;
47 const c_int VisualBlueMaskMask = 0x40;
48 const c_int VisualColormapSizeMask = 0x80;
49 const c_int VisualBitsPerRGBMask = 0x100;
50 const c_int VisualAllMask = 0x1FF;
51 const c_int BitmapSuccess = 0;
52 const c_int BitmapOpenFailed = 1;
53 const c_int BitmapFileInvalid = 2;
54 const c_int BitmapNoMemory = 3;
55 const c_int XCSUCCESS = 0;
56 const c_int XCNOMEM = 1;
57 const c_int XCNOENT = 2;
58 alias c_int XContext;
59 alias void * Region;
60 alias _XComposeStatus XComposeStatus;
61 enum XICCEncodingStyle {
62 XStringStyle=0,
63 XCompoundTextStyle=1,
64 XTextStyle=2,
65 XStdICCTextStyle=3,
66 XUTF8StringStyle=4,
67 }
68 alias void function(void *, char *, c_int, c_int, char * *) _BCD_func__1029;
69 alias c_int function(void *) _BCD_func__1071;
70 alias c_int function(void *, XErrorEvent *) _BCD_func__1072;
71 alias void function(void *, char *, char *) _BCD_func__1145;
72 alias c_int function(void *, char *, char *) _BCD_func__1146;
73 alias void function(void *, char *, char *) _BCD_func__1147;
74 struct XStandardColormap {
75 Colormap colormap;
76 c_ulong red_max;
77 c_ulong red_mult;
78 c_ulong green_max;
79 c_ulong green_mult;
80 c_ulong blue_max;
81 c_ulong blue_mult;
82 c_ulong base_pixel;
83 VisualID visualid;
84 XID killid;
85 }
86 struct XVisualInfo {
87 Visual * visual;
88 VisualID visualid;
89 c_int screen;
90 c_int depth;
91 c_int c_class;
92 c_ulong red_mask;
93 c_ulong green_mask;
94 c_ulong blue_mask;
95 c_int colormap_size;
96 c_int bits_per_rgb;
97 }
98 struct _XComposeStatus {
99 XPointer compose_ptr;
100 c_int chars_matched;
101 }
102 struct XClassHint {
103 char * res_name;
104 char * res_class;
105 }
106 struct XIconSize {
107 c_int min_width;
108 c_int min_height;
109 c_int max_width;
110 c_int max_height;
111 c_int width_inc;
112 c_int height_inc;
113 }
114 struct XTextProperty {
115 char * value;
116 Atom encoding;
117 c_int format;
118 c_ulong nitems;
119 }
120 struct XWMHints {
121 c_long flags;
122 Bool input;
123 c_int initial_state;
124 Pixmap icon_pixmap;
125 Window icon_window;
126 c_int icon_x;
127 c_int icon_y;
128 Pixmap icon_mask;
129 XID window_group;
130 }
131 struct N10XSizeHints4__94E {
132 c_int x;
133 c_int y;
134 }
135 struct XSizeHints {
136 c_long flags;
137 c_int x;
138 c_int y;
139 c_int width;
140 c_int height;
141 c_int min_width;
142 c_int min_height;
143 c_int max_width;
144 c_int max_height;
145 c_int width_inc;
146 c_int height_inc;
147 N10XSizeHints4__94E min_aspect;
148 N10XSizeHints4__94E max_aspect;
149 c_int base_width;
150 c_int base_height;
151 c_int win_gravity;
152 }
153 version(DYNLINK){
154 mixin(gshared!(
155 "extern(C) void function(Region, Region, Region) XXorRegion;
156 extern(C) c_int function(Display*, c_int, const char*, const char*, c_uint, XSizeHints*, c_int*, c_int*, c_int*, c_int*, c_int*) XWMGeometry;
157 extern(C) void function(Region, Region, Region) XUnionRegion;
158 extern(C) void function(XRectangle*, Region, Region) XUnionRectWithRegion;
159 extern(C) c_int function(Display*, XTextProperty*, char***, c_int*) Xutf8TextPropertyToTextList;
160 extern(C) c_int function(Display*, XTextProperty*, wchar***, c_int*) XwcTextPropertyToTextList;
161 extern(C) c_int function(Display*, XTextProperty*, char***, c_int*) XmbTextPropertyToTextList;
162 extern(C) Status function(XTextProperty*, char***, c_int*) XTextPropertyToStringList;
163 extern(C) void function(wchar**) XwcFreeStringList;
164 extern(C) c_int function(Display*, char**, c_int, XICCEncodingStyle, XTextProperty*) Xutf8TextListToTextProperty;
165 extern(C) c_int function(Display*, wchar**, c_int, XICCEncodingStyle, XTextProperty*) XwcTextListToTextProperty;
166 extern(C) c_int function(Display*, char**, c_int, XICCEncodingStyle, XTextProperty*) XmbTextListToTextProperty;
167 extern(C) void function(Region, Region, Region) XSubtractRegion;
168 extern(C) Status function(char**, c_int, XTextProperty*) XStringListToTextProperty;
169 extern(C) void function(Region, c_int, c_int) XShrinkRegion;
170 extern(C) void function(Display*, Window, XSizeHints*) XSetZoomHints;
171 extern(C) void function(Display*, Window, XStandardColormap*, Atom) XSetStandardColormap;
172 extern(C) void function(Display*, GC, Region) XSetRegion;
173 extern(C) void function(Display*, Window, XSizeHints*, Atom) XSetWMSizeHints;
174 extern(C) void function(Display*, Window, char*, char*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*) Xutf8SetWMProperties;
175 extern(C) void function(Display*, Window, const char*, const char*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*) XmbSetWMProperties;
176 extern(C) void function(Display*, Window, XTextProperty*, XTextProperty*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*) XSetWMProperties;
177 extern(C) void function(Display*, Window, XSizeHints*) XSetWMNormalHints;
178 extern(C) void function(Display*, Window, XTextProperty*) XSetWMName;
179 extern(C) void function(Display*, Window, XTextProperty*) XSetWMIconName;
180 extern(C) void function(Display*, Window, XWMHints*) XSetWMHints;
181 extern(C) void function(Display*, Window, XTextProperty*) XSetWMClientMachine;
182 extern(C) void function(Display*, Window, XTextProperty*, Atom) XSetTextProperty;
183 extern(C) void function(Display*, Window, const char*, const char*, Pixmap, char**, c_int, XSizeHints*) XSetStandardProperties;
184 extern(C) void function(Display*, Window, XSizeHints*, Atom) XSetSizeHints;
185 extern(C) void function(Display*, Window, XStandardColormap*, c_int, Atom) XSetRGBColormaps;
186 extern(C) void function(Display*, Window, XSizeHints*) XSetNormalHints;
187 extern(C) void function(Display*, Window, XIconSize*, c_int) XSetIconSizes;
188 extern(C) void function(Display*, Window, XClassHint*) XSetClassHint;
189 extern(C) c_int function(Display*, XID, XContext, const char*) XSaveContext;
190 extern(C) c_int function(Region, c_int, c_int, c_uint, c_uint) XRectInRegion;
191 extern(C) Region function(XPoint*, c_int, c_int) XPolygonRegion;
192 extern(C) Bool function(Region, c_int, c_int) XPointInRegion;
193 extern(C) void function(Region, c_int, c_int) XOffsetRegion;
194 extern(C) Status function(Display*, c_int, c_int, c_int, XVisualInfo*) XMatchVisualInfo;
195 extern(C) c_int function(XKeyEvent*, char*, c_int, KeySym*, XComposeStatus*) XLookupString;
196 extern(C) void function(KeySym, KeySym*, KeySym*) XConvertCase;
197 extern(C) void function(Region, Region, Region) XIntersectRegion;
198 extern(C) Status function(Display*, Window, XSizeHints*) XGetZoomHints;
199 extern(C) Status function(Display*, Window, XSizeHints*, c_long*, Atom) XGetWMSizeHints;
200 extern(C) Status function(Display*, Window, XSizeHints*, c_long*) XGetWMNormalHints;
201 extern(C) Status function(Display*, Window, XTextProperty*) XGetWMName;
202 extern(C) Status function(Display*, Window, XTextProperty*) XGetWMIconName;
203 extern(C) XWMHints* function(Display*, Window) XGetWMHints;
204 extern(C) Status function(Display*, Window, XTextProperty*) XGetWMClientMachine;
205 extern(C) XVisualInfo* function(Display*, c_long, XVisualInfo*, c_int*) XGetVisualInfo;
206 extern(C) Status function(Display*, Window, XTextProperty*, Atom) XGetTextProperty;
207 extern(C) Status function(Display*, Window, XStandardColormap*, Atom) XGetStandardColormap;
208 extern(C) Status function(Display*, Window, XSizeHints*, Atom) XGetSizeHints;
209 extern(C) Status function(Display*, Window, XStandardColormap**, c_int*, Atom) XGetRGBColormaps;
210 extern(C) Status function(Display*, Window, XSizeHints*) XGetNormalHints;
211 extern(C) Status function(Display*, Window, XIconSize**, c_int*) XGetIconSizes;
212 extern(C) Status function(Display*, Window, XClassHint*) XGetClassHint;
213 extern(C) c_int function(Display*, XID, XContext, XPointer*) XFindContext;
214 extern(C) void function(Region, Region) XEqualRegion;
215 extern(C) void function(Region) XEmptyRegion;
216 extern(C) void function(Region) XDestroyRegion;
217 extern(C) c_int function(Display*, XID, XContext) XDeleteContext;
218 extern(C) char* function() XDefaultString;
219 extern(C) Region function() XCreateRegion;
220 extern(C) void function(Region, XRectangle*) XClipBox;
221 extern(C) XWMHints* function() XAllocWMHints;
222 extern(C) XStandardColormap* function() XAllocStandardColormap;
223 extern(C) XSizeHints* function() XAllocSizeHints;
224 extern(C) XIconSize* function() XAllocIconSize;
225 extern(C) XClassHint* function() XAllocClassHint;"
226 ));
227 
228 Symbol[] symbols;
229 static this () {
230     symbols = [
231         Symbol("XXorRegion",  cast(void**)& XXorRegion),
232         Symbol("XWMGeometry",  cast(void**)& XWMGeometry),
233         Symbol("XUnionRegion",  cast(void**)& XUnionRegion),
234         Symbol("XUnionRectWithRegion",  cast(void**)& XUnionRectWithRegion),
235         Symbol("Xutf8TextPropertyToTextList",  cast(void**)& Xutf8TextPropertyToTextList),
236         Symbol("XwcTextPropertyToTextList",  cast(void**)& XwcTextPropertyToTextList),
237         Symbol("XmbTextPropertyToTextList",  cast(void**)& XmbTextPropertyToTextList),
238         Symbol("XTextPropertyToStringList",  cast(void**)& XTextPropertyToStringList),
239         Symbol("XwcFreeStringList",  cast(void**)& XwcFreeStringList),
240         Symbol("Xutf8TextListToTextProperty",  cast(void**)& Xutf8TextListToTextProperty),
241         Symbol("XwcTextListToTextProperty",  cast(void**)& XwcTextListToTextProperty),
242         Symbol("XmbTextListToTextProperty",  cast(void**)& XmbTextListToTextProperty),
243         Symbol("XSubtractRegion",  cast(void**)& XSubtractRegion),
244         Symbol("XStringListToTextProperty",  cast(void**)& XStringListToTextProperty),
245         Symbol("XShrinkRegion",  cast(void**)& XShrinkRegion),
246         Symbol("XSetZoomHints",  cast(void**)& XSetZoomHints),
247         Symbol("XSetStandardColormap",  cast(void**)& XSetStandardColormap),
248         Symbol("XSetRegion",  cast(void**)& XSetRegion),
249         Symbol("XSetWMSizeHints",  cast(void**)& XSetWMSizeHints),
250         Symbol("Xutf8SetWMProperties",  cast(void**)& Xutf8SetWMProperties),
251         Symbol("XmbSetWMProperties",  cast(void**)& XmbSetWMProperties),
252         Symbol("XSetWMProperties",  cast(void**)& XSetWMProperties),
253         Symbol("XSetWMNormalHints",  cast(void**)& XSetWMNormalHints),
254         Symbol("XSetWMName",  cast(void**)& XSetWMName),
255         Symbol("XSetWMIconName",  cast(void**)& XSetWMIconName),
256         Symbol("XSetWMHints",  cast(void**)& XSetWMHints),
257         Symbol("XSetWMClientMachine",  cast(void**)& XSetWMClientMachine),
258         Symbol("XSetTextProperty",  cast(void**)& XSetTextProperty),
259         Symbol("XSetStandardProperties",  cast(void**)& XSetStandardProperties),
260         Symbol("XSetSizeHints",  cast(void**)& XSetSizeHints),
261         Symbol("XSetRGBColormaps",  cast(void**)& XSetRGBColormaps),
262         Symbol("XSetNormalHints",  cast(void**)& XSetNormalHints),
263         Symbol("XSetIconSizes",  cast(void**)& XSetIconSizes),
264         Symbol("XSetClassHint",  cast(void**)& XSetClassHint),
265         Symbol("XSaveContext",  cast(void**)& XSaveContext),
266         Symbol("XRectInRegion",  cast(void**)& XRectInRegion),
267         Symbol("XPolygonRegion",  cast(void**)& XPolygonRegion),
268         Symbol("XPointInRegion",  cast(void**)& XPointInRegion),
269         Symbol("XOffsetRegion",  cast(void**)& XOffsetRegion),
270         Symbol("XMatchVisualInfo",  cast(void**)& XMatchVisualInfo),
271         Symbol("XLookupString",  cast(void**)& XLookupString),
272         Symbol("XConvertCase",  cast(void**)& XConvertCase),
273         Symbol("XIntersectRegion",  cast(void**)& XIntersectRegion),
274         Symbol("XGetZoomHints",  cast(void**)& XGetZoomHints),
275         Symbol("XGetWMSizeHints",  cast(void**)& XGetWMSizeHints),
276         Symbol("XGetWMNormalHints",  cast(void**)& XGetWMNormalHints),
277         Symbol("XGetWMName",  cast(void**)& XGetWMName),
278         Symbol("XGetWMIconName",  cast(void**)& XGetWMIconName),
279         Symbol("XGetWMHints",  cast(void**)& XGetWMHints),
280         Symbol("XGetWMClientMachine",  cast(void**)& XGetWMClientMachine),
281         Symbol("XGetVisualInfo",  cast(void**)& XGetVisualInfo),
282         Symbol("XGetTextProperty",  cast(void**)& XGetTextProperty),
283         Symbol("XGetStandardColormap",  cast(void**)& XGetStandardColormap),
284         Symbol("XGetSizeHints",  cast(void**)& XGetSizeHints),
285         Symbol("XGetRGBColormaps",  cast(void**)& XGetRGBColormaps),
286         Symbol("XGetNormalHints",  cast(void**)& XGetNormalHints),
287         Symbol("XGetIconSizes",  cast(void**)& XGetIconSizes),
288         Symbol("XGetClassHint",  cast(void**)& XGetClassHint),
289         Symbol("XFindContext",  cast(void**)& XFindContext),
290         Symbol("XEqualRegion",  cast(void**)& XEqualRegion),
291         Symbol("XEmptyRegion",  cast(void**)& XEmptyRegion),
292         Symbol("XDestroyRegion",  cast(void**)& XDestroyRegion),
293         Symbol("XDeleteContext",  cast(void**)& XDeleteContext),
294         Symbol("XDefaultString",  cast(void**)& XDefaultString),
295         Symbol("XCreateRegion",  cast(void**)& XCreateRegion),
296         Symbol("XClipBox",  cast(void**)& XClipBox),
297         Symbol("XAllocWMHints",  cast(void**)& XAllocWMHints),
298         Symbol("XAllocStandardColormap",  cast(void**)& XAllocStandardColormap),
299         Symbol("XAllocSizeHints",  cast(void**)& XAllocSizeHints),
300         Symbol("XAllocIconSize",  cast(void**)& XAllocIconSize),
301         Symbol("XAllocClassHint",  cast(void**)& XAllocClassHint)
302     ];
303 }
304 
305 } else { // version(DYNLINK)
306 extern(C) void XXorRegion(Region, Region, Region);
307 extern(C) c_int XWMGeometry(Display*, c_int, const char*, const char*, c_uint, XSizeHints*, c_int*, c_int*, c_int*, c_int*, c_int*);
308 extern(C) void XUnionRegion(Region, Region, Region);
309 extern(C) void XUnionRectWithRegion(XRectangle*, Region, Region);
310 extern(C) c_int Xutf8TextPropertyToTextList(Display*, XTextProperty*, char***, c_int*);
311 extern(C) c_int XwcTextPropertyToTextList(Display*, XTextProperty*, wchar***, c_int*);
312 extern(C) c_int XmbTextPropertyToTextList(Display*, XTextProperty*, char***, c_int*);
313 extern(C) Status XTextPropertyToStringList(XTextProperty*, char***, c_int*);
314 extern(C) void XwcFreeStringList(wchar**);
315 extern(C) c_int Xutf8TextListToTextProperty(Display*, char**, c_int, XICCEncodingStyle, XTextProperty*);
316 extern(C) c_int XwcTextListToTextProperty(Display*, wchar**, c_int, XICCEncodingStyle, XTextProperty*);
317 extern(C) c_int XmbTextListToTextProperty(Display*, char**, c_int, XICCEncodingStyle, XTextProperty*);
318 extern(C) void XSubtractRegion(Region, Region, Region);
319 extern(C) Status XStringListToTextProperty(char**, c_int, XTextProperty*);
320 extern(C) void XShrinkRegion(Region, c_int, c_int);
321 extern(C) void XSetZoomHints(Display*, Window, XSizeHints*);
322 extern(C) void XSetStandardColormap(Display*, Window, XStandardColormap*, Atom);
323 extern(C) void XSetRegion(Display*, GC, Region);
324 extern(C) void XSetWMSizeHints(Display*, Window, XSizeHints*, Atom);
325 extern(C) void Xutf8SetWMProperties(Display*, Window, char*, char*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*);
326 extern(C) void XmbSetWMProperties(Display*, Window, const char*, const char*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*);
327 extern(C) void XSetWMProperties(Display*, Window, XTextProperty*, XTextProperty*, char**, c_int, XSizeHints*, XWMHints*, XClassHint*);
328 extern(C) void XSetWMNormalHints(Display*, Window, XSizeHints*);
329 extern(C) void XSetWMName(Display*, Window, XTextProperty*);
330 extern(C) void XSetWMIconName(Display*, Window, XTextProperty*);
331 extern(C) void XSetWMHints(Display*, Window, XWMHints*);
332 extern(C) void XSetWMClientMachine(Display*, Window, XTextProperty*);
333 extern(C) void XSetTextProperty(Display*, Window, XTextProperty*, Atom);
334 extern(C) void XSetStandardProperties(Display*, Window, const char*, const char*, Pixmap, char**, c_int, XSizeHints*);
335 extern(C) void XSetSizeHints(Display*, Window, XSizeHints*, Atom);
336 extern(C) void XSetRGBColormaps(Display*, Window, XStandardColormap*, c_int, Atom);
337 extern(C) void XSetNormalHints(Display*, Window, XSizeHints*);
338 extern(C) void XSetIconSizes(Display*, Window, XIconSize*, c_int);
339 extern(C) void XSetClassHint(Display*, Window, XClassHint*);
340 extern(C) c_int XSaveContext(Display*, XID, XContext, const char*);
341 extern(C) c_int XRectInRegion(Region, c_int, c_int, c_uint, c_uint);
342 extern(C) Region XPolygonRegion(XPoint*, c_int, c_int);
343 extern(C) Bool XPointInRegion(Region, c_int, c_int);
344 extern(C) void XOffsetRegion(Region, c_int, c_int);
345 extern(C) Status XMatchVisualInfo(Display*, c_int, c_int, c_int, XVisualInfo*);
346 extern(C) c_int XLookupString(XKeyEvent*, char*, c_int, KeySym*, XComposeStatus*);
347 extern(C) void XConvertCase(KeySym, KeySym*, KeySym*);
348 extern(C) void XIntersectRegion(Region, Region, Region);
349 extern(C) Status XGetZoomHints(Display*, Window, XSizeHints*);
350 extern(C) Status XGetWMSizeHints(Display*, Window, XSizeHints*, c_long*, Atom);
351 extern(C) Status XGetWMNormalHints(Display*, Window, XSizeHints*, c_long*);
352 extern(C) Status XGetWMName(Display*, Window, XTextProperty*);
353 extern(C) Status XGetWMIconName(Display*, Window, XTextProperty*);
354 extern(C) XWMHints* XGetWMHints(Display*, Window);
355 extern(C) Status XGetWMClientMachine(Display*, Window, XTextProperty*);
356 extern(C) XVisualInfo* XGetVisualInfo(Display*, long, XVisualInfo*, c_int*);
357 extern(C) Status XGetTextProperty(Display*, Window, XTextProperty*, Atom);
358 extern(C) Status XGetStandardColormap(Display*, Window, XStandardColormap*, Atom);
359 extern(C) Status XGetSizeHints(Display*, Window, XSizeHints*, Atom);
360 extern(C) Status XGetRGBColormaps(Display*, Window, XStandardColormap**, c_int*, Atom);
361 extern(C) Status XGetNormalHints(Display*, Window, XSizeHints*);
362 extern(C) Status XGetIconSizes(Display*, Window, XIconSize**, c_int*);
363 extern(C) Status XGetClassHint(Display*, Window, XClassHint*);
364 extern(C) c_int XFindContext(Display*, XID, XContext, XPointer*);
365 extern(C) void XEqualRegion(Region, Region);
366 extern(C) void XEmptyRegion(Region);
367 extern(C) void XDestroyRegion(Region);
368 extern(C) c_int XDeleteContext(Display*, XID, XContext);
369 extern(C) char* XDefaultString();
370 extern(C) Region XCreateRegion();
371 extern(C) void XClipBox(Region, XRectangle*);
372 extern(C) XWMHints* XAllocWMHints();
373 extern(C) XStandardColormap* XAllocStandardColormap();
374 extern(C) XSizeHints* XAllocSizeHints();
375 extern(C) XIconSize* XAllocIconSize();
376 extern(C) XClassHint* XAllocClassHint();
377 } // version(DYNLINK)
378