xlib.pp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {
  2. $Id$
  3. }
  4. {$MODE objfpc}
  5. {$LINKLIB X11}
  6. {$PACKRECORDS 4}
  7. unit xlib;
  8. interface
  9. type
  10. XID = LongWord;
  11. TVisualID = LongWord;
  12. PDisplay = Pointer;
  13. PVisual = Pointer;
  14. PXVisualInfo = ^TXVisualInfo;
  15. TXVisualInfo = record
  16. visual: PVisual;
  17. visualid: TVisualID;
  18. screen, depth, c_class: LongInt;
  19. red_mask, green_mask, blue_mask: LongWord;
  20. colormap_size, bits_per_rgb: LongInt;
  21. end;
  22. const
  23. VisualNoMask = 0;
  24. VisualIDMask = 1;
  25. VisualScreenMask = 2;
  26. VisualDepthMask = 4;
  27. VisualClassMask = 8;
  28. VisualRedMaskMask = $10;
  29. VisualGreenMaskMask = $20;
  30. VisualBlueMaskMask = $40;
  31. VisualColormapSizeMask = $80;
  32. VisualBitsPerRGBMask = $100;
  33. VisualAllMask = $1FF;
  34. function DefaultScreen(dpy: PDisplay): LongInt;
  35. function XFree(data: Pointer): LongInt; cdecl;
  36. function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl;
  37. function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl;
  38. implementation
  39. type
  40. PXExtData = Pointer;
  41. PXPrivate = Pointer;
  42. XPointer = PChar;
  43. PXrmHashBucketRec = Pointer;
  44. PScreenFormat = Pointer;
  45. PScreen = Pointer;
  46. PXPrivDisplay = ^TXPrivDisplay;
  47. TXPrivDisplay = record
  48. ext_data: PXExtData; // hook for extension to hang data
  49. private1: PXPrivate;
  50. fd: LongInt; // Network socket.
  51. private2: LongInt;
  52. proto_major_version: LongInt; // major version of server's X protocol
  53. proto_minor_version: LongInt; // minor version of server's X protocol
  54. vendor: PChar; // vendor of the server hardware
  55. private3, private4, private5: XID;
  56. private6: LongInt;
  57. resource_alloc: Pointer; // allocator function
  58. byte_order: LongInt; // screen byte order, LSBFirst, MSBFirst
  59. bitmap_unit: LongInt; // padding and data requirements
  60. bitmap_pad: LongInt; // padding requirements on bitmaps
  61. bitmap_bit_order: LongInt; // LeastSignificant or MostSignificant
  62. nformats: LongInt; // number of pixmap formats in list
  63. pixmap_format: PScreenFormat; // pixmap format list
  64. private8: LongInt;
  65. release: LongInt; // release of the server
  66. private9, private10: PXPrivate;
  67. qlen: LongInt; // Length of input event queue
  68. last_request_read: LongWord; // seq number of last event read
  69. request: LongWord; // sequence number of last request.
  70. private11, private12, private13,
  71. private14: XPointer;
  72. max_request_size: LongWord; // maximum number 32 bit words in request
  73. db: PXrmHashBucketRec;
  74. private15: Pointer;
  75. display_name: PChar; // "host:display" string used on this connect
  76. default_screen: LongInt; // default screen for operations
  77. nscreens: LongInt; // number of screens on this server
  78. screens: PScreen; // pointer to list of screens
  79. motion_buffer: LongWord; // size of motion buffer
  80. private16: LongWord;
  81. min_keycode: LongInt; // minimum defined keycode
  82. max_keycode: LongInt; // maximum defined keycode
  83. private17, private18: XPointer;
  84. private19: LongInt;
  85. xdefaults: PChar; // contents of defaults from server
  86. // there is more to this structure, but it is private to Xlib
  87. end;
  88. function DefaultScreen(dpy: PDisplay): LongInt;
  89. begin
  90. Result := PXPrivDisplay(dpy)^.default_screen;
  91. end;
  92. const
  93. libX = 'X11';
  94. function XFree(data: Pointer): LongInt; cdecl; external libX;
  95. function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl; external libX;
  96. function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl; external libX;
  97. end.
  98. {
  99. $Log$
  100. Revision 1.1 1999-11-28 17:55:22 sg
  101. * Added new unit generation tools and auto-generated GL units for Linux
  102. Revision 1.1 1999/11/10 14:15:33 sg
  103. * Added to CVS
  104. }