xlib.pp 4.3 KB

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