PageRenderTime 115ms CodeModel.GetById 14ms app.highlight 88ms RepoModel.GetById 1ms app.codeStats 1ms

/binding/x/Xlib.d

http://github.com/wilkie/djehuty
D | 3998 lines | 3318 code | 499 blank | 181 comment | 0 complexity | a08f6fb20d718ca64e59fad6c68382d5 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*
   2 * X.d
   3 *
   4 * This file holds Xlib bindings. Much of this file was taken from bindings
   5 * by Teissier Sylvere's alpha release. I have fixed the errors. His
   6 * original copyright notice is below.
   7 *
   8 * Author: Teissier Sylvere, Dave Wilkinson
   9 *
  10 */
  11
  12 /* 	Xlib binding for D language
  13	Copyright 2007 TEISSIER Sylvere sligor(at)free.fr
  14	version 0.1 2007/08/29
  15	This binding is an alpha release and need to be more tested
  16
  17	This file is free software, please read COPYING file for more informations
  18*/
  19
  20/* This file is binding from:
  21 $XdotOrg: lib/X11/include/X11/Xlib.h,v 1.6 2005-11-08 06:33:25 jkj Exp $
  22 $Xorg: Xlib.h,v 1.6 2001/02/09 02:03:38 xorgcvs Exp $
  23*/
  24
  25
  26module binding.x.Xlib;
  27public import binding.x.X;
  28import core.definitions;
  29
  30const int XlibSpecificationRelease=6;
  31version = X_HAVE_UTF8_STRING;
  32
  33typedef void* XPointer;
  34typedef int Status ;
  35enum Bool:int{False,True}; //xlib boolean is int type, D bool is only byte
  36enum QueueMode{QueuedAlready,QueuedAfterReading,QueuedAfterFlush};
  37
  38/+
  39TODO Nested struc or union verify
  40+/
  41
  42int		ConnectionNumber(Display *dpy) 	{return dpy.fd;}
  43Window	RootWindow(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).root;}
  44int		DefaultScreen(Display *dpy) 		{return dpy.default_screen;}
  45Window	DefaultRootWindow(Display *dpy) 	{return ScreenOfDisplay(dpy,DefaultScreen(dpy)).root;}
  46Visual*	DefaultVisual(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root_visual;}
  47GC		DefaultGC(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).default_gc;}
  48uint	BlackPixel(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).black_pixel;}
  49uint	WhitePixel(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).white_pixel;}
  50uint	AllPlanes()							{return 0xFFFFFFFF;}
  51int		QLength(Display *dpy) 				{return dpy.qlen;}
  52int		DisplayWidth(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).width;}
  53int		DisplayHeight(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).height;}
  54int		DisplayWidthMM(Display *dpy,int scr){return ScreenOfDisplay(dpy,scr).mwidth;}
  55int		DisplayHeightMM(Display *dpy,int scr){return ScreenOfDisplay(dpy,scr).mheight;}
  56int		DisplayPlanes(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root_depth;}
  57int		DisplayCells(Display *dpy,int scr) 	{return DefaultVisual(dpy,scr).map_entries;}
  58int		ScreenCount(Display *dpy) 			{return dpy.nscreens;}
  59char*	ServerVendor(Display *dpy) 			{return dpy.vendor;}
  60int		ProtocolVersion(Display *dpy) 		{return dpy.proto_major_version;}
  61int		ProtocolRevision(Display *dpy) 		{return dpy.proto_minor_version;}
  62int		VendorRelease(Display *dpy) 			{return dpy.release;}
  63char*	DisplayString(Display *dpy) 			{return dpy.display_name;}
  64int		DefaultDepth(Display *dpy,int scr) 	{return ScreenOfDisplay(dpy,scr).root_depth;}
  65Colormap DefaultColormap(Display *dpy,int scr){return ScreenOfDisplay(dpy,scr).cmap;}
  66int		BitmapUnit(Display *dpy) 			{return dpy.bitmap_unit;}
  67int		BitmapBitOrder(Display *dpy) 		{return dpy.bitmap_bit_order;}
  68int		BitmapPad(Display *dpy) 			{return dpy.bitmap_pad;}
  69int		ImageByteOrder(Display *dpy) 		{return dpy.byte_order;}
  70uint	NextRequest(Display *dpy)			{return dpy.request + 1;}
  71
  72uint	LastKnownRequestProcessed(Display *dpy)	{return dpy.last_request_read;}
  73
  74/* macros for screen oriented applications (toolkit) */
  75Screen*	ScreenOfDisplay(Display *dpy,int scr)	{return &dpy.screens[scr];}
  76Screen*	DefaultScreenOfDisplay(Display *dpy) {return ScreenOfDisplay(dpy,DefaultScreen(dpy));}
  77Display* DisplayOfScreen(Screen s)			{return s.display;}
  78Window	RootWindowOfScreen(Screen s)		{return s.root;}
  79uint 	BlackPixelOfScreen(Screen s)		{return s.black_pixel;}
  80uint 	WhitePixelOfScreen(Screen s)		{return s.white_pixel;}
  81Colormap DefaultColormapOfScreen(Screen s)	{return s.cmap;}
  82int 	DefaultDepthOfScreen(Screen s)		{return s.root_depth;}
  83GC		DefaultGCOfScreen(Screen s)		{return s.default_gc;}
  84Visual*	DefaultVisualOfScreen(Screen s)	{return s.root_visual;}
  85int		WidthOfScreen(Screen s)			{return s.width;}
  86int		HeightOfScreen(Screen s)		{return s.height;}
  87int		WidthMMOfScreen(Screen s)		{return s.mwidth;}
  88int		HeightMMOfScreen(Screen s)		{return s.mheight;}
  89int		PlanesOfScreen(Screen s)		{return s.root_depth;}
  90int 	CellsOfScreen(Screen s)			{return DefaultVisualOfScreen(s).map_entries;}
  91int		MinCmapsOfScreen(Screen s)		{return s.min_maps;}
  92int		MaxCmapsOfScreen(Screen s)		{return s.max_maps;}
  93Bool	DoesSaveUnders(Screen s)		{return s.save_unders;}
  94int 	DoesBackingStore(Screen s)		{return s.backing_store;}
  95int		EventMaskOfScreen(Screen s)		{return s.root_input_mask;}
  96
  97
  98
  99/*
 100 * Extensions need a way to hang private data on some structures.
 101 */
 102struct XExtData
 103{
 104	int number;		/* number returned by XRegisterExtension */
 105	XExtData *next;		/* next item on list of data for structure */
 106	int function(XExtData *extension) free_private;	/* called to free private storage */
 107	XPointer private_data;	/* data private to this extension. */
 108};
 109
 110/*
 111 * This file contains structures used by the extension mechanism.
 112 */
 113struct XExtCodes
 114{						/* public to extension, cannot be changed */
 115	int extension;		/* extension number */
 116	int major_opcode;	/* major op-code assigned by server */
 117	int first_event;	/* first event number for the extension */
 118	int first_error;	/* first error number for the extension */
 119};
 120
 121/*
 122 * Data structure for retrieving info about pixmap formats.
 123 */
 124
 125struct XPixmapFormatValues
 126{
 127    int depth;
 128    int bits_per_pixel;
 129    int scanline_pad;
 130};
 131
 132struct XGCValues
 133{
 134	GraphicFunction function_;		/* logical operation*/
 135	Culong plane_mask;				/* plane mask */
 136	Culong foreground;				/* foreground pixel */
 137	Culong background;				/* background pixel */
 138	int line_width;					/* line width */
 139	LineStyle line_style;	 		/* LineSolid, LineOnOffDash, LineDoubleDash */
 140	CapStyle cap_style;	  			/* CapNotLast, CapButt, CapRound, CapProjecting */
 141	LineStyle join_style;	 		/* JoinMiter, JoinRound, JoinBevel */
 142	FillStyle fill_style;	 		/* FillSolid, FillTiled,FillStippled, FillOpaeueStippled */
 143	FillRule fill_rule;		  		/* EvenOddRule, WindingRule */
 144	ArcMode arc_mode;				/* ArcChord, ArcPieSlice */
 145	Pixmap tile;					/* tile pixmap for tiling operations */
 146	Pixmap stipple;				/* stipple 1 plane pixmap for stipping */
 147	int ts_x_origin;				/* offset for tile or stipple operations */
 148	int ts_y_origin;
 149	Font font;	        			/* default text font for text operations */
 150	SubwindowMode subwindow_mode;   /* ClipByChildren, IncludeInferiors */
 151	Bool graphics_exposures;		/* Boolean, should exposures be generated */
 152	int clip_x_origin;				/* origin for clipping */
 153	int clip_y_origin;
 154	Pixmap clip_mask;				/* bitmap clipping; other calls for rects */
 155	int dash_offset;				/* patterned/dashed line information */
 156	byte dashes;
 157};
 158
 159typedef void* GC;
 160
 161/*
 162 * Visual structure; contains information about colormapping possible.
 163 */
 164struct Visual
 165{
 166	XExtData *ext_data;	/* hook for extension to hang data */
 167	VisualID visualid;	/* visual id of this visual */
 168	int class_;			/* class of screen (monochrome, etc.) */
 169	Culong red_mask;
 170	Culong green_mask;
 171	Culong blue_mask;	/* mask values */
 172
 173	int bits_per_rgb;	/* log base 2 of distinct color values */
 174	int map_entries;	/* color map entries */
 175} ;
 176
 177/*
 178 * Depth structure; contains information for each possible depth.
 179 */
 180struct Depth
 181{
 182	int depth;		/* this depth (Z) of the depth */
 183	int nvisuals;		/* number of Visual types at this depth */
 184	Visual *visuals;	/* list of visuals possible at this depth */
 185};
 186
 187alias Display XDisplay;
 188
 189struct Screen{
 190	XExtData *ext_data;		/* hook for extension to hang data */
 191	XDisplay *display;		/* back pointer to display structure */
 192	Window root;			/* Root window id. */
 193	int width, height;		/* width and height of screen */
 194	int mwidth, mheight;	/* width and height of  in millimeters */
 195	int ndepths;			/* number of depths possible */
 196	Depth *depths;			/* list of allowable depths on the screen */
 197	int root_depth;			/* bits per pixel */
 198	Visual *root_visual;	/* root visual */
 199	GC default_gc;			/* GC for the root root visual */
 200	Colormap cmap;			/* default color map */
 201	Culong white_pixel;
 202	Culong black_pixel;		/* White and Black pixel values */
 203	int max_maps, min_maps;	/* max and min color maps */
 204	int backing_store;		/* Never, WhenMapped, Always */
 205	Bool save_unders;
 206	int root_input_mask;	/* initial root input mask */
 207};
 208
 209/*
 210 * Format structure; describes ZFormat data the screen will understand.
 211 */
 212struct ScreenFormat
 213{
 214	XExtData *ext_data;	/* hook for extension to hang data */
 215	int depth;			/* depth of this image format */
 216	int bits_per_pixel;	/* bits/pixel at this depth */
 217	int scanline_pad;	/* scanline must padded to this multiple */
 218};
 219
 220/*
 221 * Data structure for setting window attributes.
 222 */
 223struct  XSetWindowAttributes
 224{
 225    Pixmap background_pixmap;	/* background or None or ParentRelative */
 226    Culong background_pixel;		/* background pixel */
 227    Pixmap border_pixmap;		/* border of the window */
 228    Culong border_pixel;			/* border pixel value */
 229    BitGravity bit_gravity;		/* one of bit gravity values */
 230    BitGravity win_gravity;		/* one of the window gravity values */
 231    BackingStoreHint backing_store;		/* NotUseful, WhenMapped, Always */
 232    Culong backing_planes;		/* planes to be preseved if possible */
 233    Culong backing_pixel;			/* value to use in restoring planes */
 234    Bool save_under;			/* should bits under be saved? (popups) */
 235    Clong event_mask;			/* set of events that should be saved */
 236    Clong do_not_propagate_mask;/* set of events that should not propagate */
 237    Bool override_redirect;		/* Boolean value for override-redirect */
 238    Colormap colormap;			/* color map to be associated with window */
 239    Cursor cursor;				/* cursor to be displayed (or None) */
 240};
 241
 242struct XWindowAttributes
 243{
 244    int x, y;					/* location of window */
 245    int width, height;			/* width and height of window */
 246    int border_width;			/* border width of window */
 247    int depth;          		/* depth of window */
 248    Visual *visual;				/* the associated visual structure */
 249    Window root;        		/* root of screen containing window */
 250    WindowClass class_;			/* InputOutput, InputOnly*/
 251    BitGravity bit_gravity;		/* one of bit gravity values */
 252    BitGravity win_gravity;		/* one of the window gravity values */
 253    BackingStoreHint backing_store;	/* NotUseful, WhenMapped, Always */
 254    Culong backing_planes;		/* planes to be preserved if possible */
 255    Culong backing_pixel;	/* value to be used when restoring planes */
 256    Bool save_under;			/* Boolean, should bits under be saved? */
 257    Colormap colormap;			/* color map to be associated with window */
 258    Bool map_installed;		/* Boolean, is color map currently installed*/
 259    MapState map_state;		/* IsUnmapped, IsUnviewable, IsViewable */
 260    EventMask all_event_masks;	/* set of events all people have interest in*/
 261    EventMask your_event_mask;	/* my event mask */
 262    EventMask do_not_propagate_mask; /* set of events that should not propagate */
 263    Bool override_redirect;		/* Boolean value for override-redirect */
 264    Screen *screen;				/* back pointer to correct screen */
 265};
 266
 267/*
 268 * Data structure for host setting; getting routines.
 269 *
 270 */
 271
 272struct XHostAddress
 273{
 274	ProtocolFamlily family;	/* for example FamilyInternet */
 275	int length;					/* length of address, in bytes */
 276	void *address;				/* pointer to where to find the bytes */
 277};
 278
 279/*
 280 * Data structure for ServerFamilyInterpreted addresses in host routines
 281 */
 282struct XServerInterpretedAddress
 283{
 284	int typelength;		/* length of type string, in bytes */
 285	int valuelength;	/* length of value string, in bytes */
 286	void *type;			/* pointer to where to find the type string */
 287	void *value;		/* pointer to where to find the address */
 288};
 289
 290/*
 291 * Data structure for "image" data, used by image manipulation routines.
 292 */
 293struct XImage
 294{
 295    int width, height;			/* size of image */
 296    int xoffset;				/* number of pixels offset in X direction */
 297    ImageFormat format;		/* XYBitmap, XYPixmap, ZPixmap */
 298    void *data;					/* pointer to image data */
 299    ByteOrder byte_order;		/* data byte order, LSBFirst, MSBFirst */
 300    int bitmap_unit;			/* quant. of scanline 8, 16, 32 */
 301    int bitmap_bit_order;		/* LSBFirst, MSBFirst */
 302    int bitmap_pad;			/* 8, 16, 32 either XY or ZPixmap */
 303    int depth;					/* depth of image */
 304    int bytes_per_line;			/* accelarator to next line */
 305    int bits_per_pixel;			/* bits per pixel (ZPixmap) */
 306    Culong red_mask;	/* bits in z arrangment */
 307    Culong green_mask;
 308    Culong blue_mask;
 309    XPointer obdata;			/* hook for the object routines to hang on */
 310    struct f {				/* image manipulation routines */
 311		XImage* function(
 312			XDisplay* 			/* display */,
 313			Visual*				/* visual */,
 314			uint				/* depth */,
 315			int					/* format */,
 316			int					/* offset */,
 317			byte*				/* data */,
 318			uint				/* width */,
 319			uint				/* height */,
 320			int					/* bitmap_pad */,
 321			int					/* bytes_per_line */) create_image;
 322		int  function(XImage *)destroy_image;
 323		Culong function(XImage *, int, int)get_pixel;
 324		int  function(XImage *, int, int, Culong)put_pixel;
 325		XImage function(XImage *, int, int, uint, uint)sub_image;
 326		int function(XImage *, Clong)add_pixel;
 327	};
 328};
 329
 330/*
 331 * Data structure for XReconfigureWindow
 332 */
 333struct XWindowChanges{
 334    int x, y;
 335    int width, height;
 336    int border_width;
 337    Window sibling;
 338    WindowStackingMethod stack_mode;
 339};
 340
 341/*
 342 * Data structure used by color operations
 343 */
 344struct XColor
 345{
 346	Culong pixel;
 347	ushort red, green, blue;
 348	StoreColor flags;  /* do_red, do_green, do_blue */
 349	byte pad;
 350};
 351
 352/*
 353 * Data structures for graphics operations.  On most machines, these are
 354 * congruent with the wire protocol structures, so reformatting the data
 355 * can be avoided on these architectures.
 356 */
 357struct XSegment
 358{
 359    short x1, y1, x2, y2;
 360};
 361
 362struct XPoint
 363{
 364    short x, y;
 365};
 366
 367struct XRectangle
 368{
 369    short x, y;
 370    ushort width, height;
 371};
 372
 373struct XArc
 374{
 375    short x, y;
 376    ushort width, height;
 377    short angle1, angle2;
 378};
 379
 380
 381/* Data structure for XChangeKeyboardControl */
 382
 383struct XKeyboardControl
 384{
 385	int key_click_percent;
 386	int bell_percent;
 387	int bell_pitch;
 388	int bell_duration;
 389	int led;
 390	LedMode led_mode;
 391	int key;
 392	AutoRepeatMode auto_repeat_mode;   /* On, Off, Default */
 393};
 394
 395/* Data structure for XGetKeyboardControl */
 396
 397struct XKeyboardState
 398{
 399	int key_click_percent;
 400	int bell_percent;
 401	uint bell_pitch, bell_duration;
 402	Culong led_mask;
 403	int global_auto_repeat;
 404	byte auto_repeats[32];
 405};
 406
 407struct XTimeCoord
 408{
 409	Time time;
 410	short x, y;
 411};
 412
 413/* Data structure for X{Set,Get}ModifierMapping */
 414
 415struct XModifierKeymap
 416{
 417	int max_keypermod;	/* The server's max # of keys per modifier */
 418	KeyCode *modifiermap;	/* An 8 by max_keypermod array of modifiers */
 419};
 420
 421
 422/+ todo Verify Here+/
 423/*
 424 * Display datatype maintaining display specific data.
 425 * The contents of this structure are implementation dependent.
 426 * A Display should be treated as opaque by application code.
 427 */
 428
 429struct _XPrivate{}		/* Forward declare before use for C++ */
 430struct _XrmHashBucketRec{}
 431
 432struct Display
 433{
 434	XExtData *ext_data;	/* hook for extension to hang data */
 435	_XPrivate *private1;
 436	int fd;			/* Network socket. */
 437	int private2;
 438	int proto_major_version;/* major version of server's X protocol */
 439	int proto_minor_version;/* minor version of servers X protocol */
 440	char *vendor;		/* vendor of the server hardware */
 441    XID private3;
 442	XID private4;
 443	XID private5;
 444	int private6;
 445	XID function(Display*)resource_alloc;/* allocator function */
 446	ByteOrder byte_order;		/* screen byte order, LSBFirst, MSBFirst */
 447	int bitmap_unit;	/* padding and data requirements */
 448	int bitmap_pad;		/* padding requirements on bitmaps */
 449	ByteOrder bitmap_bit_order;	/* LeastSignificant or MostSignificant */
 450	int nformats;		/* number of pixmap formats in list */
 451	ScreenFormat *pixmap_format;	/* pixmap format list */
 452	int private8;
 453	int release;		/* release of the server */
 454	_XPrivate *private9;
 455	_XPrivate *private10;
 456	int qlen;		/* Length of input event queue */
 457	Culong last_request_read; /* seq number of last event read */
 458	Culong request;	/* sequence number of last request. */
 459	XPointer private11;
 460	XPointer private12;
 461	XPointer private13;
 462	XPointer private14;
 463	uint max_request_size; /* maximum number 32 bit words in request*/
 464	_XrmHashBucketRec *db;
 465	int function  (Display*)private15;
 466	char *display_name;	/* "host:display" string used on this connect*/
 467	int default_screen;	/* default screen for operations */
 468	int nscreens;		/* number of screens on this server*/
 469	Screen *screens;	/* pointer to list of screens */
 470	Culong motion_buffer;	/* size of motion buffer */
 471	Culong private16;
 472	int min_keycode;	/* minimum defined keycode */
 473	int max_keycode;	/* maximum defined keycode */
 474	XPointer private17;
 475	XPointer private18;
 476	int private19;
 477	byte *xdefaults;	/* contents of defaults from server */
 478	/* there is more to this structure, but it is private to Xlib */
 479}
 480
 481typedef Display *_XPrivDisplay;
 482struct XrmHashBucketRec{};
 483
 484
 485/*
 486 * Definitions of specific events.
 487 */
 488struct XKeyEvent
 489{
 490	int type;			/* of event */
 491	Culong serial;		/* # of last request processed by server */
 492	Bool send_event;	/* true if this came from a SendEvent request */
 493	Display *display;	/* Display the event was read from */
 494	Window window;	        /* "event" window it is reported relative to */
 495	Window root;	        /* root window that the event occurred on */
 496	Window subwindow;	/* child window */
 497	Time time;		/* milliseconds */
 498	int x, y;		/* pointer x, y coordinates in event window */
 499	int x_root, y_root;	/* coordinates relative to root */
 500	KeyOrButtonMask state;	/* key or button mask */
 501	uint keycode;	/* detail */
 502	Bool same_screen;	/* same screen flag */
 503};
 504typedef XKeyEvent XKeyPressedEvent;
 505typedef XKeyEvent XKeyReleasedEvent;
 506
 507struct XButtonEvent
 508{
 509	int type;		/* of event */
 510	Culong serial;	/* # of last request processed by server */
 511	Bool send_event;	/* true if this came from a SendEvent request */
 512	Display *display;	/* Display the event was read from */
 513	Window window;	        /* "event" window it is reported relative to */
 514	Window root;	        /* root window that the event occurred on */
 515	Window subwindow;	/* child window */
 516	Time time;		/* milliseconds */
 517	int x, y;		/* pointer x, y coordinates in event window */
 518	int x_root, y_root;	/* coordinates relative to root */
 519	KeyOrButtonMask state;	/* key or button mask */
 520	uint button;	/* detail */
 521	Bool same_screen;	/* same screen flag */
 522};
 523typedef XButtonEvent XButtonPressedEvent;
 524typedef XButtonEvent XButtonReleasedEvent;
 525
 526struct XMotionEvent{
 527	int type;		/* of event */
 528	Culong serial;	/* # of last request processed by server */
 529	Bool send_event;	/* true if this came from a SendEvent request */
 530	Display *display;	/* Display the event was read from */
 531	Window window;	        /* "event" window reported relative to */
 532	Window root;	        /* root window that the event occurred on */
 533	Window subwindow;	/* child window */
 534	Time time;		/* milliseconds */
 535	int x, y;		/* pointer x, y coordinates in event window */
 536	int x_root, y_root;	/* coordinates relative to root */
 537	KeyOrButtonMask state;	/* key or button mask */
 538	byte is_hint;		/* detail */
 539	Bool same_screen;	/* same screen flag */
 540};
 541typedef XMotionEvent XPointerMovedEvent;
 542
 543struct XCrossingEvent{
 544	int type;		/* of event */
 545	Culong serial;	/* # of last request processed by server */
 546	Bool send_event;	/* true if this came from a SendEvent request */
 547	Display *display;	/* Display the event was read from */
 548	Window window;	        /* "event" window reported relative to */
 549	Window root;	        /* root window that the event occurred on */
 550	Window subwindow;	/* child window */
 551	Time time;		/* milliseconds */
 552	int x, y;		/* pointer x, y coordinates in event window */
 553	int x_root, y_root;	/* coordinates relative to root */
 554	NotifyModes mode;		/* NotifyNormal, NotifyGrab, NotifyUngrab */
 555	NotifyDetail detail;
 556	/*
 557	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
 558	 * NotifyNonlinear,NotifyNonlinearVirtual
 559	 */
 560	Bool same_screen;	/* same screen flag */
 561	Bool focus;		/* Boolean focus */
 562	KeyOrButtonMask state;	/* key or button mask */
 563};
 564typedef XCrossingEvent XEnterWindowEvent;
 565typedef XCrossingEvent XLeaveWindowEvent;
 566
 567struct XFocusChangeEvent{
 568	int type;		/* FocusIn or FocusOut */
 569	Culong serial;	/* # of last request processed by server */
 570	Bool send_event;	/* true if this came from a SendEvent request */
 571	Display *display;	/* Display the event was read from */
 572	Window window;		/* window of event */
 573	NotifyModes mode;		/* NotifyNormal, NotifyWhileGrabbed,
 574				   NotifyGrab, NotifyUngrab */
 575	NotifyDetail detail;
 576	/*
 577	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
 578	 * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
 579	 * NotifyPointerRoot, NotifyDetailNone
 580	 */
 581};
 582typedef XFocusChangeEvent XFocusInEvent;
 583typedef XFocusChangeEvent XFocusOutEvent;
 584
 585/* generated on EnterWindow and FocusIn  when KeyMapState selected */
 586struct XKeymapEvent
 587{
 588	int type;
 589	Culong serial;	/* # of last request processed by server */
 590	Bool send_event;	/* true if this came from a SendEvent request */
 591	Display *display;	/* Display the event was read from */
 592	Window window;
 593	byte key_vector[32];
 594};
 595
 596struct XExposeEvent
 597{
 598	int type;
 599	Culong serial;	/* # of last request processed by server */
 600	Bool send_event;	/* true if this came from a SendEvent request */
 601	Display *display;	/* Display the event was read from */
 602	Window window;
 603	int x, y;
 604	int width, height;
 605	int count;		/* if non-zero, at least this many more */
 606};
 607
 608struct XGraphicsExposeEvent{
 609	int type;
 610	Culong serial;	/* # of last request processed by server */
 611	Bool send_event;	/* true if this came from a SendEvent request */
 612	Display *display;	/* Display the event was read from */
 613	Drawable drawable;
 614	int x, y;
 615	int width, height;
 616	int count;		/* if non-zero, at least this many more */
 617	int major_code;		/* core is CopyArea or CopyPlane */
 618	int minor_code;		/* not defined in the core */
 619};
 620
 621struct XNoExposeEvent{
 622	int type;
 623	Culong serial;	/* # of last request processed by server */
 624	Bool send_event;	/* true if this came from a SendEvent request */
 625	Display *display;	/* Display the event was read from */
 626	Drawable drawable;
 627	int major_code;		/* core is CopyArea or CopyPlane */
 628	int minor_code;		/* not defined in the core */
 629};
 630
 631struct XVisibilityEvent{
 632	int type;
 633	Culong serial;	/* # of last request processed by server */
 634	Bool send_event;	/* true if this came from a SendEvent request */
 635	Display *display;	/* Display the event was read from */
 636	Window window;
 637	VisibilityNotify state;		/* Visibility state */
 638};
 639
 640struct XCreateWindowEvent{
 641	int type;
 642	Culong serial;	/* # of last request processed by server */
 643	Bool send_event;	/* true if this came from a SendEvent request */
 644	Display *display;	/* Display the event was read from */
 645	Window parent;		/* parent of the window */
 646	Window window;		/* window id of window created */
 647	int x, y;		/* window location */
 648	int width, height;	/* size of window */
 649	int border_width;	/* border width */
 650	Bool override_redirect;	/* creation should be overridden */
 651};
 652
 653struct XDestroyWindowEvent
 654{
 655	int type;
 656	Culong serial;		/* # of last request processed by server */
 657	Bool send_event;	/* true if this came from a SendEvent request */
 658	Display *display;	/* Display the event was read from */
 659	Window event;
 660	Window window;
 661};
 662
 663struct XUnmapEvent
 664{
 665	int type;
 666	Culong serial;		/* # of last request processed by server */
 667	Bool send_event;	/* true if this came from a SendEvent request */
 668	Display *display;	/* Display the event was read from */
 669	Window event;
 670	Window window;
 671	Bool from_configure;
 672};
 673
 674struct XMapEvent
 675{
 676	int type;
 677	Culong serial;		/* # of last request processed by server */
 678	Bool send_event;	/* true if this came from a SendEvent request */
 679	Display *display;	/* Display the event was read from */
 680	Window event;
 681	Window window;
 682	Bool override_redirect;	/* Boolean, is override set... */
 683};
 684
 685struct XMapRequestEvent
 686{
 687	int type;
 688	Culong serial;	/* # of last request processed by server */
 689	Bool send_event;	/* true if this came from a SendEvent request */
 690	Display *display;	/* Display the event was read from */
 691	Window parent;
 692	Window window;
 693};
 694
 695struct XReparentEvent
 696{
 697	int type;
 698	Culong serial;	/* # of last request processed by server */
 699	Bool send_event;	/* true if this came from a SendEvent request */
 700	Display *display;	/* Display the event was read from */
 701	Window event;
 702	Window window;
 703	Window parent;
 704	int x, y;
 705	Bool override_redirect;
 706};
 707
 708struct XConfigureEvent
 709{
 710	int type;
 711	Culong serial;	/* # of last request processed by server */
 712	Bool send_event;	/* true if this came from a SendEvent request */
 713	Display *display;	/* Display the event was read from */
 714	Window event;
 715	Window window;
 716	int x, y;
 717	int width, height;
 718	int border_width;
 719	Window above;
 720	Bool override_redirect;
 721};
 722
 723struct XGravityEvent
 724{
 725	int type;
 726	Culong serial;	/* # of last request processed by server */
 727	Bool send_event;	/* true if this came from a SendEvent request */
 728	Display *display;	/* Display the event was read from */
 729	Window event;
 730	Window window;
 731	int x, y;
 732};
 733
 734struct XResizeRequestEvent
 735{
 736	int type;
 737	Culong serial;	/* # of last request processed by server */
 738	Bool send_event;	/* true if this came from a SendEvent request */
 739	Display *display;	/* Display the event was read from */
 740	Window window;
 741	int width, height;
 742};
 743
 744struct  XConfigureRequestEvent
 745{
 746	int type;
 747	Culong serial;	/* # of last request processed by server */
 748	Bool send_event;	/* true if this came from a SendEvent request */
 749	Display *display;	/* Display the event was read from */
 750	Window parent;
 751	Window window;
 752	int x, y;
 753	int width, height;
 754	int border_width;
 755	Window above;
 756	WindowStackingMethod detail;		/* Above, Below, TopIf, BottomIf, Opposite */
 757	Culong value_mask;
 758};
 759
 760struct XCirculateEvent
 761{
 762	int type;
 763	Culong serial;	/* # of last request processed by server */
 764	Bool send_event;	/* true if this came from a SendEvent request */
 765	Display *display;	/* Display the event was read from */
 766	Window event;
 767	Window window;
 768	CirculationRequest place;		/* PlaceOnTop, PlaceOnBottom */
 769};
 770
 771struct XCirculateRequestEvent
 772{
 773	int type;
 774	Culong serial;	/* # of last request processed by server */
 775	Bool send_event;	/* true if this came from a SendEvent request */
 776	Display *display;	/* Display the event was read from */
 777	Window parent;
 778	Window window;
 779	CirculationRequest place;		/* PlaceOnTop, PlaceOnBottom */
 780};
 781
 782struct XPropertyEvent
 783{
 784	int type;
 785	Culong serial;	/* # of last request processed by server */
 786	Bool send_event;	/* true if this came from a SendEvent request */
 787	Display *display;	/* Display the event was read from */
 788	Window window;
 789	Atom atom;
 790	Time time;
 791	PropertyNotification state;		/* NewValue, Deleted */
 792};
 793
 794struct XSelectionClearEvent
 795{
 796	int type;
 797	Culong serial;	/* # of last request processed by server */
 798	Bool send_event;	/* true if this came from a SendEvent request */
 799	Display *display;	/* Display the event was read from */
 800	Window window;
 801	Atom selection;
 802	Time time;
 803};
 804
 805struct XSelectionRequestEvent
 806{
 807	int type;
 808	Culong serial;	/* # of last request processed by server */
 809	Bool send_event;	/* true if this came from a SendEvent request */
 810	Display *display;	/* Display the event was read from */
 811	Window owner;
 812	Window requestor;
 813	Atom selection;
 814	Atom target;
 815	Atom property;
 816	Time time;
 817};
 818
 819struct XSelectionEvent
 820{
 821	int type;
 822	Culong serial;	/* # of last request processed by server */
 823	Bool send_event;	/* true if this came from a SendEvent request */
 824	Display *display;	/* Display the event was read from */
 825	Window requestor;
 826	Atom selection;
 827	Atom target;
 828	Atom property;		/* ATOM or None */
 829	Time time;
 830} ;
 831
 832struct XColormapEvent
 833{
 834	int type;
 835	Culong serial;	/* # of last request processed by server */
 836	Bool send_event;	/* true if this came from a SendEvent request */
 837	Display *display;	/* Display the event was read from */
 838	Window window;
 839	Colormap colormap;	/* COLORMAP or None */
 840	Bool new_;		/* C++ */
 841	ColorMapNotification state;		/* ColormapInstalled, ColormapUninstalled */
 842};
 843
 844union XClientMessageEvent_data{
 845	byte b[20];
 846	short s[10];
 847	Clong l[5];
 848	};
 849
 850struct XClientMessageEvent
 851{
 852	int type;
 853	Culong serial;	/* # of last request processed by server */
 854	Bool send_event;	/* true if this came from a SendEvent request */
 855	Display *display;	/* Display the event was read from */
 856	Window window;
 857	Atom message_type;
 858	int format;
 859	XClientMessageEvent_data data;
 860};
 861
 862struct XMappingEvent
 863{
 864	int type;
 865	Culong serial;	/* # of last request processed by server */
 866	Bool send_event;	/* true if this came from a SendEvent request */
 867	Display *display;	/* Display the event was read from */
 868	Window window;		/* unused */
 869	MappingType request;		/* one of MappingModifier, MappingKeyboard,
 870				   MappingPointer */
 871	int first_keycode;	/* first keycode */
 872	int count;		/* defines range of change w. first_keycode*/
 873};
 874
 875struct XErrorEvent
 876{
 877	int type;
 878	Display *display;	/* Display the event was read from */
 879	XID resourceid;		/* resource id */
 880	Culong serial;	/* serial number of failed request */
 881	uint error_code;	/* error code of failed request */
 882	ubyte request_code;	/* Major op-code of failed request */
 883	ubyte minor_code;	/* Minor op-code of failed request */
 884};
 885
 886struct XAnyEvent
 887{
 888	int type;
 889	Culong serial;	/* # of last request processed by server */
 890	Bool send_event;	/* true if this came from a SendEvent request */
 891	Display *display;/* Display the event was read from */
 892	Window window;	/* window on which event was requested in event mask */
 893};
 894
 895/*
 896 * this union is defined so Xlib can always use the same sized
 897 * event structure internally, to avoid memory fragmentation.
 898 */
 899union XEvent{
 900    int type;		/* must not be changed; first element */
 901	XAnyEvent xany;
 902	XKeyEvent xkey;
 903	XButtonEvent xbutton;
 904	XMotionEvent xmotion;
 905	XCrossingEvent xcrossing;
 906	XFocusChangeEvent xfocus;
 907	XExposeEvent xexpose;
 908	XGraphicsExposeEvent xgraphicsexpose;
 909	XNoExposeEvent xnoexpose;
 910	XVisibilityEvent xvisibility;
 911	XCreateWindowEvent xcreatewindow;
 912	XDestroyWindowEvent xdestroywindow;
 913	XUnmapEvent xunmap;
 914	XMapEvent xmap;
 915	XMapRequestEvent xmaprequest;
 916	XReparentEvent xreparent;
 917	XConfigureEvent xconfigure;
 918	XGravityEvent xgravity;
 919	XResizeRequestEvent xresizerequest;
 920	XConfigureRequestEvent xconfigurerequest;
 921	XCirculateEvent xcirculate;
 922	XCirculateRequestEvent xcirculaterequest;
 923	XPropertyEvent xproperty;
 924	XSelectionClearEvent xselectionclear;
 925	XSelectionRequestEvent xselectionrequest;
 926	XSelectionEvent xselection;
 927	XColormapEvent xcolormap;
 928	XClientMessageEvent xclient;
 929	XMappingEvent xmapping;
 930	XErrorEvent xerror;
 931	XKeymapEvent xkeymap;
 932	long pad[24];
 933};
 934
 935
 936int XAllocID(Display* dpy) {return dpy.resource_alloc(dpy);}
 937
 938
 939/*
 940 * per character font metric information.
 941 */
 942struct XCharStruct
 943{
 944    short	lbearing;	/* origin to left edge of raster */
 945    short	rbearing;	/* origin to right edge of raster */
 946    short	width;		/* advance to next char's origin */
 947    short	ascent;		/* baseline to top edge of raster */
 948    short	descent;	/* baseline to bottom edge of raster */
 949    ushort 	attributes;	/* per char flags (not predefined) */
 950};
 951
 952/*
 953 * To allow arbitrary information with fonts, there are additional properties
 954 * returned.
 955 */
 956struct XFontProp
 957{
 958    Atom name;
 959    Culong card32;
 960};
 961
 962struct XFontStruct{
 963    XExtData	*ext_data;			/* hook for extension to hang data */
 964    Font        fid;            	/* Font id for this font */
 965    FontDrawDirection	direction;	/* hint about direction the font is painted */
 966    uint		min_char_or_byte2;	/* first character */
 967    uint		max_char_or_byte2;	/* last character */
 968    uint		min_byte1;			/* first row that exists */
 969    uint		max_byte1;			/* last row that exists */
 970    Bool		all_chars_exist;	/* flag if all characters have non-zero size*/
 971    uint		default_char;		/* char to print for undefined character */
 972    int         n_properties;   	/* how many properties there are */
 973    XFontProp	*properties;		/* pointer to array of additional properties*/
 974    XCharStruct	min_bounds;		/* minimum bounds over all existing char*/
 975    XCharStruct	max_bounds;		/* maximum bounds over all existing char*/
 976    XCharStruct	*per_char;			/* first_char to last_char information */
 977    int			ascent;				/* log. extent above baseline for spacing */
 978    int			descent;			/* log. descent below baseline for spacing */
 979};
 980
 981/*
 982 * PolyText routines take these as arguments.
 983 */
 984struct XTextItem{
 985    char 	*chars;			/* pointer to string */
 986    int 	nchars;			/* number of characters */
 987    int 	delta;			/* delta between strings */
 988    Font 	font;			/* font to print it in, None don't change */
 989};
 990
 991struct XChar2b
 992{		/* normal 16 bit characters are two bytes */
 993align(1):
 994    ubyte byte1;
 995    ubyte byte2;
 996};
 997
 998
 999struct XTextItem16
