1 /*
2 
3 Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
4 
5 All Rights Reserved.
6 
7 The above copyright notice and this permission notice shall be included in
8 all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
13 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
14 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 
17 Except as contained in this notice, the name of The Open Group shall not be
18 used in advertising or otherwise to promote the sale, use or other dealings
19 in this Software without prior written authorization from The Open Group.
20 
21 */
22 
23 #ifndef __XLIB_H
24 #define __XLIB_H
25 
26 /* typedef struct _XrmHashBucketRec; */
27 typedef unsigned long Atom;
28 typedef unsigned long Time;
29 typedef unsigned long XID;
30 
31 #ifndef Bool
32 #define Bool int
33 #endif
34 
35 typedef int BoolDef;
36 
37 typedef XID Window;
38 typedef XID Drawable;
39 typedef XID Font;
40 typedef XID Pixmap;
41 typedef XID Cursor;
42 typedef XID Colormap;
43 typedef XID KeySym;
44 typedef XID GContext;
45 
46 typedef unsigned char KeyCode;
47 
48 typedef char *XPointer;
49 typedef unsigned long VisualID;
50 
51 #define PIXEL_ALREADY_TYPEDEFED
52 typedef unsigned long Pixel;
53 
54 #define XDestroyImage(ximage) \
55 	((*((ximage)->f.destroy_image))((ximage)))
56 #define XPutPixel(ximage, x, y, pixel) \
57 	((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
58 
59 #define AllPlanes 		((unsigned long)~0L)
60 #define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)dpy)->screens[scr])
61 #define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
62 #define DefaultDepth(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->root_depth)
63 #define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
64 #define DefaultScreen(dpy) 	(((_XPrivDisplay)dpy)->default_screen)
65 #define BlackPixel(dpy, scr)	(ScreenOfDisplay(dpy,scr)->black_pixel)
66 #define WhitePixel(dpy, scr)	(ScreenOfDisplay(dpy,scr)->white_pixel)
67 #define RootWindow(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->root)
68 #define DefaultRootWindow(dpy) 	(ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
69 #define DisplayWidth(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->width)
70 #define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
71 
72 #ifndef None
73 #define None                 0L	/* universal null resource or null atom */
74 #endif
75 
76 #define ParentRelative       1L
77 #define CopyFromParent       0L
78 #define PointerWindow        0L	/* destination window in SendEvent */
79 #define InputFocus           1L	/* destination window in SendEvent */
80 #define PointerRoot          1L	/* focus window in SetInputFocus */
81 #define AnyPropertyType      0L	/* special Atom, passed to GetProperty */
82 #define AnyKey		     0L	/* special Key Code, passed to GrabKey */
83 #define AnyButton            0L	/* special Button Code, passed to GrabButton */
84 #define AllTemporary         0L	/* special Resource ID passed to KillClient */
85 #define CurrentTime          0L	/* special Time */
86 #define NoSymbol	     0L	/* special KeySym */
87 #define NoEventMask			0L
88 #define KeyPressMask			(1L<<0)
89 #define KeyReleaseMask			(1L<<1)
90 #define ButtonPressMask			(1L<<2)
91 #define ButtonReleaseMask		(1L<<3)
92 #define EnterWindowMask			(1L<<4)
93 #define LeaveWindowMask			(1L<<5)
94 #define PointerMotionMask		(1L<<6)
95 #define PointerMotionHintMask		(1L<<7)
96 #define Button1MotionMask		(1L<<8)
97 #define Button2MotionMask		(1L<<9)
98 #define Button3MotionMask		(1L<<10)
99 #define Button4MotionMask		(1L<<11)
100 #define Button5MotionMask		(1L<<12)
101 #define ButtonMotionMask		(1L<<13)
102 #define KeymapStateMask			(1L<<14)
103 #define ExposureMask			(1L<<15)
104 #define VisibilityChangeMask		(1L<<16)
105 #define StructureNotifyMask		(1L<<17)
106 #define ResizeRedirectMask		(1L<<18)
107 #define SubstructureNotifyMask		(1L<<19)
108 #define SubstructureRedirectMask	(1L<<20)
109 #define FocusChangeMask			(1L<<21)
110 #define PropertyChangeMask		(1L<<22)
111 #define ColormapChangeMask		(1L<<23)
112 #define OwnerGrabButtonMask		(1L<<24)
113 #define KeyPress		2
114 #define KeyRelease		3
115 #define ButtonPress		4
116 #define ButtonRelease		5
117 #define MotionNotify		6
118 #define EnterNotify		7
119 #define LeaveNotify		8
120 #define FocusIn			9
121 #define FocusOut		10
122 #define KeymapNotify		11
123 #define Expose			12
124 #define GraphicsExpose		13
125 #define NoExpose		14
126 #define VisibilityNotify	15
127 #define CreateNotify		16
128 #define DestroyNotify		17
129 #define UnmapNotify		18
130 #define MapNotify		19
131 #define MapRequest		20
132 #define ReparentNotify		21
133 #define ConfigureNotify		22
134 #define ConfigureRequest	23
135 #define GravityNotify		24
136 #define ResizeRequest		25
137 #define CirculateNotify		26
138 #define CirculateRequest	27
139 #define PropertyNotify		28
140 #define SelectionClear		29
141 #define SelectionRequest	30
142 #define SelectionNotify		31
143 #define ColormapNotify		32
144 #define ClientMessage		33
145 #define MappingNotify		34
146 #define LASTEvent		35	/* must be bigger than any event # */
147 #define ShiftMask		(1<<0)
148 #define LockMask		(1<<1)
149 #define ControlMask		(1<<2)
150 #define Mod1Mask		(1<<3)
151 #define Mod2Mask		(1<<4)
152 #define Mod3Mask		(1<<5)
153 #define Mod4Mask		(1<<6)
154 #define Mod5Mask		(1<<7)
155 #define ShiftMapIndex		0
156 #define LockMapIndex		1
157 #define ControlMapIndex		2
158 #define Mod1MapIndex		3
159 #define Mod2MapIndex		4
160 #define Mod3MapIndex		5
161 #define Mod4MapIndex		6
162 #define Mod5MapIndex		7
163 #define Button1Mask		(1<<8)
164 #define Button2Mask		(1<<9)
165 #define Button3Mask		(1<<10)
166 #define Button4Mask		(1<<11)
167 #define Button5Mask		(1<<12)
168 #define AnyModifier		(1<<15)  /* used in GrabButton, GrabKey */
169 #define Button1			1
170 #define Button2			2
171 #define Button3			3
172 #define Button4			4
173 #define Button5			5
174 #define NotifyNormal		0
175 #define NotifyGrab		1
176 #define NotifyUngrab		2
177 #define NotifyWhileGrabbed	3
178 #define NotifyHint		1	/* for MotionNotify events */
179 #define NotifyAncestor		0
180 #define NotifyVirtual		1
181 #define NotifyInferior		2
182 #define NotifyNonlinear		3
183 #define NotifyNonlinearVirtual	4
184 #define NotifyPointer		5
185 #define NotifyPointerRoot	6
186 #define NotifyDetailNone	7
187 #define VisibilityUnobscured		0
188 #define VisibilityPartiallyObscured	1
189 #define VisibilityFullyObscured		2
190 #define PlaceOnTop		0
191 #define PlaceOnBottom		1
192 #define FamilyInternet		0
193 #define FamilyDECnet		1
194 #define FamilyChaos		2
195 #define PropertyNewValue	0
196 #define PropertyDelete		1
197 #define ColormapUninstalled	0
198 #define ColormapInstalled	1
199 #define GrabModeSync		0
200 #define GrabModeAsync		1
201 #define GrabSuccess		0
202 #define AlreadyGrabbed		1
203 #define GrabInvalidTime		2
204 #define GrabNotViewable		3
205 #define GrabFrozen		4
206 #define AsyncPointer		0
207 #define SyncPointer		1
208 #define ReplayPointer		2
209 #define AsyncKeyboard		3
210 #define SyncKeyboard		4
211 #define ReplayKeyboard		5
212 #define AsyncBoth		6
213 #define SyncBoth		7
214 #define RevertToNone		(int)None
215 #define RevertToPointerRoot	(int)PointerRoot
216 #define RevertToParent		2
217 #define Success		   0	/* everything's okay */
218 #define BadRequest	   1	/* bad request code */
219 #define BadValue	   2	/* int parameter out of range */
220 #define BadWindow	   3	/* parameter not a Window */
221 #define BadPixmap	   4	/* parameter not a Pixmap */
222 #define BadAtom		   5	/* parameter not an Atom */
223 #define BadCursor	   6	/* parameter not a Cursor */
224 #define BadFont		   7	/* parameter not a Font */
225 #define BadMatch	   8	/* parameter mismatch */
226 #define BadDrawable	   9	/* parameter not a Pixmap or Window */
227 #define BadAccess	  10
228 #define BadAlloc	  11	/* insufficient resources */
229 #define BadColor	  12	/* no such colormap */
230 #define BadGC		  13	/* parameter not a GC */
231 #define BadIDChoice	  14	/* choice not in range or already used */
232 #define BadName		  15	/* font or color name doesn't exist */
233 #define BadLength	  16	/* Request length incorrect */
234 #define BadImplementation 17	/* server is defective */
235 #define FirstExtensionError	128
236 #define LastExtensionError	255
237 #define InputOutput		1
238 #define InputOnly		2
239 #define CWBackPixmap		(1L<<0)
240 #define CWBackPixel		(1L<<1)
241 #define CWBorderPixmap		(1L<<2)
242 #define CWBorderPixel           (1L<<3)
243 #define CWBitGravity		(1L<<4)
244 #define CWWinGravity		(1L<<5)
245 #define CWBackingStore          (1L<<6)
246 #define CWBackingPlanes	        (1L<<7)
247 #define CWBackingPixel	        (1L<<8)
248 #define CWOverrideRedirect	(1L<<9)
249 #define CWSaveUnder		(1L<<10)
250 #define CWEventMask		(1L<<11)
251 #define CWDontPropagate	        (1L<<12)
252 #define CWColormap		(1L<<13)
253 #define CWCursor	        (1L<<14)
254 #define CWX			(1<<0)
255 #define CWY			(1<<1)
256 #define CWWidth			(1<<2)
257 #define CWHeight		(1<<3)
258 #define CWBorderWidth		(1<<4)
259 #define CWSibling		(1<<5)
260 #define CWStackMode		(1<<6)
261 #define ForgetGravity		0
262 #define NorthWestGravity	1
263 #define NorthGravity		2
264 #define NorthEastGravity	3
265 #define WestGravity		4
266 #define CenterGravity		5
267 #define EastGravity		6
268 #define SouthWestGravity	7
269 #define SouthGravity		8
270 #define SouthEastGravity	9
271 #define StaticGravity		10
272 #define UnmapGravity		0
273 #define NotUseful               0
274 #define WhenMapped              1
275 #define Always                  2
276 #define IsUnmapped		0
277 #define IsUnviewable		1
278 #define IsViewable		2
279 #define SetModeInsert           0
280 #define SetModeDelete           1
281 #define DestroyAll              0
282 #define RetainPermanent         1
283 #define RetainTemporary         2
284 #define Above                   0
285 #define Below                   1
286 #define TopIf                   2
287 #define BottomIf                3
288 #define Opposite                4
289 #define RaiseLowest             0
290 #define LowerHighest            1
291 #define PropModeReplace         0
292 #define PropModePrepend         1
293 #define PropModeAppend          2
294 #define	GXclear			0x0		/* 0 */
295 #define GXand			0x1		/* src AND dst */
296 #define GXandReverse		0x2		/* src AND NOT dst */
297 #define GXcopy			0x3		/* src */
298 #define GXandInverted		0x4		/* NOT src AND dst */
299 #define	GXnoop			0x5		/* dst */
300 #define GXxor			0x6		/* src XOR dst */
301 #define GXor			0x7		/* src OR dst */
302 #define GXnor			0x8		/* NOT src AND NOT dst */
303 #define GXequiv			0x9		/* NOT src XOR dst */
304 #define GXinvert		0xa		/* NOT dst */
305 #define GXorReverse		0xb		/* src OR NOT dst */
306 #define GXcopyInverted		0xc		/* NOT src */
307 #define GXorInverted		0xd		/* NOT src OR dst */
308 #define GXnand			0xe		/* NOT src OR NOT dst */
309 #define GXset			0xf		/* 1 */
310 #define LineSolid		0
311 #define LineOnOffDash		1
312 #define LineDoubleDash		2
313 #define CapNotLast		0
314 #define CapButt			1
315 #define CapRound		2
316 #define CapProjecting		3
317 #define JoinMiter		0
318 #define JoinRound		1
319 #define JoinBevel		2
320 #define FillSolid		0
321 #define FillTiled		1
322 #define FillStippled		2
323 #define FillOpaqueStippled	3
324 #define EvenOddRule		0
325 #define WindingRule		1
326 #define ClipByChildren		0
327 #define IncludeInferiors	1
328 #define Unsorted		0
329 #define YSorted			1
330 #define YXSorted		2
331 #define YXBanded		3
332 #define CoordModeOrigin		0	/* relative to the origin */
333 #define CoordModePrevious       1	/* relative to previous point */
334 #define Complex			0	/* paths may intersect */
335 #define Nonconvex		1	/* no paths intersect, but not convex */
336 #define Convex			2	/* wholly convex */
337 #define ArcChord		0	/* join endpoints of arc */
338 #define ArcPieSlice		1	/* join endpoints to center of arc */
339 #define GCFunction              (1L<<0)
340 #define GCPlaneMask             (1L<<1)
341 #define GCForeground            (1L<<2)
342 #define GCBackground            (1L<<3)
343 #define GCLineWidth             (1L<<4)
344 #define GCLineStyle             (1L<<5)
345 #define GCCapStyle              (1L<<6)
346 #define GCJoinStyle		(1L<<7)
347 #define GCFillStyle		(1L<<8)
348 #define GCFillRule		(1L<<9)
349 #define GCTile			(1L<<10)
350 #define GCStipple		(1L<<11)
351 #define GCTileStipXOrigin	(1L<<12)
352 #define GCTileStipYOrigin	(1L<<13)
353 #define GCFont 			(1L<<14)
354 #define GCSubwindowMode		(1L<<15)
355 #define GCGraphicsExposures     (1L<<16)
356 #define GCClipXOrigin		(1L<<17)
357 #define GCClipYOrigin		(1L<<18)
358 #define GCClipMask		(1L<<19)
359 #define GCDashOffset		(1L<<20)
360 #define GCDashList		(1L<<21)
361 #define GCArcMode		(1L<<22)
362 #define GCLastBit		22
363 #define FontLeftToRight		0
364 #define FontRightToLeft		1
365 #define FontChange		255
366 #define XYBitmap		0	/* depth 1, XYFormat */
367 #define XYPixmap		1	/* depth == drawable depth */
368 #define ZPixmap			2	/* depth == drawable depth */
369 #define AllocNone		0	/* create map with no entries */
370 #define AllocAll		1	/* allocate entire map writeable */
371 #define DoRed			(1<<0)
372 #define DoGreen			(1<<1)
373 #define DoBlue			(1<<2)
374 #define CursorShape		0	/* largest size that can be displayed */
375 #define TileShape		1	/* size tiled fastest */
376 #define StippleShape		2	/* size stippled fastest */
377 #define AutoRepeatModeOff	0
378 #define AutoRepeatModeOn	1
379 #define AutoRepeatModeDefault	2
380 #define LedModeOff		0
381 #define LedModeOn		1
382 #define KBKeyClickPercent	(1L<<0)
383 #define KBBellPercent		(1L<<1)
384 #define KBBellPitch		(1L<<2)
385 #define KBBellDuration		(1L<<3)
386 #define KBLed			(1L<<4)
387 #define KBLedMode		(1L<<5)
388 #define KBKey			(1L<<6)
389 #define KBAutoRepeatMode	(1L<<7)
390 #define MappingSuccess     	0
391 #define MappingBusy        	1
392 #define MappingFailed		2
393 #define MappingModifier		0
394 #define MappingKeyboard		1
395 #define MappingPointer		2
396 #define DontPreferBlanking	0
397 #define PreferBlanking		1
398 #define DefaultBlanking		2
399 #define DisableScreenSaver	0
400 #define DisableScreenInterval	0
401 #define DontAllowExposures	0
402 #define AllowExposures		1
403 #define DefaultExposures	2
404 #define ScreenSaverReset 0
405 #define ScreenSaverActive 1
406 #define HostInsert		0
407 #define HostDelete		1
408 #define EnableAccess		1
409 #define DisableAccess		0
410 #define StaticGray		0
411 #define GrayScale		1
412 #define StaticColor		2
413 #define PseudoColor		3
414 #define TrueColor		4
415 #define DirectColor		5
416 #define LSBFirst		0
417 #define MSBFirst		1
418 
419 #define True 1
420 #define False 0
421 
422 #define XK_Alt_L		0xFFE9	/* Left alt */
423 
424 #define XK_BackSpace		0xFF08	/* back space, back char */
425 #define XK_Tab			0xFF09
426 #define XK_Linefeed		0xFF0A	/* Linefeed, LF */
427 #define XK_Clear		0xFF0B
428 #define XK_Return		0xFF0D	/* Return, enter */
429 #define XK_Pause		0xFF13	/* Pause, hold */
430 #define XK_Scroll_Lock		0xFF14
431 #define XK_Sys_Req		0xFF15
432 #define XK_Escape		0xFF1B
433 #define XK_Delete		0xFFFF	/* Delete, rubout */
434 
435 #define XK_Home			0xFF50
436 #define XK_Left			0xFF51	/* Move left, left arrow */
437 #define XK_Up			0xFF52	/* Move up, up arrow */
438 #define XK_Right		0xFF53	/* Move right, right arrow */
439 #define XK_Down			0xFF54	/* Move down, down arrow */
440 #define XK_Prior		0xFF55	/* Prior, previous */
441 #define XK_Page_Up		0xFF55
442 #define XK_Next			0xFF56	/* Next */
443 #define XK_Page_Down		0xFF56
444 #define XK_End			0xFF57	/* EOL */
445 #define XK_Begin		0xFF58	/* BOL */
446 
447 #define XK_Select		0xFF60	/* Select, mark */
448 #define XK_Print		0xFF61
449 #define XK_Execute		0xFF62	/* Execute, run, do */
450 #define XK_Insert		0xFF63	/* Insert, insert here */
451 #define XK_Undo			0xFF65	/* Undo, oops */
452 #define XK_Redo			0xFF66	/* redo, again */
453 #define XK_Menu			0xFF67
454 #define XK_Find			0xFF68	/* Find, search */
455 #define XK_Cancel		0xFF69	/* Cancel, stop, abort, exit */
456 #define XK_Help			0xFF6A	/* Help */
457 #define XK_Break		0xFF6B
458 #define XK_Mode_switch		0xFF7E	/* Character set switch */
459 #define XK_script_switch        0xFF7E  /* Alias for mode_switch */
460 #define XK_Num_Lock		0xFF7F
461 
462 #define XK_F1			0xFFBE
463 #define XK_F2			0xFFBF
464 #define XK_F3			0xFFC0
465 #define XK_F4			0xFFC1
466 #define XK_F5			0xFFC2
467 #define XK_F6			0xFFC3
468 #define XK_F7			0xFFC4
469 #define XK_F8			0xFFC5
470 #define XK_F9			0xFFC6
471 #define XK_F10			0xFFC7
472 #define XK_F11			0xFFC8
473 #define XK_L1			0xFFC8
474 #define XK_F12			0xFFC9
475 
476 #define VisualNoMask		0x0
477 #define VisualIDMask 		0x1
478 #define VisualScreenMask	0x2
479 #define VisualDepthMask		0x4
480 #define VisualClassMask		0x8
481 #define VisualRedMaskMask	0x10
482 #define VisualGreenMaskMask	0x20
483 #define VisualBlueMaskMask	0x40
484 #define VisualColormapSizeMask	0x80
485 #define VisualBitsPerRGBMask	0x100
486 #define VisualAllMask		0x1FF
487 
488 #define USPosition	(1L << 0) /* user specified x, y */
489 #define USSize		(1L << 1) /* user specified width, height */
490 
491 #define PPosition	(1L << 2) /* program specified position */
492 #define PSize		(1L << 3) /* program specified size */
493 #define PMinSize	(1L << 4) /* program specified minimum size */
494 #define PMaxSize	(1L << 5) /* program specified maximum size */
495 #define PResizeInc	(1L << 6) /* program specified resize increments */
496 #define PAspect		(1L << 7) /* program specified min and max aspect ratios */
497 #define PBaseSize	(1L << 8) /* program specified base for incrementing */
498 #define PWinGravity	(1L << 9) /* program specified window gravity */
499 
500 #define NoValue		0x0000
501 #define XValue  	0x0001
502 #define YValue		0x0002
503 #define WidthValue  	0x0004
504 #define HeightValue  	0x0008
505 #define AllValues 	0x000F
506 #define XNegative 	0x0010
507 #define YNegative 	0x0020
508 
509 #define XNoMemory -1
510 #define XLocaleNotSupported -2
511 #define XConverterNotFound -3
512 
513 #define LC_CTYPE 2
514 
515 /* used by xvt/src/main.c */
516 #define NormalState 1
517 #define IconicState 3
518 #define InputHint (1L << 0)
519 #define StateHint (1L << 1)
520 #define WindowGroupHint (1L << 6)
521 #define XC_left_ptr 68
522 #define XC_xterm 152
523 
524 typedef struct _XRegion *Region;
525 typedef struct _XOC *XOC, *XFontSet;
526 
527 typedef struct _XExtData {
528 	int number;		/* number returned by XRegisterExtension */
529 	struct _XExtData *next;	/* next item on list of data for structure */
530 	int (*free_private)(	/* called to free private storage */
531 	struct _XExtData *extension
532 	);
533 	XPointer private_data;	/* data private to this extension. */
534 } XExtData;
535 
536 typedef struct {		/* public to extension, cannot be changed */
537 	int extension;		/* extension number */
538 	int major_opcode;	/* major op-code assigned by server */
539 	int first_event;	/* first event number for the extension */
540 	int first_error;	/* first error number for the extension */
541 } XExtCodes;
542 
543 typedef struct {
544 	XExtData *ext_data;	/* hook for extension to hang data */
545 	VisualID visualid;	/* visual id of this visual */
546 #if defined(__cplusplus) || defined(c_plusplus)
547 	int c_class;		/* C++ class of screen (monochrome, etc.) */
548 #else
549 	int class;		/* class of screen (monochrome, etc.) */
550 #endif
551 	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
552 	int bits_per_rgb;	/* log base 2 of distinct color values */
553 	int map_entries;	/* color map entries */
554 } Visual;
555 
556 typedef struct {
557 	int depth;		/* this depth (Z) of the depth */
558 	int nvisuals;		/* number of Visual types at this depth */
559 	Visual *visuals;	/* list of visuals possible at this depth */
560 } Depth;
561 
562 typedef struct {
563 	int function;		/* logical operation */
564 	unsigned long plane_mask;/* plane mask */
565 	unsigned long foreground;/* foreground pixel */
566 	unsigned long background;/* background pixel */
567 	int line_width;		/* line width */
568 	int line_style;	 	/* LineSolid, LineOnOffDash, LineDoubleDash */
569 	int cap_style;	  	/* CapNotLast, CapButt,
570 				   CapRound, CapProjecting */
571 	int join_style;	 	/* JoinMiter, JoinRound, JoinBevel */
572 	int fill_style;	 	/* FillSolid, FillTiled,
573 				   FillStippled, FillOpaeueStippled */
574 	int fill_rule;	  	/* EvenOddRule, WindingRule */
575 	int arc_mode;		/* ArcChord, ArcPieSlice */
576 	Pixmap tile;		/* tile pixmap for tiling operations */
577 	Pixmap stipple;		/* stipple 1 plane pixmap for stipping */
578 	int ts_x_origin;	/* offset for tile or stipple operations */
579 	int ts_y_origin;
580         Font font;	        /* default text font for text operations */
581 	int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
582 	BoolDef graphics_exposures;/* boolean, should exposures be generated */
583 	int clip_x_origin;	/* origin for clipping */
584 	int clip_y_origin;
585 	Pixmap clip_mask;	/* bitmap clipping; other calls for rects */
586 	int dash_offset;	/* patterned/dashed line information */
587 	char dashes;
588 } XGCValues;
589 
590 typedef struct _XGC
591 {
592     XExtData *ext_data;	/* hook for extension to hang data */
593     GContext gid;	/* protocol ID for graphics context */
594 	int rects;
595 	int dashes;
596 	XGCValues values;
597 	int dirty;
598 } *GC;
599 
600 typedef struct {
601 	XExtData *ext_data;	/* hook for extension to hang data */
602 	struct _XDisplay *display;/* back pointer to display structure */
603 	Window root;		/* Root window id. */
604 	int width, height;	/* width and height of screen */
605 	int mwidth, mheight;	/* width and height of  in millimeters */
606 	int ndepths;		/* number of depths possible */
607 	Depth *depths;		/* list of allowable depths on the screen */
608 	int root_depth;		/* bits per pixel */
609 	Visual *root_visual;	/* root visual */
610 	GC default_gc;		/* GC for the root root visual */
611 	Colormap cmap;		/* default color map */
612 	unsigned long white_pixel;
613 	unsigned long black_pixel;	/* White and Black pixel values */
614 	int max_maps, min_maps;	/* max and min color maps */
615 	int backing_store;	/* Never, WhenMapped, Always */
616 	BoolDef save_unders;
617 	long root_input_mask;	/* initial root input mask */
618 } Screen;
619 
620 typedef struct {
621 	XExtData *ext_data;	/* hook for extension to hang data */
622 	int depth;		/* depth of this image format */
623 	int bits_per_pixel;	/* bits/pixel at this depth */
624 	int scanline_pad;	/* scanline must padded to this multiple */
625 } ScreenFormat;
626 
627 typedef struct _XDisplay
628 {
629 	XExtData *ext_data;	/* hook for extension to hang data */
630 	struct _XPrivate *private1;
631 	int fd;			/* Network socket. */
632 	int private2;
633 	int proto_major_version;/* major version of server's X protocol */
634 	int proto_minor_version;/* minor version of servers X protocol */
635 	char *vendor;		/* vendor of the server hardware */
636 	XID private3;
637 	XID private4;
638 	XID private5;
639 	int private6;
640 	XID (*resource_alloc)(	/* allocator function */
641 		struct _XDisplay*
642 	);
643 	int byte_order;		/* screen byte order, LSBFirst, MSBFirst */
644 	int bitmap_unit;	/* padding and data requirements */
645 	int bitmap_pad;		/* padding requirements on bitmaps */
646 	int bitmap_bit_order;	/* LeastSignificant or MostSignificant */
647 	int nformats;		/* number of pixmap formats in list */
648 	ScreenFormat *pixmap_format;	/* pixmap format list */
649 	int private8;
650 	int release;		/* release of the server */
651 	struct _XPrivate *private9, *private10;
652 	int qlen;		/* Length of input event queue */
653 	unsigned long last_request_read; /* seq number of last event read */
654 	unsigned long request;	/* sequence number of last request. */
655 	XPointer private11;
656 	XPointer private12;
657 	XPointer private13;
658 	XPointer private14;
659 	unsigned max_request_size; /* maximum number 32 bit words in request*/
660 	struct _XrmHashBucketRec *db;
661 	int (*private15)(
662 		struct _XDisplay*
663 		);
664 	char *display_name;	/* "host:display" string used on this connect*/
665 	int default_screen;	/* default screen for operations */
666 	int nscreens;		/* number of screens on this server*/
667 	Screen *screens;	/* pointer to list of screens */
668 	unsigned long motion_buffer;	/* size of motion buffer */
669 	unsigned long private16;
670 	int min_keycode;	/* minimum defined keycode */
671 	int max_keycode;	/* maximum defined keycode */
672 	XPointer private17;
673 	XPointer private18;
674 	int private19;
675 	char *xdefaults;	/* contents of defaults from server */
676 	/* there is more to this structure, but it is private to Xlib */
677 }
678 Display, *_XPrivDisplay;
679 
680 typedef int StatusDef;
681 
682 typedef struct {		/* normal 16 bit characters are two bytes */
683     unsigned char byte1;
684     unsigned char byte2;
685 } XChar2b;
686 
687 typedef struct {
688     short	lbearing;	/* origin to left edge of raster */
689     short	rbearing;	/* origin to right edge of raster */
690     short	width;		/* advance to next char's origin */
691     short	ascent;		/* baseline to top edge of raster */
692     short	descent;	/* baseline to bottom edge of raster */
693     unsigned short attributes;	/* per char flags (not predefined) */
694 } XCharStruct;
695 
696 typedef struct {
697 	char *res_name;
698 	char *res_class;
699 } XClassHint;
700 
701 typedef struct {
702 	unsigned long pixel;
703 	unsigned short red, green, blue;
704 	char flags;  /* do_red, do_green, do_blue */
705 	char pad;
706 } XColor;
707 
708 typedef struct _XComposeStatus {
709     XPointer compose_ptr;	/* state table pointer */
710     int chars_matched;		/* match state */
711 } XComposeStatus;
712 
713 /* events --- goes on for a bit */
714 typedef struct {
715 	int type;		/* of event */
716 	unsigned long serial;	/* # of last request processed by server */
717 	BoolDef send_event;	/* true if this came from a SendEvent request */
718 	Display *display;	/* Display the event was read from */
719 	Window window;	        /* "event" window it is reported relative to */
720 	Window root;	        /* root window that the event occurred on */
721 	Window subwindow;	/* child window */
722 	Time time;		/* milliseconds */
723 	int x, y;		/* pointer x, y coordinates in event window */
724 	int x_root, y_root;	/* coordinates relative to root */
725 	unsigned int state;	/* key or button mask */
726 	unsigned int keycode;	/* detail */
727 	BoolDef same_screen;	/* same screen flag */
728 } XKeyEvent;
729 
730 typedef XKeyEvent XKeyPressedEvent;
731 typedef XKeyEvent XKeyReleasedEvent;
732 
733 typedef struct {
734 	int type;		/* of event */
735 	unsigned long serial;	/* # of last request processed by server */
736 	BoolDef send_event;	/* true if this came from a SendEvent request */
737 	Display *display;	/* Display the event was read from */
738 	Window window;	        /* "event" window it is reported relative to */
739 	Window root;	        /* root window that the event occurred on */
740 	Window subwindow;	/* child window */
741 	Time time;		/* milliseconds */
742 	int x, y;		/* pointer x, y coordinates in event window */
743 	int x_root, y_root;	/* coordinates relative to root */
744 	unsigned int state;	/* key or button mask */
745 	unsigned int button;	/* detail */
746 	BoolDef same_screen;	/* same screen flag */
747 } XButtonEvent;
748 typedef XButtonEvent XButtonPressedEvent;
749 typedef XButtonEvent XButtonReleasedEvent;
750 
751 typedef struct {
752 	int type;		/* of event */
753 	unsigned long serial;	/* # of last request processed by server */
754 	BoolDef send_event;	/* true if this came from a SendEvent request */
755 	Display *display;	/* Display the event was read from */
756 	Window window;	        /* "event" window reported relative to */
757 	Window root;	        /* root window that the event occurred on */
758 	Window subwindow;	/* child window */
759 	Time time;		/* milliseconds */
760 	int x, y;		/* pointer x, y coordinates in event window */
761 	int x_root, y_root;	/* coordinates relative to root */
762 	unsigned int state;	/* key or button mask */
763 	char is_hint;		/* detail */
764 	BoolDef same_screen;	/* same screen flag */
765 } XMotionEvent;
766 typedef XMotionEvent XPointerMovedEvent;
767 
768 typedef struct {
769 	int type;		/* of event */
770 	unsigned long serial;	/* # of last request processed by server */
771 	BoolDef send_event;	/* true if this came from a SendEvent request */
772 	Display *display;	/* Display the event was read from */
773 	Window window;	        /* "event" window reported relative to */
774 	Window root;	        /* root window that the event occurred on */
775 	Window subwindow;	/* child window */
776 	Time time;		/* milliseconds */
777 	int x, y;		/* pointer x, y coordinates in event window */
778 	int x_root, y_root;	/* coordinates relative to root */
779 	int mode;		/* NotifyNormal, NotifyGrab, NotifyUngrab */
780 	int detail;
781 	/*
782 	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
783 	 * NotifyNonlinear,NotifyNonlinearVirtual
784 	 */
785 	BoolDef same_screen;	/* same screen flag */
786 	BoolDef focus;		/* boolean focus */
787 	unsigned int state;	/* key or button mask */
788 } XCrossingEvent;
789 typedef XCrossingEvent XEnterWindowEvent;
790 typedef XCrossingEvent XLeaveWindowEvent;
791 
792 typedef struct {
793 	int type;		/* FocusIn or FocusOut */
794 	unsigned long serial;	/* # of last request processed by server */
795 	BoolDef send_event;	/* true if this came from a SendEvent request */
796 	Display *display;	/* Display the event was read from */
797 	Window window;		/* window of event */
798 	int mode;		/* NotifyNormal, NotifyGrab, NotifyUngrab */
799 	int detail;
800 	/*
801 	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
802 	 * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
803 	 * NotifyPointerRoot, NotifyDetailNone
804 	 */
805 } XFocusChangeEvent;
806 typedef XFocusChangeEvent XFocusInEvent;
807 typedef XFocusChangeEvent XFocusOutEvent;
808 
809 /* generated on EnterWindow and FocusIn  when KeyMapState selected */
810 typedef struct {
811 	int type;
812 	unsigned long serial;	/* # of last request processed by server */
813 	BoolDef send_event;	/* true if this came from a SendEvent request */
814 	Display *display;	/* Display the event was read from */
815 	Window window;
816 	char key_vector[32];
817 } XKeymapEvent;
818 
819 typedef struct {
820 	int type;
821 	unsigned long serial;	/* # of last request processed by server */
822 	BoolDef send_event;	/* true if this came from a SendEvent request */
823 	Display *display;	/* Display the event was read from */
824 	Window window;
825 	int x, y;
826 	int width, height;
827 	int count;		/* if non-zero, at least this many more */
828 } XExposeEvent;
829 
830 typedef struct {
831 	int type;
832 	unsigned long serial;	/* # of last request processed by server */
833 	BoolDef send_event;	/* true if this came from a SendEvent request */
834 	Display *display;	/* Display the event was read from */
835 	Drawable drawable;
836 	int x, y;
837 	int width, height;
838 	int count;		/* if non-zero, at least this many more */
839 	int major_code;		/* core is CopyArea or CopyPlane */
840 	int minor_code;		/* not defined in the core */
841 } XGraphicsExposeEvent;
842 
843 typedef struct {
844 	int type;
845 	unsigned long serial;	/* # of last request processed by server */
846 	BoolDef send_event;	/* true if this came from a SendEvent request */
847 	Display *display;	/* Display the event was read from */
848 	Drawable drawable;
849 	int major_code;		/* core is CopyArea or CopyPlane */
850 	int minor_code;		/* not defined in the core */
851 } XNoExposeEvent;
852 
853 typedef struct {
854 	int type;
855 	unsigned long serial;	/* # of last request processed by server */
856 	BoolDef send_event;	/* true if this came from a SendEvent request */
857 	Display *display;	/* Display the event was read from */
858 	Window window;
859 	int state;		/* Visibility state */
860 } XVisibilityEvent;
861 
862 typedef struct {
863 	int type;
864 	unsigned long serial;	/* # of last request processed by server */
865 	BoolDef send_event;	/* true if this came from a SendEvent request */
866 	Display *display;	/* Display the event was read from */
867 	Window parent;		/* parent of the window */
868 	Window window;		/* window id of window created */
869 	int x, y;		/* window location */
870 	int width, height;	/* size of window */
871 	int border_width;	/* border width */
872 	BoolDef override_redirect;	/* creation should be overridden */
873 } XCreateWindowEvent;
874 
875 typedef struct {
876 	int type;
877 	unsigned long serial;	/* # of last request processed by server */
878 	BoolDef send_event;	/* true if this came from a SendEvent request */
879 	Display *display;	/* Display the event was read from */
880 	Window event;
881 	Window window;
882 } XDestroyWindowEvent;
883 
884 typedef struct {
885 	int type;
886 	unsigned long serial;	/* # of last request processed by server */
887 	BoolDef send_event;	/* true if this came from a SendEvent request */
888 	Display *display;	/* Display the event was read from */
889 	Window event;
890 	Window window;
891 	BoolDef from_configure;
892 } XUnmapEvent;
893 
894 typedef struct {
895 	int type;
896 	unsigned long serial;	/* # of last request processed by server */
897 	BoolDef send_event;	/* true if this came from a SendEvent request */
898 	Display *display;	/* Display the event was read from */
899 	Window event;
900 	Window window;
901 	BoolDef override_redirect;	/* boolean, is override set... */
902 } XMapEvent;
903 
904 typedef struct {
905 	int type;
906 	unsigned long serial;	/* # of last request processed by server */
907 	BoolDef send_event;	/* true if this came from a SendEvent request */
908 	Display *display;	/* Display the event was read from */
909 	Window parent;
910 	Window window;
911 } XMapRequestEvent;
912 
913 typedef struct {
914 	int type;
915 	unsigned long serial;	/* # of last request processed by server */
916 	BoolDef send_event;	/* true if this came from a SendEvent request */
917 	Display *display;	/* Display the event was read from */
918 	Window event;
919 	Window window;
920 	Window parent;
921 	int x, y;
922 	BoolDef override_redirect;
923 } XReparentEvent;
924 
925 typedef struct {
926 	int type;
927 	unsigned long serial;	/* # of last request processed by server */
928 	BoolDef send_event;	/* true if this came from a SendEvent request */
929 	Display *display;	/* Display the event was read from */
930 	Window event;
931 	Window window;
932 	int x, y;
933 	int width, height;
934 	int border_width;
935 	Window above;
936 	BoolDef override_redirect;
937 } XConfigureEvent;
938 
939 typedef struct {
940 	int type;
941 	unsigned long serial;	/* # of last request processed by server */
942 	BoolDef send_event;	/* true if this came from a SendEvent request */
943 	Display *display;	/* Display the event was read from */
944 	Window event;
945 	Window window;
946 	int x, y;
947 } XGravityEvent;
948 
949 typedef struct {
950 	int type;
951 	unsigned long serial;	/* # of last request processed by server */
952 	BoolDef send_event;	/* true if this came from a SendEvent request */
953 	Display *display;	/* Display the event was read from */
954 	Window window;
955 	int width, height;
956 } XResizeRequestEvent;
957 
958 typedef struct {
959 	int type;
960 	unsigned long serial;	/* # of last request processed by server */
961 	BoolDef send_event;	/* true if this came from a SendEvent request */
962 	Display *display;	/* Display the event was read from */
963 	Window parent;
964 	Window window;
965 	int x, y;
966 	int width, height;
967 	int border_width;
968 	Window above;
969 	int detail;		/* Above, Below, TopIf, BottomIf, Opposite */
970 	unsigned long value_mask;
971 } XConfigureRequestEvent;
972 
973 typedef struct {
974 	int type;
975 	unsigned long serial;	/* # of last request processed by server */
976 	BoolDef send_event;	/* true if this came from a SendEvent request */
977 	Display *display;	/* Display the event was read from */
978 	Window event;
979 	Window window;
980 	int place;		/* PlaceOnTop, PlaceOnBottom */
981 } XCirculateEvent;
982 
983 typedef struct {
984 	int type;
985 	unsigned long serial;	/* # of last request processed by server */
986 	BoolDef send_event;	/* true if this came from a SendEvent request */
987 	Display *display;	/* Display the event was read from */
988 	Window parent;
989 	Window window;
990 	int place;		/* PlaceOnTop, PlaceOnBottom */
991 } XCirculateRequestEvent;
992 
993 typedef struct {
994 	int type;
995 	unsigned long serial;	/* # of last request processed by server */
996 	BoolDef send_event;	/* true if this came from a SendEvent request */
997 	Display *display;	/* Display the event was read from */
998 	Window window;
999 	Atom atom;
1000 	Time time;
1001 	int state;		/* NewValue, Deleted */
1002 } XPropertyEvent;
1003 
1004 typedef struct {
1005 	int type;
1006 	unsigned long serial;	/* # of last request processed by server */
1007 	BoolDef send_event;	/* true if this came from a SendEvent request */
1008 	Display *display;	/* Display the event was read from */
1009 	Window window;
1010 	Atom selection;
1011 	Time time;
1012 } XSelectionClearEvent;
1013 
1014 typedef struct {
1015 	int type;
1016 	unsigned long serial;	/* # of last request processed by server */
1017 	BoolDef send_event;	/* true if this came from a SendEvent request */
1018 	Display *display;	/* Display the event was read from */
1019 	Window owner;
1020 	Window requestor;
1021 	Atom selection;
1022 	Atom target;
1023 	Atom property;
1024 	Time time;
1025 } XSelectionRequestEvent;
1026 
1027 typedef struct {
1028 	int type;
1029 	unsigned long serial;	/* # of last request processed by server */
1030 	BoolDef send_event;	/* true if this came from a SendEvent request */
1031 	Display *display;	/* Display the event was read from */
1032 	Window requestor;
1033 	Atom selection;
1034 	Atom target;
1035 	Atom property;		/* ATOM or None */
1036 	Time time;
1037 } XSelectionEvent;
1038 
1039 typedef struct {
1040 	int type;
1041 	unsigned long serial;	/* # of last request processed by server */
1042 	BoolDef send_event;	/* true if this came from a SendEvent request */
1043 	Display *display;	/* Display the event was read from */
1044 	Window window;
1045 	Colormap colormap;	/* COLORMAP or None */
1046 #if defined(__cplusplus) || defined(c_plusplus)
1047 	BoolDef c_new;		/* C++ */
1048 #else
1049 	BoolDef new;
1050 #endif
1051 	int state;		/* ColormapInstalled, ColormapUninstalled */
1052 } XColormapEvent;
1053 
1054 typedef struct {
1055 	int type;
1056 	unsigned long serial;	/* # of last request processed by server */
1057 	BoolDef send_event;	/* true if this came from a SendEvent request */
1058 	Display *display;	/* Display the event was read from */
1059 	Window window;
1060 	Atom message_type;
1061 	int format;
1062 	union {
1063 		char b[20];
1064 		short s[10];
1065 		long l[5];
1066 		} data;
1067 } XClientMessageEvent;
1068 
1069 typedef struct {
1070 	int type;
1071 	unsigned long serial;	/* # of last request processed by server */
1072 	BoolDef send_event;	/* true if this came from a SendEvent request */
1073 	Display *display;	/* Display the event was read from */
1074 	Window window;		/* unused */
1075 	int request;		/* one of MappingModifier, MappingKeyboard,
1076 				   MappingPointer */
1077 	int first_keycode;	/* first keycode */
1078 	int count;		/* defines range of change w. first_keycode*/
1079 } XMappingEvent;
1080 
1081 typedef struct {
1082 	int type;
1083 	Display *display;	/* Display the event was read from */
1084 	XID resourceid;		/* resource id */
1085 	unsigned long serial;	/* serial number of failed request */
1086 	unsigned char error_code;	/* error code of failed request */
1087 	unsigned char request_code;	/* Major op-code of failed request */
1088 	unsigned char minor_code;	/* Minor op-code of failed request */
1089 } XErrorEvent;
1090 
1091 typedef struct {
1092 	int type;
1093 	unsigned long serial;	/* # of last request processed by server */
1094 	BoolDef send_event;	/* true if this came from a SendEvent request */
1095 	Display *display;/* Display the event was read from */
1096 	Window window;	/* window on which event was requested in event mask */
1097 } XAnyEvent;
1098 
1099 /*
1100  * this union is defined so Xlib can always use the same sized
1101  * event structure internally, to avoid memory fragmentation.
1102  */
1103 typedef union _XEvent {
1104         int type;		/* must not be changed; first element */
1105 	XAnyEvent xany;
1106 	XKeyEvent xkey;
1107 	XButtonEvent xbutton;
1108 	XMotionEvent xmotion;
1109 	XCrossingEvent xcrossing;
1110 	XFocusChangeEvent xfocus;
1111 	XExposeEvent xexpose;
1112 	XGraphicsExposeEvent xgraphicsexpose;
1113 	XNoExposeEvent xnoexpose;
1114 	XVisibilityEvent xvisibility;
1115 	XCreateWindowEvent xcreatewindow;
1116 	XDestroyWindowEvent xdestroywindow;
1117 	XUnmapEvent xunmap;
1118 	XMapEvent xmap;
1119 	XMapRequestEvent xmaprequest;
1120 	XReparentEvent xreparent;
1121 	XConfigureEvent xconfigure;
1122 	XGravityEvent xgravity;
1123 	XResizeRequestEvent xresizerequest;
1124 	XConfigureRequestEvent xconfigurerequest;
1125 	XCirculateEvent xcirculate;
1126 	XCirculateRequestEvent xcirculaterequest;
1127 	XPropertyEvent xproperty;
1128 	XSelectionClearEvent xselectionclear;
1129 	XSelectionRequestEvent xselectionrequest;
1130 	XSelectionEvent xselection;
1131 	XColormapEvent xcolormap;
1132 	XClientMessageEvent xclient;
1133 	XMappingEvent xmapping;
1134 	XErrorEvent xerror;
1135 	XKeymapEvent xkeymap;
1136 	long pad[24];
1137 } XEvent;
1138 
1139 typedef int (*XErrorHandler) (	    /* WARNING, this type not in Xlib spec */
1140     Display*		/* display */,
1141     XErrorEvent*	/* error_event */
1142 );
1143 
1144 
1145 typedef struct {
1146     Atom name;
1147     unsigned long card32;
1148 } XFontProp;
1149 
1150 typedef struct {
1151     XExtData	*ext_data;	/* hook for extension to hang data */
1152     Font        fid;            /* Font id for this font */
1153     unsigned	direction;	/* hint about direction the font is painted */
1154     unsigned	min_char_or_byte2;/* first character */
1155     unsigned	max_char_or_byte2;/* last character */
1156     unsigned	min_byte1;	/* first row that exists */
1157     unsigned	max_byte1;	/* last row that exists */
1158     BoolDef all_chars_exist;/* flag if all characters have non-zero size*/
1159     unsigned	default_char;	/* char to print for undefined character */
1160     int         n_properties;   /* how many properties there are */
1161     XFontProp	*properties;	/* pointer to array of additional properties*/
1162     XCharStruct	min_bounds;	/* minimum bounds over all existing char*/
1163     XCharStruct	max_bounds;	/* maximum bounds over all existing char*/
1164     XCharStruct	*per_char;	/* first_char to last_char information */
1165     int		ascent;		/* log. extent above baseline for spacing */
1166     int		descent;	/* log. descent below baseline for spacing */
1167 } XFontStruct;
1168 
1169 typedef enum {
1170     XStringStyle,		/* STRING */
1171     XCompoundTextStyle,		/* COMPOUND_TEXT */
1172     XTextStyle,			/* text in owner's encoding (current locale)*/
1173     XStdICCTextStyle,		/* STRING, else COMPOUND_TEXT */
1174     XUTF8StringStyle		/* UTF8_STRING */
1175 } XICCEncodingStyle;
1176 
1177 typedef struct _XIM *XIM;
1178 typedef struct _XIC *XIC;
1179 
1180 /*
1181  * Data structure for "image" data, used by image manipulation routines.
1182  */
1183 typedef struct _XImage {
1184     int width, height;		/* size of image */
1185     int xoffset;		/* number of pixels offset in X direction */
1186     int format;			/* XYBitmap, XYPixmap, ZPixmap */
1187     char *data;			/* pointer to image data */
1188     int byte_order;		/* data byte order, LSBFirst, MSBFirst */
1189     int bitmap_unit;		/* quant. of scanline 8, 16, 32 */
1190     int bitmap_bit_order;	/* LSBFirst, MSBFirst */
1191     int bitmap_pad;		/* 8, 16, 32 either XY or ZPixmap */
1192     int depth;			/* depth of image */
1193     int bytes_per_line;		/* accelarator to next line */
1194     int bits_per_pixel;		/* bits per pixel (ZPixmap) */
1195     unsigned long red_mask;	/* bits in z arrangment */
1196     unsigned long green_mask;
1197     unsigned long blue_mask;
1198     XPointer obdata;		/* hook for the object routines to hang on */
1199     struct funcs {		/* image manipulation routines */
1200 	struct _XImage *(*create_image)(
1201 		struct _XDisplay* /* display */,
1202 		Visual*		/* visual */,
1203 		unsigned int	/* depth */,
1204 		int		/* format */,
1205 		int		/* offset */,
1206 		char*		/* data */,
1207 		unsigned int	/* width */,
1208 		unsigned int	/* height */,
1209 		int		/* bitmap_pad */,
1210 		int		/* bytes_per_line */);
1211 	int (*destroy_image)        (struct _XImage *);
1212 	unsigned long (*get_pixel)  (struct _XImage *, int, int);
1213 	int (*put_pixel)            (struct _XImage *, int, int, unsigned long);
1214 	struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
1215 	int (*add_pixel)            (struct _XImage *, long);
1216 	} f;
1217 } XImage;
1218 
1219 typedef struct {
1220  	int max_keypermod;	/* The server's max # of keys per modifier */
1221  	KeyCode *modifiermap;	/* An 8 by max_keypermod array of modifiers */
1222 } XModifierKeymap;
1223 
1224 typedef struct {
1225     short x, y;
1226 } XPoint;
1227 
1228 typedef struct {
1229     short x, y;
1230     unsigned short width, height;
1231 } XRectangle;
1232 
1233 typedef struct {
1234     short x1, y1, x2, y2;
1235 } XSegment;
1236 
1237 typedef struct {
1238     Pixmap background_pixmap;	/* background or None or ParentRelative */
1239     unsigned long background_pixel;	/* background pixel */
1240     Pixmap border_pixmap;	/* border of the window */
1241     unsigned long border_pixel;	/* border pixel value */
1242     int bit_gravity;		/* one of bit gravity values */
1243     int win_gravity;		/* one of the window gravity values */
1244     int backing_store;		/* NotUseful, WhenMapped, Always */
1245     unsigned long backing_planes;/* planes to be preseved if possible */
1246     unsigned long backing_pixel;/* value to use in restoring planes */
1247     BoolDef save_under;		/* should bits under be saved? (popups) */
1248     long event_mask;		/* set of events that should be saved */
1249     long do_not_propagate_mask;	/* set of events that should not propagate */
1250     BoolDef override_redirect;	/* boolean value for override-redirect */
1251     Colormap colormap;		/* color map to be associated with window */
1252     Cursor cursor;		/* cursor to be displayed (or None) */
1253 } XSetWindowAttributes;
1254 
1255 typedef struct {
1256 	long flags;	/* marks which fields in this structure are defined */
1257 	int x, y;		/* obsolete for new window mgrs, but clients */
1258 	int width, height;	/* should set so old wm's don't mess up */
1259 	int min_width, min_height;
1260 	int max_width, max_height;
1261     	int width_inc, height_inc;
1262 	struct {
1263 		int x;	/* numerator */
1264 		int y;	/* denominator */
1265 	} min_aspect, max_aspect;
1266 	int base_width, base_height;		/* added by ICCCM version 1 */
1267 	int win_gravity;			/* added by ICCCM version 1 */
1268 } XSizeHints;
1269 
1270 typedef struct {
1271 	Colormap colormap;
1272 	unsigned long red_max;
1273 	unsigned long red_mult;
1274 	unsigned long green_max;
1275 	unsigned long green_mult;
1276 	unsigned long blue_max;
1277 	unsigned long blue_mult;
1278 	unsigned long base_pixel;
1279 	VisualID visualid;		/* added by ICCCM version 1 */
1280 	XID killid;			/* added by ICCCM version 1 */
1281 } XStandardColormap;
1282 
1283 typedef struct {
1284     unsigned char *value;		/* same as Property routines */
1285     Atom encoding;			/* prop type */
1286     int format;				/* prop data format: 8, 16, or 32 */
1287     unsigned long nitems;		/* number of data items in value */
1288 } XTextProperty;
1289 
1290 typedef struct {
1291   Visual *visual;
1292   VisualID visualid;
1293   int screen;
1294   int depth;
1295 #if defined(__cplusplus) || defined(c_plusplus)
1296   int c_class;					/* C++ */
1297 #else
1298   int class;
1299 #endif
1300   unsigned long red_mask;
1301   unsigned long green_mask;
1302   unsigned long blue_mask;
1303   int colormap_size;
1304   int bits_per_rgb;
1305 } XVisualInfo;
1306 
1307 typedef struct {
1308 	long flags;	/* marks which fields in this structure are defined */
1309 	BoolDef input;	/* does this application rely on the window manager to
1310 			get keyboard input? */
1311 	int initial_state;	/* see below */
1312 	Pixmap icon_pixmap;	/* pixmap to be used as icon */
1313 	Window icon_window; 	/* window to be used as icon */
1314 	int icon_x, icon_y; 	/* initial position of icon */
1315 	Pixmap icon_mask;	/* icon mask bitmap */
1316 	XID window_group;	/* id of related window group */
1317 	/* this structure may be extended in the future */
1318 } XWMHints;
1319 
1320 typedef struct {
1321     int x, y;			/* location of window */
1322     int width, height;		/* width and height of window */
1323     int border_width;		/* border width of window */
1324     int depth;          	/* depth of window */
1325     Visual *visual;		/* the associated visual structure */
1326     Window root;        	/* root of screen containing window */
1327 #if defined(__cplusplus) || defined(c_plusplus)
1328     int c_class;		/* C++ InputOutput, InputOnly*/
1329 #else
1330     int class;			/* InputOutput, InputOnly*/
1331 #endif
1332     int bit_gravity;		/* one of bit gravity values */
1333     int win_gravity;		/* one of the window gravity values */
1334     int backing_store;		/* NotUseful, WhenMapped, Always */
1335     unsigned long backing_planes;/* planes to be preserved if possible */
1336     unsigned long backing_pixel;/* value to be used when restoring planes */
1337     BoolDef save_under;		/* boolean, should bits under be saved? */
1338     Colormap colormap;		/* color map to be associated with window */
1339     BoolDef map_installed;		/* boolean, is color map currently installed*/
1340     int map_state;		/* IsUnmapped, IsUnviewable, IsViewable */
1341     long all_event_masks;	/* set of events all people have interest in*/
1342     long your_event_mask;	/* my event mask */
1343     long do_not_propagate_mask; /* set of events that should not propagate */
1344     BoolDef override_redirect;	/* boolean value for override-redirect */
1345     Screen *screen;		/* back pointer to correct screen */
1346 } XWindowAttributes;
1347 
1348 struct _XrmHashBucketRec;
1349 
1350 /* needed for xdefaults.c */
1351 typedef struct _XrmHashBucketRec *XrmDatabase;
1352 typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
1353 typedef int       XrmQuark, *XrmQuarkList;
1354 #define NULLQUARK ((XrmQuark) 0)
1355 typedef XrmQuark     XrmRepresentation;
1356 typedef struct {
1357     unsigned int    size;
1358     XPointer	    addr;
1359 } XrmValue, *XrmValuePtr;
1360 
1361 /* extend for defining an event callback */
1362 #define USING_W11LIB
1363 typedef void (proto_W11EventHandler)(XEvent *ev);
1364 void W11AddEventHandler(Display *display, proto_W11EventHandler *ev);
1365 
1366 /* functions */
1367 
1368 Display *XOpenDisplay(const char *name);
1369 
1370 int XCloseDisplay(Display *display);
1371 
1372 char *XDisplayString(Display *display);
1373 
1374 int XSync(Display *display,int discard);
1375 
1376 int XFlush(Display *display);
1377 
1378 XVisualInfo *XGetVisualInfo(
1379 			    Display *display,
1380 			    long vinm,
1381 			    XVisualInfo *vint,
1382 			    int *n);
1383 
1384 StatusDef XMatchVisualInfo(
1385     Display*		display,
1386     int			screen,
1387     int			depth,
1388     int			class,
1389     XVisualInfo*	vinfo_return);
1390 
1391 int XClearWindow(Display *display, Window w);
1392 
1393 Window XCreateSimpleWindow(
1394 		    Display *display,
1395 		    Window  parent,
1396 		    int     x,
1397 		    int y,
1398 		    unsigned int brd,
1399 		    unsigned int w,
1400 		    unsigned int h,
1401 		    unsigned long bg,
1402 		    unsigned long brd_col);
1403 
1404 Window XCreateWindow(
1405 	      Display *display,
1406 	      Window  parent,
1407 	      int x,
1408 	      int y,
1409 	      unsigned int width,
1410 	      unsigned int height,
1411 	      unsigned int bw,
1412 	      int depth,
1413 	      unsigned int class,
1414 	      Visual *visual,
1415 	      unsigned long valuemask,
1416 	      XSetWindowAttributes *attr);
1417 
1418 int XDestroyWindow(
1419 	       Display *display,
1420 	       Window w);
1421 
1422 StatusDef XGetGeometry(
1423 	     Display *display,
1424 	     Drawable w,
1425 	     Window *root,
1426 	     int *x,
1427 	     int *y,
1428 	     unsigned int *width,
1429 	     unsigned int *height,
1430 	     unsigned int *bw,
1431 	     unsigned int *depth);
1432 
1433 StatusDef XGetWindowAttributes(Display *display,
1434 		     Window w,
1435 		     XWindowAttributes *wattr);
1436 
1437 int XSelectInput(Display *display,
1438 	     Window  window,
1439 	     long    mask);
1440 
1441 int XMapWindow(Display *display,
1442 	   Window window);
1443 
1444 int XIconifyWindow(Display *display,
1445 	       Window w,
1446 	       int screen_number);
1447 GC XCreateGC(
1448 	  Display *display,
1449 	  Drawable window,
1450 	  unsigned long mask,
1451 	  XGCValues *gc_values);
1452 
1453 int XFreeGC(
1454 	Display *display,
1455 	GC gc);
1456 
1457 int XSetForeground(
1458 	       Display *display,
1459 	       GC gc,
1460 	       unsigned long    color);
1461 int XDrawString(Display *display,
1462 	    Drawable window,
1463 	    GC gc,
1464 	    int x,
1465 	    int y,
1466 	    const char* str,
1467 	    int len);
1468 int XDrawString16(Display *display,
1469 	      Drawable window,
1470 	      GC gc, int x, int y,
1471 	      const XChar2b* str,
1472 	      int len);
1473 
1474 int XDrawImageString(
1475 	Display* display,
1476 	Drawable d,
1477 	GC gc,
1478 	int x,
1479 	int y,
1480 	const char* string,
1481 	int length);
1482 
1483 int XDrawImageString16(Display *display,
1484 		   Drawable window,
1485 		   GC gc, int x, int y,
1486 		   const XChar2b* str,
1487 		   int len);
1488 
1489 int XFillRectangle(
1490 	       Display *display,
1491 	       Drawable window,
1492 	       GC gc,
1493 	       int x, int y,
1494 	       unsigned int w, unsigned int h);
1495 int XClearArea(
1496 	   Display *display,
1497 	   Window w,
1498 	   int x, int y,
1499 	   unsigned int width, unsigned int height,
1500 	   BoolDef exposures);
1501 
1502 Region XCreateRegion();
1503 
1504 int XClipBox(
1505 	 Region hrgn,
1506 	 XRectangle *rect);
1507 
1508 int XSetRegion(
1509 	   Display *display,
1510 	   GC gc,
1511 	   Region hrgn);
1512 
1513 int XDestroyRegion(Region hrgn);
1514 
1515 int XUnionRectWithRegion(XRectangle *rect,
1516 		     Region hrgnsrc,
1517 		     Region hrgndest);
1518 int XDrawArc(
1519 	 Display *display,
1520 	 Drawable w,
1521 	 GC gc,
1522 	 int x, int y,
1523 	 unsigned int width,unsigned int height,
1524 	 int a1, int a2);
1525 
1526 int XFillArc(
1527 	 Display *display,
1528 	 Drawable w,
1529 	 GC gc,
1530 	 int x, int y,
1531 	 unsigned int width,unsigned height,
1532 	 int a1, int a2);
1533 
1534 int XFillPolygon(
1535 	     Display *display,
1536 	     Drawable w,
1537 	     GC gc,
1538 	     XPoint *points,
1539 	     int nps, int shape, int mode);
1540 
1541 int XDrawLine(
1542 	  Display *display,
1543 	  Drawable w,
1544 	  GC gc,
1545 	  int x1,int y1, int x2,int y2);
1546 
1547 int XDrawLines(
1548 	   Display *display,
1549 	   Drawable w,
1550 	   GC gc,
1551 	   XPoint *points,
1552 	   int nps,int mode);
1553 
1554 int XDrawPoints(
1555 	    Display *display,
1556 	    Drawable w,
1557 	    GC gc,
1558 	    XPoint *points,
1559 	    int nps, int mode);
1560 
1561 int XDrawPoint(
1562 	   Display *display,
1563 	   Drawable w,
1564 	   GC gc,
1565 	   int x, int y);
1566 int XDrawRectangle(
1567 	       Display *display,
1568 	       Drawable w,
1569 	       GC gc,
1570 	       int x, int y,
1571 	       unsigned int width, unsigned int height);
1572 
1573 int XDrawSegments(
1574 	      Display *display,
1575 	      Drawable w,
1576 	      GC gc,
1577 	      XSegment *segs,
1578 	      int nsegs);
1579 
1580 Pixmap XCreatePixmap(
1581 	      Display *display,
1582 	      Drawable drawable,
1583 	      unsigned int width, unsigned int height,
1584 	      unsigned int depth);
1585 
1586 Pixmap XCreateBitmapFromData(Display *display,
1587 		      Drawable drawable, const char *data,
1588 		      unsigned int width, unsigned int height);
1589 int XFreePixmap(
1590 	 Display *display,
1591 	 Pixmap pixmap);
1592 
1593 int XCopyArea(
1594 	  Display *display,
1595 	  Drawable src,
1596 	  Drawable dest,
1597 	  GC gc,
1598 	  int src_x, int src_y,
1599 	  unsigned int width, unsigned int height,
1600 	  int dest_x, int dest_y);
1601 
1602 XImage *XGetImage(
1603 		  Display *display,
1604 		  Drawable drawable,
1605 		  int x, int y,
1606 		  unsigned int width, unsigned int height,
1607 		  unsigned long plane_mask,
1608 		  int format);
1609 
1610 XImage *XCreateImage(
1611 	     Display *display,
1612 	     Visual *visual,
1613 	     unsigned int depth,
1614 	     int format,
1615 	     int offset,
1616 	     char *data,
1617 	     unsigned int width, unsigned int height,
1618 	     int bitmap_pad, int bytes_per_line);
1619 int XPutImage(
1620 	  Display *display,
1621 	  Drawable w,
1622 	  GC gc,
1623 	  XImage *image,
1624 	  int sx,int sy,int dx,int dy,
1625 	  unsigned int width,unsigned int height);
1626 
1627 int XSetWindowBackground(
1628 		     Display *display,
1629 		     Window w,
1630 		     unsigned long bg);
1631 
1632 int XSetWindowBackgroundPixmap(
1633 			   Display *display,
1634 			   Window w,
1635 			   Pixmap background_tile);
1636 
1637 int XSetFillStyle(
1638 	      Display *display,
1639 	      GC gc,
1640 	      int fs);
1641 
1642 int XSetDashes(Display *display,
1643 	   GC gc, int dash_offset,
1644 	   const char * dash_list,
1645 	   int n);
1646 
1647 int XChangeWindowAttributes(
1648 			Display *display,
1649 			Window w,
1650 			unsigned long vmask,
1651 			XSetWindowAttributes *attr);
1652 
1653 int XLowerWindow(Display *display,
1654 	     Window w);
1655 
1656 int XMapRaised(
1657 	   Display *display,
1658 	   Window w);
1659 
1660 int
1661 XMapSubwindows(
1662 	       Display *display,
1663 	       Window w);
1664 
1665 StatusDef
1666 XQueryTree(
1667 	   Display *display,
1668 	   Window w,
1669 	   Window* root,
1670 	   Window* parent,
1671 	   Window** ch,
1672 	   unsigned int *n);
1673 int
1674 XRaiseWindow(
1675 	     Display *display,
1676 	     Window w);
1677 
1678 Window
1679 XRootWindow(
1680 	    Display *display,
1681 	    int scr);
1682 Window
1683 XRootWindowOfScreen(Screen *scr);
1684 
1685 BoolDef XTranslateCoordinates(
1686 		      Display *display,
1687 		      Window sw, Window dw,
1688 		      int sx, int sy, int *dx, int *dy,
1689 		      Window *ch);
1690 
1691 int
1692 XUnmapWindow(Display *display,
1693 	     Window w);
1694 int
1695 XCopyGC(
1696 	Display *display,
1697 	GC sgc,
1698 	unsigned long vmask,
1699 	GC dgc);
1700 int
1701 XSetClipMask(
1702 	     Display *display,
1703 	     GC gc,
1704 	     Pixmap cmask);
1705 
1706 int
1707 XSetClipRectangles(
1708 		   Display *display,
1709 		   GC gc,
1710 		   int clx, int cly,
1711 		   XRectangle *rs,
1712 		   int n, int order);
1713 int
1714 XSetFunction(
1715 	     Display *display,
1716 	     GC gc,
1717 	     int fn);
1718 int
1719 XSetLineAttributes(
1720 		   Display *display,
1721 		   GC gc,
1722 		   unsigned int lw,
1723 		   int ls, int cs, int js);
1724 int
1725 XSetPlaneMask(
1726 	      Display *display,
1727 	      GC gc,
1728 	      unsigned long pmask);
1729 int XSetTile(
1730 	     Display *display,
1731 	     GC gc,
1732 	     Pixmap tile);
1733 StatusDef
1734 XAllocColorCells(
1735 		 Display *display,
1736 		 Colormap cmap,
1737 		 BoolDef cont,
1738 		 unsigned long *pmasks,
1739 		 unsigned int np,
1740 		 unsigned long *pixels,
1741 		 unsigned int nc);
1742 StatusDef
1743 XAllocColorPlanes(
1744 		  Display *display,
1745 		  Colormap cmap,
1746 		  BoolDef cont,
1747 		  unsigned long *pixels,
1748 		  int nc,
1749 		  int nr,int ng,int nb,
1750 		  unsigned long *rmask,
1751 		  unsigned long *gmask,
1752 		  unsigned long *bmask);
1753 StatusDef
1754 XAllocNamedColor(Display *display,
1755 		 Colormap cmap, const char *cname,
1756 		 XColor *cell, XColor *rgb);
1757 Colormap
1758 XCreateColormap(
1759 		Display *display,
1760 		Window w,
1761 		Visual *visual,
1762 		int alloc);
1763 StatusDef
1764 XGetStandardColormap(
1765 		     Display *display,
1766 		     Window w,
1767 		     XStandardColormap *cmapinf,
1768 		     Atom prop);
1769 StatusDef
1770 XAllocColor(
1771 	    Display *display,
1772 	    Colormap cmap,
1773 	    XColor *xc);
1774 int
1775 XQueryColor(
1776 	    Display *display,
1777 	    Colormap cmap,
1778 	    XColor *cell);
1779 int
1780 XQueryColors(
1781 	     Display *display,
1782 	     Colormap cmap,
1783 	     XColor *cells,
1784 	     int nc);
1785 int
1786 XStoreColor(
1787 	    Display *display,
1788 	    Colormap cmap,
1789 	    XColor *cell);
1790 int
1791 XStoreColors(
1792 	     Display *display,
1793 	     Colormap cmap,
1794 	     XColor *cells,
1795 	     int nc);
1796 char **
1797 XGetFontPath(
1798 	     Display *display,
1799 	     int *nps);
1800 BoolDef XGetFontProperty(
1801 		 XFontStruct *fstruct,
1802 		 Atom atom,
1803 		 unsigned long *val);
1804 
1805 XFontStruct *
1806 XLoadQueryFont(Display *display, const char *name);
1807 
1808 XFontStruct *
1809 XQueryFont(
1810 	   Display *display,
1811 	   XID     font_id);
1812 
1813 KeySym
1814 XKeycodeToKeysym(
1815 		 Display *display,
1816 		 unsigned int keycode,
1817 		 int     index);
1818 
1819 KeyCode
1820 XKeysymToKeycode(
1821 		 Display *display,
1822 		 KeySym keysym);
1823 
1824 KeySym
1825 XStringToKeysym(const char *str);
1826 
1827 XModifierKeymap *
1828 XGetModifierMapping(Display *display);
1829 
1830 int
1831 XFreeModifiermap(XModifierKeymap *modmap);
1832 
1833 int
1834 XSetFont(
1835 	 Display *display,
1836 	 GC gc,
1837 	 Font font);
1838 int
1839 XSetFontPath(
1840 	     Display *display,
1841 	     char **dirs,
1842 	     int nd);
1843 int
1844 XTextExtents(
1845 	     XFontStruct *fstruct,
1846 	     const char *str,
1847 	     int nc,
1848 	     int *dir,int *ascent,int *descent,
1849 	     XCharStruct *overall);
1850 int
1851 XTextExtents16(
1852 	       XFontStruct *fstruct,
1853 	       const XChar2b *str,
1854 	       int nc,
1855 	       int *dir, int *ascent, int *descent,
1856 	       XCharStruct *overall);
1857 
1858 int
1859 XTextWidth(
1860 	   XFontStruct *fstruct,
1861 	   const char *str,
1862 	   int co);
1863 int
1864 XTextWidth16(
1865 	     XFontStruct *fstruct,
1866 	     const XChar2b *str,
1867 	     int co);
1868 int
1869 XGetErrorDatabaseText(
1870 		      Display *display,
1871 		      const char *name, const char *msg,
1872 		      const char *defstr,
1873 		      char *buf,
1874 		      int len);
1875 
1876 int
1877 XGetErrorText(
1878 	      Display *display,
1879 	      int code,
1880 	      char *buf,
1881 	      int len);
1882 
1883 XErrorHandler
1884 XSetErrorHandler(XErrorHandler handler);
1885 
1886 int
1887 XDefaultScreen(Display *display);
1888 
1889 Visual *
1890 XDefaultVisual(
1891 	       Display *display,
1892 	       int screen);
1893 
1894 int
1895 XDefaultDepth(
1896 	      Display *display,
1897 	      int screen);
1898 
1899 Colormap
1900 XDefaultColormap(
1901 		 Display *display,
1902 		 int screen);
1903 Screen *
1904 XScreenOfDisplay(
1905 		 Display *display,
1906 		 int scr);
1907 Cursor
1908 XCreateFontCursor(
1909 		  Display *display,
1910 		  unsigned int shape);
1911 int
1912 XRecolorCursor(
1913 	       Display *display,
1914 	       Cursor cursor,
1915 	       XColor *fg,XColor *bg);
1916 
1917 int
1918 XWarpPointer(
1919 	     Display *display,
1920 	     Window sw,Window dw,
1921 	     int sx,int sy,
1922 	     unsigned int swidth,unsigned int sheight,
1923 	     int dx, int dy);
1924 int
1925 XBell(
1926       Display *display,
1927       int pc);
1928 
1929 int
1930 XGetInputFocus(
1931 	       Display *display,
1932 	       Window *focus,
1933 	       int *revto);
1934 int
1935 XSetInputFocus(
1936 	       Display *display,
1937 	       Window focus,
1938 	       int revto,
1939 	       Time time);
1940 int
1941 XLookupString(
1942 	      XKeyEvent *event,
1943 	      char *buf,
1944 	      int nbytes,
1945 	      KeySym *keysym,
1946 	      XComposeStatus *status);
1947 
1948 int
1949 XRefreshKeyboardMapping(XMappingEvent *event);
1950 
1951 int
1952 XSetClassHint(
1953 	      Display *display,
1954 	      Window w,
1955 	      XClassHint *chints);
1956 int
1957 XSetNormalHints(
1958 		Display *display,
1959 		Window w,
1960 		XSizeHints *hints);
1961 
1962 int
1963 XSetWMHints(
1964 	    Display *display,
1965 	    Window w,
1966 	    XWMHints *wmhints);
1967 StatusDef
1968 XSetWMProtocols(
1969 		Display *display,
1970 		Window w,
1971 		Atom *prots,
1972 		int co);
1973 int
1974 XStoreName(Display *display,
1975 	   Window w,
1976 	   const char *wname);
1977 StatusDef
1978 XFetchName(
1979     Display *display,
1980     Window w,
1981     char **window_name_return);
1982 
1983 int
1984 XDoesBackingStore(Screen *scr);
1985 
1986 XExtCodes *
1987 XInitExtension(Display *display,
1988 	       const char *name);
1989 int
1990 XFree(void *data);
1991 
1992 char *
1993 XServerVendor(Display *display);
1994 
1995 int
1996 XSetIconName(Display *display,
1997 	     Window w,
1998 	     const char *iname);
1999 int
2000 XGetIconName(
2001 	     Display *display,
2002 	     Window w,
2003 	     char **iname);
2004 int
2005 XSetSelectionOwner(
2006 		   Display* display,
2007 		   Atom sel,
2008 		   Window owner,
2009 		   Time time);
2010 Window
2011 XGetSelectionOwner(
2012 		   Display* display,
2013 		   Atom selection);
2014 
2015 int
2016 XConvertSelection(
2017 		  Display *display,
2018 		  Atom sel, Atom target, Atom prop,
2019 		  Window req,
2020 		  Time time);
2021 BoolDef XCheckTypedEvent(
2022 		 Display *display,
2023 		 int ev,
2024 		 XEvent *rep);
2025 BoolDef XCheckWindowEvent(
2026 		  Display *display,
2027 		  Window w,
2028 		  long emask,
2029 		  XEvent *ev);
2030 int
2031 XPending(Display *display);
2032 
2033 int
2034 XPutBackEvent(Display *display,
2035 	      XEvent *event);
2036 
2037 StatusDef
2038 XSendEvent(
2039 	   Display *display,
2040 	   Window w,
2041 	   BoolDef prop,
2042 	   long emask,
2043 	   XEvent *event);
2044 
2045 BoolDef XCheckTypedWindowEvent(
2046 	Display* display,
2047 	Window w,
2048 	int event_type,
2049 	XEvent* event_return);
2050 int
2051 XWindowEvent(
2052 	     Display *display,
2053 	     Window w,
2054 	     long emask,
2055 	     XEvent *rep);
2056 
2057 int
2058 XNextEvent(
2059 	   Display *display,
2060 	   XEvent  *event);
2061 
2062 Atom
2063 XInternAtom(
2064 	    Display *display,
2065 	    const char *property_name,
2066 	    BoolDef only_if_exists);
2067 char *
2068 XGetAtomName(
2069 	     Display *display,
2070 	     Atom atom);
2071 
2072 int
2073 XChangeProperty(
2074 	Display *display,
2075 	Window window,
2076 	Atom property,
2077 	Atom type,
2078 	int format,
2079 	int mode,
2080 	const unsigned char *data,
2081 	int nelements);
2082 
2083 int
2084 XGetWindowProperty(
2085 		   Display *display,
2086 		   Window window,
2087 		   Atom property,
2088 		   long long_offset,
2089 		   long long_length,
2090 		   BoolDef delete,
2091 		   Atom req_type,
2092 		   Atom *actual_type_return,
2093 		   int *actual_format_return,
2094 		   unsigned long *nitems_return,
2095 		   unsigned long *bytes_after_return,
2096 		   unsigned char **prop_return);
2097 
2098 char **
2099 XListExtensions(
2100 		Display *display,
2101 		int *ret_num);
2102 
2103 int XFreeExtensionList(char **list);
2104 
2105 int
2106 XChangeGC(
2107 	Display* display,
2108 	GC gc,
2109 	unsigned long mask,
2110 	XGCValues* gc_values);
2111 
2112 int
2113 XConnectionNumber(Display* display);
2114 
2115 int
2116 XFreeFont(Display* display,XFontStruct* font_struct);
2117 
2118 char *
2119 XSetLocaleModifiers(const char* modifier_list);
2120 
2121 XIM
2122 XOpenIM(
2123 	Display* dpy,
2124 	struct _XrmHashBucketRec* rdb,
2125 	char* res_name,
2126 	char* res_class);
2127 
2128 char *
2129 XGetIMValues(XIM im , ...);
2130 
2131 XIC XCreateIC(XIM im , ...);
2132 
2133 StatusDef
2134 XCloseIM(XIM im);
2135 
2136 BoolDef XFilterEvent(XEvent* event,Window window);
2137 
2138 char *
2139 XrmQuarkToString(void *quark);
2140 
2141 int
2142 XmbLookupString(
2143 	XIC ic,
2144 	XKeyPressedEvent* event,
2145 	char* buffer_return,
2146 	int bytes_buffer,
2147 	KeySym* keysym_return,
2148 	StatusDef* status_return);
2149 int
2150 XmbTextPropertyToTextList(
2151 	Display *display,
2152 	XTextProperty *text_prop,
2153 	char ***list_return,
2154 	int *count_return);
2155 
2156 void
2157 XFreeStringList(char **list);
2158 
2159 int XmbTextListToTextProperty(
2160 	 Display *display,
2161 	 char **list,
2162 	 int count,
2163 	 XICCEncodingStyle style,
2164 	 XTextProperty *text_prop_return);
2165 
2166 void
2167 XSetICFocus(XIC ic);
2168 
2169 void
2170 XUnsetICFocus(XIC ic);
2171 
2172 BoolDef XQueryPointer(
2173 	Display* display,
2174 	Window w,
2175 	Window* root_return,
2176 	Window* child_return,
2177 	int* root_x_return,
2178 	int* root_y_return,
2179 	int* win_x_return,
2180 	int* win_y_return,
2181 	unsigned int* mask_return);
2182 
2183 int XParseGeometry(
2184 	const char* string,
2185 	int* x,
2186 	int* y,
2187 	unsigned int* width,
2188 	unsigned int* height);
2189 
2190 int XResizeWindow(
2191 	Display* display,
2192 	Window w,
2193 	unsigned int width,
2194 	unsigned int height);
2195 
2196 void XSetWMNormalHints(Display* display,Window w,XSizeHints* hints);
2197 
2198 void XSetWMProperties(
2199 	Display* display,
2200 	Window w,
2201 	XTextProperty* window_name,
2202 	XTextProperty* icon_name,
2203 	char** argv,
2204 	int argc,
2205 	XSizeHints* normal_hints,
2206 	XWMHints* wm_hints,
2207 	XClassHint* class_hints);
2208 
2209 int XDefineCursor(Display* display,Window w,Cursor cursor);
2210 
2211 int XMoveResizeWindow(
2212 	Display* display,
2213 	Window w,
2214 	int x,
2215 	int y,
2216 	unsigned int width,
2217 	unsigned int height);
2218 
2219 int XMoveWindow(
2220 	Display* display,
2221 	Window w,
2222 	int x,
2223 	int y);
2224 
2225 StatusDef
2226 XParseColor(
2227     Display *display,
2228     Colormap map,
2229     const char* spec,
2230     XColor *colorPtr);
2231 
2232 int
2233 XFreeColors(Display *display,
2234 	    Colormap cmap,
2235 	    unsigned long pixels[],
2236 	    int npixels,
2237 	    unsigned long planes);
2238 int
2239 XGrabServer(Display *display);
2240 
2241 int
2242 XUngrabServer(Display *display);
2243 
2244 
2245 #endif
2246