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