xf86dga.nim 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #
  2. # Copyright (c) 1999 XFree86 Inc
  3. #
  4. # $XFree86: xc/include/extensions/xf86dga.h,v 3.20 1999/10/13 04:20:48 dawes Exp $
  5. import
  6. x, xlib
  7. const
  8. libXxf86dga* = "libXxf86dga.so"
  9. #type
  10. # cfloat* = float32
  11. # $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $
  12. #
  13. #
  14. #Copyright (c) 1995 Jon Tombs
  15. #Copyright (c) 1995 XFree86 Inc
  16. #
  17. #
  18. #************************************************************************
  19. #
  20. # THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE
  21. #
  22. #************************************************************************
  23. type
  24. PPcchar* = ptr ptr cstring
  25. const
  26. X_XF86DGAQueryVersion* = 0
  27. X_XF86DGAGetVideoLL* = 1
  28. X_XF86DGADirectVideo* = 2
  29. X_XF86DGAGetViewPortSize* = 3
  30. X_XF86DGASetViewPort* = 4
  31. X_XF86DGAGetVidPage* = 5
  32. X_XF86DGASetVidPage* = 6
  33. X_XF86DGAInstallColormap* = 7
  34. X_XF86DGAQueryDirectVideo* = 8
  35. X_XF86DGAViewPortChanged* = 9
  36. XF86DGADirectPresent* = 0x00000001
  37. XF86DGADirectGraphics* = 0x00000002
  38. XF86DGADirectMouse* = 0x00000004
  39. XF86DGADirectKeyb* = 0x00000008
  40. XF86DGAHasColormap* = 0x00000100
  41. XF86DGADirectColormap* = 0x00000200
  42. proc XF86DGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint,
  43. minorVersion: Pcint): TBool{.cdecl,
  44. dynlib: libXxf86dga, importc.}
  45. proc XF86DGAQueryExtension*(dpy: PDisplay, event_base: Pcint, error_base: Pcint): TBool{.
  46. cdecl, dynlib: libXxf86dga, importc.}
  47. proc XF86DGAGetVideoLL*(dpy: PDisplay, screen: cint, base_addr: Pcint,
  48. width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{.
  49. cdecl, dynlib: libXxf86dga, importc.}
  50. proc XF86DGAGetVideo*(dpy: PDisplay, screen: cint, base_addr: PPcchar,
  51. width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{.
  52. cdecl, dynlib: libXxf86dga, importc.}
  53. proc XF86DGADirectVideo*(dpy: PDisplay, screen: cint, enable: cint): TStatus{.
  54. cdecl, dynlib: libXxf86dga, importc.}
  55. proc XF86DGADirectVideoLL*(dpy: PDisplay, screen: cint, enable: cint): TStatus{.
  56. cdecl, dynlib: libXxf86dga, importc.}
  57. proc XF86DGAGetViewPortSize*(dpy: PDisplay, screen: cint, width: Pcint,
  58. height: Pcint): TStatus{.cdecl,
  59. dynlib: libXxf86dga, importc.}
  60. proc XF86DGASetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TStatus{.
  61. cdecl, dynlib: libXxf86dga, importc.}
  62. proc XF86DGAGetVidPage*(dpy: PDisplay, screen: cint, vid_page: Pcint): TStatus{.
  63. cdecl, dynlib: libXxf86dga, importc.}
  64. proc XF86DGASetVidPage*(dpy: PDisplay, screen: cint, vid_page: cint): TStatus{.
  65. cdecl, dynlib: libXxf86dga, importc.}
  66. proc XF86DGAInstallColormap*(dpy: PDisplay, screen: cint, Colormap: TColormap): TStatus{.
  67. cdecl, dynlib: libXxf86dga, importc.}
  68. proc XF86DGAForkApp*(screen: cint): cint{.cdecl, dynlib: libXxf86dga, importc.}
  69. proc XF86DGAQueryDirectVideo*(dpy: PDisplay, screen: cint, flags: Pcint): TStatus{.
  70. cdecl, dynlib: libXxf86dga, importc.}
  71. proc XF86DGAViewPortChanged*(dpy: PDisplay, screen: cint, n: cint): TBool{.
  72. cdecl, dynlib: libXxf86dga, importc.}
  73. const
  74. X_XDGAQueryVersion* = 0 # 1 through 9 are in xf86dga1.pp
  75. # 10 and 11 are reserved to avoid conflicts with rogue DGA extensions
  76. X_XDGAQueryModes* = 12
  77. X_XDGASetMode* = 13
  78. X_XDGASetViewport* = 14
  79. X_XDGAInstallColormap* = 15
  80. X_XDGASelectInput* = 16
  81. X_XDGAFillRectangle* = 17
  82. X_XDGACopyArea* = 18
  83. X_XDGACopyTransparentArea* = 19
  84. X_XDGAGetViewportStatus* = 20
  85. X_XDGASync* = 21
  86. X_XDGAOpenFramebuffer* = 22
  87. X_XDGACloseFramebuffer* = 23
  88. X_XDGASetClientVersion* = 24
  89. X_XDGAChangePixmapMode* = 25
  90. X_XDGACreateColormap* = 26
  91. XDGAConcurrentAccess* = 0x00000001
  92. XDGASolidFillRect* = 0x00000002
  93. XDGABlitRect* = 0x00000004
  94. XDGABlitTransRect* = 0x00000008
  95. XDGAPixmap* = 0x00000010
  96. XDGAInterlaced* = 0x00010000
  97. XDGADoublescan* = 0x00020000
  98. XDGAFlipImmediate* = 0x00000001
  99. XDGAFlipRetrace* = 0x00000002
  100. XDGANeedRoot* = 0x00000001
  101. XF86DGANumberEvents* = 7
  102. XDGAPixmapModeLarge* = 0
  103. XDGAPixmapModeSmall* = 1
  104. XF86DGAClientNotLocal* = 0
  105. XF86DGANoDirectVideoMode* = 1
  106. XF86DGAScreenNotActive* = 2
  107. XF86DGADirectNotActivated* = 3
  108. XF86DGAOperationNotSupported* = 4
  109. XF86DGANumberErrors* = (XF86DGAOperationNotSupported + 1)
  110. type
  111. PXDGAMode* = ptr TXDGAMode
  112. TXDGAMode*{.final.} = object
  113. num*: cint # A unique identifier for the mode (num > 0)
  114. name*: cstring # name of mode given in the XF86Config
  115. verticalRefresh*: cfloat
  116. flags*: cint # DGA_CONCURRENT_ACCESS, etc...
  117. imageWidth*: cint # linear accessible portion (pixels)
  118. imageHeight*: cint
  119. pixmapWidth*: cint # Xlib accessible portion (pixels)
  120. pixmapHeight*: cint # both fields ignored if no concurrent access
  121. bytesPerScanline*: cint
  122. byteOrder*: cint # MSBFirst, LSBFirst
  123. depth*: cint
  124. bitsPerPixel*: cint
  125. redMask*: culong
  126. greenMask*: culong
  127. blueMask*: culong
  128. visualClass*: cshort
  129. viewportWidth*: cint
  130. viewportHeight*: cint
  131. xViewportStep*: cint # viewport position granularity
  132. yViewportStep*: cint
  133. maxViewportX*: cint # max viewport origin
  134. maxViewportY*: cint
  135. viewportFlags*: cint # types of page flipping possible
  136. reserved1*: cint
  137. reserved2*: cint
  138. PXDGADevice* = ptr TXDGADevice
  139. TXDGADevice*{.final.} = object
  140. mode*: TXDGAMode
  141. data*: Pcuchar
  142. pixmap*: TPixmap
  143. PXDGAButtonEvent* = ptr TXDGAButtonEvent
  144. TXDGAButtonEvent*{.final.} = object
  145. theType*: cint
  146. serial*: culong
  147. display*: PDisplay
  148. screen*: cint
  149. time*: TTime
  150. state*: cuint
  151. button*: cuint
  152. PXDGAKeyEvent* = ptr TXDGAKeyEvent
  153. TXDGAKeyEvent*{.final.} = object
  154. theType*: cint
  155. serial*: culong
  156. display*: PDisplay
  157. screen*: cint
  158. time*: TTime
  159. state*: cuint
  160. keycode*: cuint
  161. PXDGAMotionEvent* = ptr TXDGAMotionEvent
  162. TXDGAMotionEvent*{.final.} = object
  163. theType*: cint
  164. serial*: culong
  165. display*: PDisplay
  166. screen*: cint
  167. time*: TTime
  168. state*: cuint
  169. dx*: cint
  170. dy*: cint
  171. PXDGAEvent* = ptr TXDGAEvent
  172. TXDGAEvent*{.final.} = object
  173. pad*: array[0..23, clong] # sorry you have to cast if you want access
  174. #Case LongInt Of
  175. # 0 : (_type : cint);
  176. # 1 : (xbutton : TXDGAButtonEvent);
  177. # 2 : (xkey : TXDGAKeyEvent);
  178. # 3 : (xmotion : TXDGAMotionEvent);
  179. # 4 : (pad : Array[0..23] Of clong);
  180. proc XDGAQueryExtension*(dpy: PDisplay, eventBase: Pcint, erroBase: Pcint): TBool{.
  181. cdecl, dynlib: libXxf86dga, importc.}
  182. proc XDGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint, minorVersion: Pcint): TBool{.
  183. cdecl, dynlib: libXxf86dga, importc.}
  184. proc XDGAQueryModes*(dpy: PDisplay, screen: cint, num: Pcint): PXDGAMode{.cdecl,
  185. dynlib: libXxf86dga, importc.}
  186. proc XDGASetMode*(dpy: PDisplay, screen: cint, mode: cint): PXDGADevice{.cdecl,
  187. dynlib: libXxf86dga, importc.}
  188. proc XDGAOpenFramebuffer*(dpy: PDisplay, screen: cint): TBool{.cdecl,
  189. dynlib: libXxf86dga, importc.}
  190. proc XDGACloseFramebuffer*(dpy: PDisplay, screen: cint){.cdecl,
  191. dynlib: libXxf86dga, importc.}
  192. proc XDGASetViewport*(dpy: PDisplay, screen: cint, x: cint, y: cint, flags: cint){.
  193. cdecl, dynlib: libXxf86dga, importc.}
  194. proc XDGAInstallColormap*(dpy: PDisplay, screen: cint, cmap: TColormap){.cdecl,
  195. dynlib: libXxf86dga, importc.}
  196. proc XDGACreateColormap*(dpy: PDisplay, screen: cint, device: PXDGADevice,
  197. alloc: cint): TColormap{.cdecl, dynlib: libXxf86dga,
  198. importc.}
  199. proc XDGASelectInput*(dpy: PDisplay, screen: cint, event_mask: clong){.cdecl,
  200. dynlib: libXxf86dga, importc.}
  201. proc XDGAFillRectangle*(dpy: PDisplay, screen: cint, x: cint, y: cint,
  202. width: cuint, height: cuint, color: culong){.cdecl,
  203. dynlib: libXxf86dga, importc.}
  204. proc XDGACopyArea*(dpy: PDisplay, screen: cint, srcx: cint, srcy: cint,
  205. width: cuint, height: cuint, dstx: cint, dsty: cint){.cdecl,
  206. dynlib: libXxf86dga, importc.}
  207. proc XDGACopyTransparentArea*(dpy: PDisplay, screen: cint, srcx: cint,
  208. srcy: cint, width: cuint, height: cuint,
  209. dstx: cint, dsty: cint, key: culong){.cdecl,
  210. dynlib: libXxf86dga, importc.}
  211. proc XDGAGetViewportStatus*(dpy: PDisplay, screen: cint): cint{.cdecl,
  212. dynlib: libXxf86dga, importc.}
  213. proc XDGASync*(dpy: PDisplay, screen: cint){.cdecl, dynlib: libXxf86dga, importc.}
  214. proc XDGASetClientVersion*(dpy: PDisplay): TBool{.cdecl, dynlib: libXxf86dga,
  215. importc.}
  216. proc XDGAChangePixmapMode*(dpy: PDisplay, screen: cint, x: Pcint, y: Pcint,
  217. mode: cint){.cdecl, dynlib: libXxf86dga, importc.}
  218. proc XDGAKeyEventToXKeyEvent*(dk: PXDGAKeyEvent, xk: PXKeyEvent){.cdecl,
  219. dynlib: libXxf86dga, importc.}
  220. # implementation