xf86vmode.nim 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $
  2. #
  3. #
  4. #Copyright 1995 Kaleb S. KEITHLEY
  5. #
  6. #Permission is hereby granted, free of charge, to any person obtaining
  7. #a copy of this software and associated documentation files (the
  8. #"Software"), to deal in the Software without restriction, including
  9. #without limitation the rights to use, copy, modify, merge, publish,
  10. #distribute, sublicense, and/or sell copies of the Software, and to
  11. #permit persons to whom the Software is furnished to do so, subject to
  12. #the following conditions:
  13. #
  14. #The above copyright notice and this permission notice shall be
  15. #included in all copies or substantial portions of the Software.
  16. #
  17. #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. #MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. #IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
  21. #OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22. #ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. #OTHER DEALINGS IN THE SOFTWARE.
  24. #
  25. #Except as contained in this notice, the name of Kaleb S. KEITHLEY
  26. #shall not be used in advertising or otherwise to promote the sale, use
  27. #or other dealings in this Software without prior written authorization
  28. #from Kaleb S. KEITHLEY
  29. #
  30. #
  31. # $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $
  32. # THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION
  33. import
  34. x, xlib
  35. const
  36. libXxf86vm* = "libXxf86vm.so"
  37. type
  38. PINT32* = ptr int32
  39. const
  40. X_XF86VidModeQueryVersion* = 0
  41. X_XF86VidModeGetModeLine* = 1
  42. X_XF86VidModeModModeLine* = 2
  43. X_XF86VidModeSwitchMode* = 3
  44. X_XF86VidModeGetMonitor* = 4
  45. X_XF86VidModeLockModeSwitch* = 5
  46. X_XF86VidModeGetAllModeLines* = 6
  47. X_XF86VidModeAddModeLine* = 7
  48. X_XF86VidModeDeleteModeLine* = 8
  49. X_XF86VidModeValidateModeLine* = 9
  50. X_XF86VidModeSwitchToMode* = 10
  51. X_XF86VidModeGetViewPort* = 11
  52. X_XF86VidModeSetViewPort* = 12 # new for version 2.x of this extension
  53. X_XF86VidModeGetDotClocks* = 13
  54. X_XF86VidModeSetClientVersion* = 14
  55. X_XF86VidModeSetGamma* = 15
  56. X_XF86VidModeGetGamma* = 16
  57. X_XF86VidModeGetGammaRamp* = 17
  58. X_XF86VidModeSetGammaRamp* = 18
  59. X_XF86VidModeGetGammaRampSize* = 19
  60. X_XF86VidModeGetPermissions* = 20
  61. CLKFLAG_PROGRAMABLE* = 1
  62. when defined(XF86VIDMODE_EVENTS):
  63. const
  64. XF86VidModeNotify* = 0
  65. XF86VidModeNumberEvents* = (XF86VidModeNotify + 1)
  66. XF86VidModeNotifyMask* = 0x00000001
  67. XF86VidModeNonEvent* = 0
  68. XF86VidModeModeChange* = 1
  69. else:
  70. const
  71. XF86VidModeNumberEvents* = 0
  72. const
  73. XF86VidModeBadClock* = 0
  74. XF86VidModeBadHTimings* = 1
  75. XF86VidModeBadVTimings* = 2
  76. XF86VidModeModeUnsuitable* = 3
  77. XF86VidModeExtensionDisabled* = 4
  78. XF86VidModeClientNotLocal* = 5
  79. XF86VidModeZoomLocked* = 6
  80. XF86VidModeNumberErrors* = (XF86VidModeZoomLocked + 1)
  81. XF86VM_READ_PERMISSION* = 1
  82. XF86VM_WRITE_PERMISSION* = 2
  83. type
  84. PXF86VidModeModeLine* = ptr TXF86VidModeModeLine
  85. TXF86VidModeModeLine*{.final.} = object
  86. hdisplay*: cushort
  87. hsyncstart*: cushort
  88. hsyncend*: cushort
  89. htotal*: cushort
  90. hskew*: cushort
  91. vdisplay*: cushort
  92. vsyncstart*: cushort
  93. vsyncend*: cushort
  94. vtotal*: cushort
  95. flags*: cuint
  96. privsize*: cint
  97. c_private*: PINT32
  98. PPPXF86VidModeModeInfo* = ptr PPXF86VidModeModeInfo
  99. PPXF86VidModeModeInfo* = ptr PXF86VidModeModeInfo
  100. PXF86VidModeModeInfo* = ptr TXF86VidModeModeInfo
  101. TXF86VidModeModeInfo*{.final.} = object
  102. dotclock*: cuint
  103. hdisplay*: cushort
  104. hsyncstart*: cushort
  105. hsyncend*: cushort
  106. htotal*: cushort
  107. hskew*: cushort
  108. vdisplay*: cushort
  109. vsyncstart*: cushort
  110. vsyncend*: cushort
  111. vtotal*: cushort
  112. flags*: cuint
  113. privsize*: cint
  114. c_private*: PINT32
  115. PXF86VidModeSyncRange* = ptr TXF86VidModeSyncRange
  116. TXF86VidModeSyncRange*{.final.} = object
  117. hi*: cfloat
  118. lo*: cfloat
  119. PXF86VidModeMonitor* = ptr TXF86VidModeMonitor
  120. TXF86VidModeMonitor*{.final.} = object
  121. vendor*: cstring
  122. model*: cstring
  123. EMPTY*: cfloat
  124. nhsync*: cuchar
  125. hsync*: PXF86VidModeSyncRange
  126. nvsync*: cuchar
  127. vsync*: PXF86VidModeSyncRange
  128. PXF86VidModeNotifyEvent* = ptr TXF86VidModeNotifyEvent
  129. TXF86VidModeNotifyEvent*{.final.} = object
  130. theType*: cint # of event
  131. serial*: culong # # of last request processed by server
  132. send_event*: TBool # true if this came from a SendEvent req
  133. display*: PDisplay # Display the event was read from
  134. root*: TWindow # root window of event screen
  135. state*: cint # What happened
  136. kind*: cint # What happened
  137. forced*: TBool # extents of new region
  138. time*: TTime # event timestamp
  139. PXF86VidModeGamma* = ptr TXF86VidModeGamma
  140. TXF86VidModeGamma*{.final.} = object
  141. red*: cfloat # Red Gamma value
  142. green*: cfloat # Green Gamma value
  143. blue*: cfloat # Blue Gamma value
  144. when defined(MACROS):
  145. proc XF86VidModeSelectNextMode*(disp: PDisplay, scr: cint): TBool
  146. proc XF86VidModeSelectPrevMode*(disp: PDisplay, scr: cint): TBool
  147. proc XF86VidModeQueryVersion*(dpy: PDisplay, majorVersion: Pcint,
  148. minorVersion: Pcint): TBool{.cdecl,
  149. dynlib: libXxf86vm, importc.}
  150. proc XF86VidModeQueryExtension*(dpy: PDisplay, event_base: Pcint,
  151. error_base: Pcint): TBool{.cdecl,
  152. dynlib: libXxf86vm, importc.}
  153. proc XF86VidModeSetClientVersion*(dpy: PDisplay): TBool{.cdecl,
  154. dynlib: libXxf86vm, importc.}
  155. proc XF86VidModeGetModeLine*(dpy: PDisplay, screen: cint, dotclock: Pcint,
  156. modeline: PXF86VidModeModeLine): TBool{.cdecl,
  157. dynlib: libXxf86vm, importc.}
  158. proc XF86VidModeGetAllModeLines*(dpy: PDisplay, screen: cint, modecount: Pcint,
  159. modelinesPtr: PPPXF86VidModeModeInfo): TBool{.
  160. cdecl, dynlib: libXxf86vm, importc.}
  161. proc XF86VidModeAddModeLine*(dpy: PDisplay, screen: cint,
  162. new_modeline: PXF86VidModeModeInfo,
  163. after_modeline: PXF86VidModeModeInfo): TBool{.
  164. cdecl, dynlib: libXxf86vm, importc.}
  165. proc XF86VidModeDeleteModeLine*(dpy: PDisplay, screen: cint,
  166. modeline: PXF86VidModeModeInfo): TBool{.cdecl,
  167. dynlib: libXxf86vm, importc.}
  168. proc XF86VidModeModModeLine*(dpy: PDisplay, screen: cint,
  169. modeline: PXF86VidModeModeLine): TBool{.cdecl,
  170. dynlib: libXxf86vm, importc.}
  171. proc XF86VidModeValidateModeLine*(dpy: PDisplay, screen: cint,
  172. modeline: PXF86VidModeModeInfo): TStatus{.
  173. cdecl, dynlib: libXxf86vm, importc.}
  174. proc XF86VidModeSwitchMode*(dpy: PDisplay, screen: cint, zoom: cint): TBool{.
  175. cdecl, dynlib: libXxf86vm, importc.}
  176. proc XF86VidModeSwitchToMode*(dpy: PDisplay, screen: cint,
  177. modeline: PXF86VidModeModeInfo): TBool{.cdecl,
  178. dynlib: libXxf86vm, importc.}
  179. proc XF86VidModeLockModeSwitch*(dpy: PDisplay, screen: cint, lock: cint): TBool{.
  180. cdecl, dynlib: libXxf86vm, importc.}
  181. proc XF86VidModeGetMonitor*(dpy: PDisplay, screen: cint,
  182. monitor: PXF86VidModeMonitor): TBool{.cdecl,
  183. dynlib: libXxf86vm, importc.}
  184. proc XF86VidModeGetViewPort*(dpy: PDisplay, screen: cint, x_return: Pcint,
  185. y_return: Pcint): TBool{.cdecl, dynlib: libXxf86vm,
  186. importc.}
  187. proc XF86VidModeSetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TBool{.
  188. cdecl, dynlib: libXxf86vm, importc.}
  189. proc XF86VidModeGetDotClocks*(dpy: PDisplay, screen: cint, flags_return: Pcint,
  190. number_of_clocks_return: Pcint,
  191. max_dot_clock_return: Pcint, clocks_return: PPcint): TBool{.
  192. cdecl, dynlib: libXxf86vm, importc.}
  193. proc XF86VidModeGetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{.
  194. cdecl, dynlib: libXxf86vm, importc.}
  195. proc XF86VidModeSetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{.
  196. cdecl, dynlib: libXxf86vm, importc.}
  197. proc XF86VidModeSetGammaRamp*(dpy: PDisplay, screen: cint, size: cint,
  198. red_array: Pcushort, green_array: Pcushort,
  199. blue_array: Pcushort): TBool{.cdecl,
  200. dynlib: libXxf86vm, importc.}
  201. proc XF86VidModeGetGammaRamp*(dpy: PDisplay, screen: cint, size: cint,
  202. red_array: Pcushort, green_array: Pcushort,
  203. blue_array: Pcushort): TBool{.cdecl,
  204. dynlib: libXxf86vm, importc.}
  205. proc XF86VidModeGetGammaRampSize*(dpy: PDisplay, screen: cint, size: Pcint): TBool{.
  206. cdecl, dynlib: libXxf86vm, importc.}
  207. proc XF86VidModeGetPermissions*(dpy: PDisplay, screen: cint, permissions: Pcint): TBool{.
  208. cdecl, dynlib: libXxf86vm, importc.}
  209. # implementation
  210. #when defined(MACROS):
  211. proc XF86VidModeSelectNextMode(disp: PDisplay, scr: cint): TBool =
  212. XF86VidModeSwitchMode(disp, scr, 1)
  213. proc XF86VidModeSelectPrevMode(disp: PDisplay, scr: cint): TBool =
  214. XF86VidModeSwitchMode(disp, scr, - 1)