1000{
1001    XChar2b *chars;			/* two byte characters */
1002    int 	nchars;			/* number of characters */
1003    int 	delta;			/* delta between strings */
1004    Font 	font;			/* font to print it in, None don't change */
1005}
1006
1007
1008union XEDataObject
1009{
1010	Display 	*display;
1011	GC 			gc;
1012	Visual 		*visual;
1013	Screen 		*screen;
1014	ScreenFormat *pixmap_format;
1015	XFontStruct *font;
1016} ;
1017
1018struct XFontSetExtents{
1019    XRectangle	max_ink_extent;
1020    XRectangle	max_logical_extent;
1021};
1022
1023/* unused:
1024typedef void (*XOMProc)();
1025 */
1026
1027struct _XOM{}
1028struct _XOC{}
1029typedef _XOM *XOM;
1030typedef _XOC *XOC;
1031typedef _XOC *XFontSet;
1032struct XmbTextItem{
1033    byte		*chars;
1034    int			nchars;
1035    int			delta;
1036    XFontSet	font_set;
1037};
1038
1039struct XwcTextItem{
1040    wchar        	*chars;
1041    int             nchars;
1042    int             delta;
1043    XFontSet        font_set;
1044} ;
1045
1046
1047static char[] XNRequiredCharSet = "requiredCharSet";
1048static char[] XNQueryOrientation = "queryOrientation";
1049static char[] XNBaseFontName = "baseFontName";
1050static char[] XNOMAutomatic = "omAutomatic";
1051static char[] XNMissingCharSet = "missingCharSet";
1052static char[] XNDefaultString = "defaultString";
1053static char[] XNOrientation = "orientation";
1054static char[] XNDirectionalDependentDrawing = "directionalDependentDrawing";
1055static char[] XNContextualDrawing = "contextualDrawing";
1056static char[] XNFontInfo = "fontInfo";
1057
1058
1059struct XOMCharSetList
1060{
1061    int charset_count;
1062    byte **charset_list;
1063};
1064
1065enum XOrientation
1066{
1067    XOMOrientation_LTR_TTB,
1068    XOMOrientation_RTL_TTB,
1069    XOMOrientation_TTB_LTR,
1070    XOMOrientation_TTB_RTL,
1071    XOMOrientation_Context
1072};
1073
1074struct XOMOrientation{
1075    int num_orientation;
1076    XOrientation *orientation;	/* Input Text description */
1077};
1078
1079struct XOMFontInfo{
1080    int num_font;
1081    XFontStruct **font_struct_list;
1082    byte **font_name_list;
1083} ;
1084
1085struct _XIM{}
1086struct _XIC{}
1087typedef _XIM *XIM;
1088typedef _XIC *XIC;
1089
1090
1091typedef void function(
1092    XIM,
1093    XPointer,
1094    XPointer
1095) XIMProc;
1096
1097typedef Bool function(
1098    XIC,
1099    XPointer,
1100    XPointer
1101)XICProc;
1102
1103typedef void function(
1104    Display*,
1105    XPointer,
1106    XPointer
1107)XIDProc;
1108
1109enum  XIMStyle:uint
1110{
1111	XIMPreeditArea			=0x0001L,
1112	XIMPreeditCallbacks		=0x0002L,
1113	XIMPreeditPosition		=0x0004L,
1114	XIMPreeditNothing		=0x0008L,
1115	XIMPreeditNone			=0x0010L,
1116	XIMStatusArea			=0x0100L,
1117	XIMStatusCallbacks		=0x0200L,
1118	XIMStatusNothing		=0x0400L,
1119	XIMStatusNone			=0x0800L
1120}
1121
1122struct XIMStyles{
1123    ushort count_styles;
1124    XIMStyle *supported_styles;
1125};
1126
1127const char[] XNVaNestedList ="XNVaNestedList";
1128const char[] XNQueryInputStyle ="queryInputStyle";
1129const char[] XNClientWindow ="clientWindow";
1130const char[] XNInputStyle ="inputStyle";
1131const char[] XNFocusWindow ="focusWindow";
1132const char[] XNResourceName ="resourceName";
1133const char[] XNResourceClass ="resourceClass";
1134const char[] XNGeometryCallback ="geometryCallback";
1135const char[] XNDestroyCallback ="destroyCallback";
1136const char[] XNFilterEvents ="filterEvents";
1137const char[] XNPreeditStartCallback ="preeditStartCallback";
1138const char[] XNPreeditDoneCallback ="preeditDoneCallback";
1139const char[] XNPreeditDrawCallback ="preeditDrawCallback";
1140const char[] XNPreeditCaretCallback ="preeditCaretCallback";
1141const char[] XNPreeditStateNotifyCallback ="preeditStateNotifyCallback";
1142const char[] XNPreeditAttributes ="preeditAttributes";
1143const char[] XNStatusStartCallback ="statusStartCallback";
1144const char[] XNStatusDoneCallback ="statusDoneCallback";
1145const char[] XNStatusDrawCallback ="statusDrawCallback";
1146const char[] XNStatusAttributes ="statusAttributes";
1147const char[] XNArea ="area";
1148const char[] XNAreaNeeded ="areaNeeded";
1149const char[] XNSpotLocation ="spotLocation";
1150const char[] XNColormap ="colorMap";
1151const char[] XNStdColormap ="stdColorMap";
1152const char[] XNForeground ="foreground";
1153const char[] XNBackground ="background";
1154const char[] XNBackgroundPixmap ="backgroundPixmap";
1155const char[] XNFontSet ="fontSet";
1156const char[] XNLineSpace ="lineSpace";
1157const char[] XNCursor ="cursor";
1158
1159const char[] XNQueryIMValuesList ="queryIMValuesList";
1160const char[] XNQueryICValuesList ="queryICValuesList";
1161const char[] XNVisiblePosition ="visiblePosition";
1162const char[] XNR6PreeditCallback ="r6PreeditCallback";
1163const char[] XNStringConversionCallback ="stringConversionCallback";
1164const char[] XNStringConversion ="stringConversion";
1165const char[] XNResetState ="resetState";
1166const char[] XNHotKey ="hotKey";
1167const char[] XNHotKeyState ="hotKeyState";
1168const char[] XNPreeditState ="preeditState";
1169const char[] XNSeparatorofNestedList ="separatorofNestedList";
1170
1171const int XBufferOverflow=		-1;
1172const int XLookupNone=		1;
1173const int XLookupChars=		2;
1174const int XLookupKeySym=		3;
1175const int XLookupBoth	=	4;
1176
1177
1178typedef void *XVaNestedList;
1179
1180struct XIMCallback{
1181    XPointer client_data;
1182    XIMProc callback;
1183};
1184
1185struct XICCallback{
1186    XPointer client_data;
1187    XICProc callback;
1188};
1189
1190enum XIMFeedback:uint
1191{
1192	XIMReverse			=1,
1193	XIMUnderline		=1<<1,
1194	XIMHighlight		=1<<2,
1195	XIMPrimary	 		=1<<5,
1196	XIMSecondary		=1<<6,
1197	XIMTertiary	 		=1<<7,
1198	XIMVisibleToForward =1<<8,
1199	XIMVisibleToBackword=1<<9,
1200	XIMVisibleToCenter 	=1<<10
1201}
1202
1203struct XIMText {
1204    ushort length;
1205    XIMFeedback *feedback;
1206    Bool encoding_is_wchar;
1207    union string
1208    {
1209		byte *multi_byte;
1210		wchar *wide_char;
1211    };
1212};
1213
1214enum XIMPreeditState:uint
1215{
1216	XIMPreeditUnKnown	=0L,
1217	XIMPreeditEnable	=1L,
1218	XIMPreeditDisable	=1L<<1
1219}
1220
1221struct	XIMPreeditStateNotifyCallbackStruct
1222{
1223    XIMPreeditState state;
1224}
1225
1226enum XIMResetState:uint
1227{
1228	XIMInitialState		=1L,
1229	XIMPreserveState	=1L<<1
1230}
1231
1232enum XIMStringConversionFeedback:uint
1233{
1234	XIMStringConversionLeftEdge		=0x00000001,
1235	XIMStringConversionRightEdge	=0x00000002,
1236	XIMStringConversionTopEdge		=0x00000004,
1237	XIMStringConversionBottomEdge	=0x00000008,
1238	XIMStringConversionConcealed	=0x00000010,
1239	XIMStringConversionWrapped		=0x00000020
1240}
1241
1242struct XIMStringConversionText {
1243    uint length;
1244    XIMStringConversionFeedback *feedback;
1245    Bool encoding_is_wchar;
1246    union string
1247    {
1248		byte *mbs;
1249		wchar *wcs;
1250    };
1251};
1252
1253typedef	ushort	XIMStringConversionPosition;
1254
1255enum XIMStringConversionType:ushort
1256{
1257	XIMStringConversionBuffer	=0x0001,
1258	XIMStringConversionLine		=0x0002,
1259	XIMStringConversionWord		=0x0003,
1260	XIMStringConversionChar		=0x0004
1261}
1262
1263enum XIMStringConversionOperation:ushort
1264{
1265	XIMStringConversionSubstitution	=0x0001,
1266	XIMStringConversionRetrieval	=0x0002
1267}
1268
1269enum XIMCaretDirection:int{
1270    XIMForwardChar, XIMBackwardChar,
1271    XIMForwardWord, XIMBackwardWord,
1272    XIMCaretUp, XIMCaretDown,
1273    XIMNextLine, XIMPreviousLine,
1274    XIMLineStart, XIMLineEnd,
1275    XIMAbsolutePosition,
1276    XIMDontChange
1277};
1278
1279struct XIMStringConversionCallbackStruct {
1280    XIMStringConversionPosition position;
1281    XIMCaretDirection direction;
1282    XIMStringConversionOperation operation;
1283    ushort factor;
1284    XIMStringConversionText *text;
1285};
1286
1287struct XIMPreeditDrawCallbackStruct {
1288    int caret;		/* Cursor offset within pre-edit string */
1289    int chg_first;	/* Starting change position */
1290    int chg_length;	/* Length of the change in character count */
1291    XIMText *text;
1292} ;
1293
1294enum XIMCaretStyle{
1295    XIMIsInvisible,	/* Disable caret feedback */
1296    XIMIsPrimary,	/* UI defined caret feedback */
1297    XIMIsSecondary	/* UI defined caret feedback */
1298};
1299
1300struct XIMPreeditCaretCallbackStruct {
1301    int position;		 /* Caret offset within pre-edit string */
1302    XIMCaretDirection direction; /* Caret moves direction */
1303    XIMCaretStyle style;	 /* Feedback of the caret */
1304};
1305
1306enum XIMStatusDataType{
1307    XIMTextType,
1308    XIMBitmapType
1309};
1310
1311struct XIMStatusDrawCallbackStruct {
1312    XIMStatusDataType type;
1313    union data{
1314	XIMText *text;
1315	Pixmap  bitmap;
1316    } ;
1317};
1318
1319struct XIMHotKeyTrigger {
1320    KeySym	 keysym;
1321    int		 modifier;
1322    int		 modifier_mask;
1323} ;
1324
1325struct XIMHotKeyTriggers {
1326    int			 num_hot_key;
1327    XIMHotKeyTrigger	*key;
1328};
1329
1330enum XIMHotKeyState:uint
1331{
1332	XIMHotKeyStateON	=0x0001L,
1333	XIMHotKeyStateOFF	=0x0002L
1334}
1335
1336struct XIMValuesList{
1337    ushort count_values;
1338    byte **supported_values;
1339};
1340
1341/* FUNCTION PROTOTYPES*/
1342extern (C)
1343{
1344
1345extern int _Xdebug;
1346
1347extern XFontStruct *XLoadQueryFont(
1348    Display*		/* display */,
1349    byte*		/* name */
1350);
1351
1352extern XFontStruct *XQueryFont(
1353    Display*		/* display */,
1354    XID				/* font_ID */
1355);
1356
1357
1358extern XTimeCoord *XGetMotionEvents(
1359    Display*		/* display */,
1360    Window		/* w */,
1361    Time		/* start */,
1362    Time		/* stop */,
1363    int*		/* nevents_return */
1364);
1365
1366extern XModifierKeymap *XDeleteModifiermapEntry(
1367    XModifierKeymap*	/* modmap */,
1368    KeyCode		/* keycode_entry */,
1369    int			/* modifier */
1370);
1371
1372extern XModifierKeymap	*XGetModifierMapping(
1373    Display*		/* display */
1374);
1375
1376extern XModifierKeymap	*XInsertModifiermapEntry(
1377    XModifierKeymap*	/* modmap */,
1378    KeyCode		/* keycode_entry */,
1379    int			/* modifier */
1380);
1381
1382extern XModifierKeymap *XNewModifiermap(
1383    int			/* max_keys_per_mod */
1384);
1385
1386extern XImage *XCreateImage(
1387    Display*		/* display */,
1388    Visual*		/* visual */,
1389    uint	/* depth */,
1390    int			/* format */,
1391    int			/* offset */,
1392    byte*		/* data */,
1393    uint	/* width */,
1394    uint	/* height */,
1395    int			/* bitmap_pad */,
1396    int			/* bytes_per_line */
1397);
1398extern Status XInitImage(
1399    XImage*		/* image */
1400);
1401extern XImage *XGetImage(
1402    Display*		/* display */,
1403    Drawable		/* d */,
1404    int			/* x */,
1405    int			/* y */,
1406    uint	/* width */,
1407    uint	/* height */,
1408    Culong	/* plane_mask */,
1409    ImageFormat	/* format */
1410);
1411extern XImage *XGetSubImage(
1412    Display*		/* display */,
1413    Drawable		/* d */,
1414    int			/* x */,
1415    int			/* y */,
1416    uint	/* width */,
1417    uint	/* height */,
1418    Culong	/* plane_mask */,
1419    int			/* format */,
1420    XImage*		/* dest_image */,
1421    int			/* dest_x */,
1422    int			/* dest_y */
1423);
1424
1425/*
1426 * X function declarations.
1427 */
1428extern Display *XOpenDisplay(
1429    byte*	/* display_name */
1430);
1431
1432extern void XrmInitialize();
1433
1434extern byte *XFetchBytes(
1435    Display*		/* display */,
1436    int*		/* nbytes_return */
1437);
1438extern byte *XFetchBuffer(
1439    Display*		/* display */,
1440    int*		/* nbytes_return */,
1441    int			/* buffer */
1442);
1443extern byte *XGetAtomName(
1444    Display*		/* display */,
1445    Atom		/* atom */
1446);
1447extern Status XGetAtomNames(
1448    Display*		/* dpy */,
1449    Atom*		/* atoms */,
1450    int			/* count */,
1451    byte**		/* names_return */
1452);
1453extern byte *XGetDefault(
1454    Display*		/* display */,
1455    byte*	/* program */,
1456    byte*	/* option */
1457);
1458extern char *XDisplayName(
1459    char*	/* string */
1460);
1461extern char *XKeysymToString(
1462    KeySym		/* keysym */
1463);
1464
1465
1466extern int function(Display*/* display */,Bool		/* onoff */)XSynchronize(
1467    Display*		/* display */
1468);
1469extern int function(
1470    Display*		/* display */,
1471    int function(
1472	     Display*	/* display */
1473            )		/* procedure */
1474)XSetAfterFunction(
1475    Display*		/* display */
1476);
1477
1478
1479extern Atom XInternAtom(
1480    Display*		/* display */,
1481    char*	/* atom_name */,
1482    Bool		/* only_if_exists */
1483);
1484
1485extern Status XInternAtoms(
1486    Display*		/* dpy */,
1487    byte**		/* names */,
1488    int			/* count */,
1489    Bool		/* onlyIfExists */,
1490    Atom*		/* atoms_return */
1491);
1492
1493extern Colormap XCopyColormapAndFree(
1494    Display*		/* display */,
1495    Colormap		/* colormap */
1496);
1497extern Colormap XCreateColormap(
1498    Display*		/* display */,
1499    Window		/* w */,
1500    Visual*		/* visual */,
1501    int			/* alloc */
1502);
1503extern Cursor XCreatePixmapCursor(
1504    Display*		/* display */,
1505    Pixmap		/* source */,
1506    Pixmap		/* mask */,
1507    XColor*		/* foreground_color */,
1508    XColor*		/* background_color */,
1509    uint	/* x */,
1510    uint	/* y */
1511);
1512extern Cursor XCreateGlyphCursor(
1513    Display*		/* display */,
1514    Font		/* source_font */,
1515    Font		/* mask_font */,
1516    uint	/* source_char */,
1517    uint	/* mask_char */,
1518    XColor*	/* foreground_color */,
1519    XColor*	/* background_color */
1520);
1521extern Cursor XCreateFontCursor(
1522    Display*		/* display */,
1523    uint	/* shape */
1524);
1525extern Font XLoadFont(
1526    Display*		/* display */,
1527    byte*	/* name */
1528);
1529extern GC XCreateGC(
1530    Display*		/* display */,
1531    Drawable		/* d */,
1532    Culong		/* valuemask */,
1533    XGCValues*		/* values */
1534);
1535extern GContext XGContextFromGC(
1536    GC			/* gc */
1537);
1538extern void XFlushGC(
1539    Display*		/* display */,
1540    GC			/* gc */
1541);
1542extern Pixmap XCreatePixmap(
1543    Display*		/* display */,
1544    Drawable		/* d */,
1545    uint		/* width */,
1546    uint		/* height */,
1547    uint		/* depth */
1548);
1549extern Pixmap XCreateBitmapFromData(
1550    Display*	/* display */,
1551    Drawable	/* d */,
1552    byte*		/* data */,
1553    uint		/* width */,
1554    uint		/* height */
1555);
1556extern Pixmap XCreatePixmapFromBitmapData(
1557    Display*	/* display */,
1558    Drawable	/* d */,
1559    byte*		/* data */,
1560    uint		/* width */,
1561    uint		/* height */,
1562    Culong		/* fg */,
1563    Culong		/* bg */,
1564    uint		/* depth */
1565);
1566extern Window XCreateSimpleWindow(
1567    Display*	/* display */,
1568    Window		/* parent */,
1569    int			/* x */,
1570    int			/* y */,
1571    uint		/* width */,
1572    uint		/* height */,
1573    uint		/* border_width */,
1574    Culong		/* border */,
1575    Culong		/* background */
1576);
1577extern Window XGetSelectionOwner(
1578    Display*	/* display */,
1579    Atom		/* selection */
1580);
1581extern Window XCreateWindow(
1582    Display*	/* display */,
1583    Window		/* parent */,
1584    int			/* x */,
1585    int			/* y */,
1586    uint		/* width */,
1587    uint		/* height */,
1588    uint		/* border_width */,
1589    int			/* depth */,
1590    WindowClass		/* class */,
1591    Visual*		/* visual */,
1592    WindowAttribute		/* valuemask */,
1593    XSetWindowAttributes*	/* attributes */
1594);
1595extern Colormap *XListInstalledColormaps(
1596    Display*	/* display */,
1597    Window		/* w */,
1598    int*		/* num_return */
1599);
1600extern byte **XListFonts(
1601    Display*	/* display */,
1602    byte*		/* pattern */,
1603    int			/* maxnames */,
1604    int*		/* actual_count_return */
1605);
1606extern byte **XListFontsWithInfo(
1607    Display*	/* display */,
1608    byte*	    /* pattern */,
1609    int			/* maxnames */,
1610    int*		/* count_return */,
1611    XFontStruct**	/* info_return */
1612);
1613extern byte **XGetFontPath(
1614    Display*		/* display */,
1615    int*		/* npaths_return */
1616);
1617extern byte **XListExtensions(
1618    Display*	/* display */,
1619    int*		/* nextensions_return */
1620);
1621extern Atom *XListProperties(
1622    Display*	/* display */,
1623    Window		/* w */,
1624    int*		/* num_prop_return */
1625);
1626extern XHostAddress *XListHosts(
1627    Display*		/* display */,
1628    int*		/* nhosts_return */,
1629    Bool*		/* state_return */
1630);
1631extern KeySym XKeycodeToKeysym(
1632    Display*	/* display */,
1633    KeyCode		/* keycode */,
1634    int			/* index */
1635);
1636extern KeySym XLookupKeysym(
1637    XKeyEvent*	/* key_event */,
1638    int			/* index */
1639);
1640extern KeySym *XGetKeyboardMapping(
1641    Display*		/* display */,
1642    KeyCode		/* first_keycode */,
1643    int			/* keycode_count */,
1644    int*		/* keysyms_per_keycode_return */
1645);
1646extern KeySym XStringToKeysym(
1647    char*	/* string */
1648);
1649extern Clong XMaxRequestSize(
1650    Display*		/* display */
1651);
1652extern Clong XExtendedMaxRequestSize(
1653    Display*		/* display */
1654);
1655extern char *XResourceManagerString(
1656    Display*		/* display */
1657);
1658extern char *XScreenResourceString(
1659	Screen*		/* screen */
1660);
1661extern Culong XDisplayMotionBufferSize(
1662    Display*		/* display */
1663);
1664extern VisualID XVisualIDFromVisual(
1665    Visual*		/* visual */
1666);
1667
1668/* multithread routines */
1669
1670extern Status XInitThreads();
1671
1672extern void XLockDisplay(
1673    Display*		/* display */
1674);
1675
1676extern void XUnlockDisplay(
1677    Display*		/* display */
1678);
1679
1680/* routines for dealing with extensions */
1681
1682extern XExtCodes *XInitExtension(
1683    Display*		/* display */,
1684    byte*			/* name */
1685);
1686
1687extern XExtCodes *XAddExtension(
1688    Display*		/* display */
1689);
1690extern XExtData *XFindOnExtensionList(
1691    XExtData**		/* structure */,
1692    int				/* number */
1693);
1694extern XExtData **XEHeadOfExtensionList(
1695    XEDataObject	/* object */
1696);
1697
1698/* these are routines for which there are also macros */
1699extern Window XRootWindow(
1700    Display*		/* display */,
1701    int				/* screen_number */
1702);
1703extern Window XDefaultRootWindow(
1704    Display*		/* display */
1705);
1706extern Window XRootWindowOfScreen(
1707    Screen*			/* screen */
1708);
1709extern Visual *XDefaultVisual(
1710    Display*		/* display */,
1711    int				/* screen_number */
1712);
1713extern Visual *XDefaultVisualOfScreen(
1714    Screen*			/* screen */
1715);
1716extern GC XDefaultGC(
1717    Display*		/* display */,
1718    int				/* screen_number */
1719);
1720extern GC XDefaultGCOfScreen(
1721    Screen*			/* screen */
1722);
1723extern Culong XBlackPixel(
1724    Display*		/* display */,
1725    int				/* screen_number */
1726);
1727extern Culong XWhitePixel(
1728    Display*		/* display */,
1729    int				/* screen_number */
1730);
1731extern Culong XAllPlanes();
1732extern Culong XBlackPixelOfScreen(
1733    Screen*			/* screen */
1734);
1735extern Culong XWhitePixelOfScreen(
1736    Screen*		/* screen */
1737);
1738extern Culong XNextRequest(
1739    Display*		/* display */
1740);
1741extern Culong XLastKnownRequestProcessed(
1742    Display*		/* display */
1743);
1744extern char *XServerVendor(
1745    Display*		/* display */
1746);
1747extern char *XDisplayString(
1748    Display*		/* display */
1749);
1750extern Colormap XDefaultColormap(
1751    Display*		/* display */,
1752    int			/* screen_number */
1753);
1754extern Colormap XDefaultColormapOfScreen(
1755    Screen*		/* screen */
1756);
1757extern Display *XDisplayOfScreen(
1758    Screen*		/* screen */
1759);
1760extern Screen *XScreenOfDisplay(
1761    Display*		/* display */,
1762    int			/* screen_number */
1763);
1764extern Screen *XDefaultScreenOfDisplay(
1765    Display*		/* display */
1766);
1767extern Clong XEventMaskOfScreen(
1768    Screen*		/* screen */
1769);
1770
1771extern int XScreenNumberOfScreen(
1772    Screen*		/* screen */

Large files files are truncated, but you can click here to view the full file