Mercurial > games > semicongine
comparison semiconginev2/thirdparty/x11/xrandr.nim @ 1218:56781cc0fc7c compiletime-tests
did: renamge main package
author | sam <sam@basx.dev> |
---|---|
date | Wed, 17 Jul 2024 21:01:37 +0700 |
parents | semicongine/old/thirdparty/x11/xrandr.nim@239adab121a3 |
children |
comparison
equal
deleted
inserted
replaced
1217:f819a874058f | 1218:56781cc0fc7c |
---|---|
1 # | |
2 # $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $ | |
3 # | |
4 # Copyright (C) 2000 Compaq Computer Corporation, Inc. | |
5 # Copyright (C) 2002 Hewlett-Packard Company, Inc. | |
6 # | |
7 # Permission to use, copy, modify, distribute, and sell this software and its | |
8 # documentation for any purpose is hereby granted without fee, provided that | |
9 # the above copyright notice appear in all copies and that both that | |
10 # copyright notice and this permission notice appear in supporting | |
11 # documentation, and that the name of Compaq not be used in advertising or | |
12 # publicity pertaining to distribution of the software without specific, | |
13 # written prior permission. HP makes no representations about the | |
14 # suitability of this software for any purpose. It is provided "as is" | |
15 # without express or implied warranty. | |
16 # | |
17 # HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL | |
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ | |
19 # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
20 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
21 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
22 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
23 # | |
24 # Author: Jim Gettys, HP Labs, HP. | |
25 # | |
26 | |
27 import | |
28 x, xlib | |
29 | |
30 const | |
31 libXrandr* = "libXrandr.so(.2|)" | |
32 | |
33 # * $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $ | |
34 # * | |
35 # * Copyright (C) 2000, Compaq Computer Corporation, | |
36 # * Copyright (C) 2002, Hewlett Packard, Inc. | |
37 # * | |
38 # * Permission to use, copy, modify, distribute, and sell this software and its | |
39 # * documentation for any purpose is hereby granted without fee, provided that | |
40 # * the above copyright notice appear in all copies and that both that | |
41 # * copyright notice and this permission notice appear in supporting | |
42 # * documentation, and that the name of Compaq or HP not be used in advertising | |
43 # * or publicity pertaining to distribution of the software without specific, | |
44 # * written prior permission. HP makes no representations about the | |
45 # * suitability of this software for any purpose. It is provided "as is" | |
46 # * without express or implied warranty. | |
47 # * | |
48 # * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL | |
49 # * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP | |
50 # * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
51 # * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
52 # * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
53 # * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
54 # * | |
55 # * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. | |
56 # * | |
57 | |
58 type | |
59 PRotation* = ptr Rotation | |
60 Rotation* = cushort | |
61 | |
62 PSizeID* = ptr SizeID | |
63 SizeID* = cushort | |
64 | |
65 PSubpixelOrder* = ptr SubpixelOrder | |
66 SubpixelOrder* = cushort | |
67 | |
68 PRRCrtc* = ptr RRCrtc | |
69 RRCrtc* = XID | |
70 | |
71 PRROutput* = ptr RROutput | |
72 RROutput* = XID | |
73 | |
74 PRRMode* = ptr RRMode | |
75 RRMode* = XID | |
76 | |
77 PXRRModeFlags* = ptr XRRModeFlags | |
78 XRRModeFlags* = culong | |
79 | |
80 PConnection* = ptr Connection | |
81 Connection* = cushort | |
82 | |
83 const | |
84 RANDR_NAME* = "RANDR" | |
85 RANDR_MAJOR* = 1 | |
86 RANDR_MINOR* = 1 | |
87 RRNumberErrors* = 0 | |
88 RRNumberEvents* = 1 | |
89 constX_RRQueryVersion* = 0 # we skip 1 to make old clients fail pretty immediately | |
90 X_RROldGetScreenInfo* = 1 | |
91 X_RR1_0SetScreenConfig* = 2 # V1.0 apps share the same set screen config request id | |
92 constX_RRSetScreenConfig* = 2 | |
93 X_RROldScreenChangeSelectInput* = 3 # 3 used to be ScreenChangeSelectInput; deprecated | |
94 constX_RRSelectInput* = 4 | |
95 constX_RRGetScreenInfo* = 5 # used in XRRSelectInput | |
96 RRScreenChangeNotifyMask* = 1 shl 0 | |
97 RRScreenChangeNotify* = 0 # used in the rotation field; rotation and reflection in 0.1 proto. | |
98 RR_Rotate_0* = 1 | |
99 RR_Rotate_90* = 2 | |
100 RR_Rotate_180* = 4 | |
101 RR_Rotate_270* = 8 # new in 1.0 protocol, to allow reflection of screen | |
102 RR_Reflect_X* = 16 | |
103 RR_Reflect_Y* = 32 | |
104 RRSetConfigSuccess* = 0 | |
105 RRSetConfigInvalidConfigTime* = 1 | |
106 RRSetConfigInvalidTime* = 2 | |
107 RRSetConfigFailed* = 3 | |
108 RR_Connected* = 0 | |
109 RR_Disconnected* = 1 | |
110 RR_UnknownConnection* = 2 | |
111 | |
112 type | |
113 PXRRScreenSize* = ptr XRRScreenSize | |
114 XRRScreenSize*{.final.} = object # | |
115 # Events. | |
116 # | |
117 width*, height*: cint | |
118 mwidth*, mheight*: cint | |
119 | |
120 XRRScreenChangeNotifyEvent*{.final.} = object # internal representation is private to the library | |
121 typ*: cint # event base | |
122 serial*: culong # # of last request processed by server | |
123 send_event*: XBool # true if this came from a SendEvent request | |
124 display*: PDisplay # Display the event was read from | |
125 window*: Window # window which selected for this event | |
126 root*: Window # Root window for changed screen | |
127 timestamp*: Time # when the screen change occurred | |
128 config_timestamp*: Time # when the last configuration change | |
129 size_index*: SizeID | |
130 subpixel_order*: SubpixelOrder | |
131 rotation*: Rotation | |
132 width*: cint | |
133 height*: cint | |
134 mwidth*: cint | |
135 mheight*: cint | |
136 | |
137 PXRRScreenConfiguration* = ptr XRRScreenConfiguration | |
138 XRRScreenConfiguration* {.final.} = object | |
139 | |
140 PXRRModeInfo* = ptr XRRModeInfo | |
141 XRRModeInfo* {.final.} = object | |
142 id*: RRMode | |
143 width*, height*: cuint | |
144 dotClock*: culong | |
145 hSyncStart*, hSyncEnd*, hTotal*, hSkew*: cuint | |
146 vSyncStart*, vSyncEnd*, vTotal*: cuint | |
147 name*: cstring | |
148 nameLength*: cuint | |
149 modeFlags*: XRRModeFlags | |
150 | |
151 PXRRScreenResources* = ptr XRRScreenResources | |
152 XRRScreenResources* {.final.} = object | |
153 timestamp*, configTimestamp*: Time | |
154 ncrtc*: cint | |
155 crtcs*: ptr UncheckedArray[RRCrtc] | |
156 noutput*: cint | |
157 outputs*: ptr UncheckedArray[RROutput] | |
158 nmode*: cint | |
159 modes*: ptr UncheckedArray[XRRModeInfo] | |
160 | |
161 PXRROutputInfo* = ptr XRROutputInfo | |
162 XRROutputInfo* {.final.} = object | |
163 timestamp*: Time | |
164 crtc*: RRCrtc | |
165 name*: cstring | |
166 nameLen*: cint | |
167 mmWidth*, mmHeight*: culong | |
168 connection*: Connection | |
169 subpixelOrder*: SubpixelOrder | |
170 ncrtc*: cint | |
171 crtcs*: ptr UncheckedArray[RRCrtc] | |
172 nclone*: cint | |
173 clones*: ptr UncheckedArray[RROutput] | |
174 nmode*, npreferred*: cint | |
175 modes*: ptr UncheckedArray[RRMode] | |
176 | |
177 PXRRPropertyInfo* = ptr XRRPropertyInfo | |
178 XRRPropertyInfo* {.final.} = object | |
179 pending, range, immutable: bool | |
180 numValues: cint | |
181 values: ptr UncheckedArray[clong] | |
182 | |
183 RandrFormat* = enum | |
184 randrFormat16bit = 16, randrFormat32bit = 32 | |
185 | |
186 proc XRRQueryExtension*(dpy: PDisplay, event_basep, error_basep: Pcint): XBool{. | |
187 cdecl, dynlib: libXrandr, importc.} | |
188 proc XRRQueryVersion*(dpy: PDisplay, major_versionp: Pcint, | |
189 minor_versionp: Pcint): Status{.cdecl, dynlib: libXrandr, | |
190 importc.} | |
191 proc XRRQueryOutputProperty*(dpy: PDisplay, output: RROutput, property: Atom): | |
192 PXRRPropertyInfo {.cdecl, dynlib: libXrandr, importc.} | |
193 proc XRRChangeOutputProperty*(dpy: PDisplay, output: RROutput, | |
194 property, kind: Atom, format, mode: cint, data: ptr cuchar, nelements: cint) {. | |
195 cdecl, dynlib: libXrandr, importc.} | |
196 proc XRRGetScreenInfo*(dpy: PDisplay, draw: Drawable): PXRRScreenConfiguration{. | |
197 cdecl, dynlib: libXrandr, importc.} | |
198 proc XRRFreeScreenConfigInfo*(config: PXRRScreenConfiguration){.cdecl, | |
199 dynlib: libXrandr, importc.} | |
200 # | |
201 # Note that screen configuration changes are only permitted if the client can | |
202 # prove it has up to date configuration information. We are trying to | |
203 # insist that it become possible for screens to change dynamically, so | |
204 # we want to ensure the client knows what it is talking about when requesting | |
205 # changes. | |
206 # | |
207 proc XRRSetScreenConfig*(dpy: PDisplay, config: PXRRScreenConfiguration, | |
208 draw: Drawable, size_index: cint, rotation: Rotation, | |
209 timestamp: Time): Status{.cdecl, dynlib: libXrandr, | |
210 importc.} | |
211 # added in v1.1, sorry for the lame name | |
212 proc XRRSetScreenConfigAndRate*(dpy: PDisplay, config: PXRRScreenConfiguration, | |
213 draw: Drawable, size_index: cint, | |
214 rotation: Rotation, rate: cshort, | |
215 timestamp: Time): Status{.cdecl, | |
216 dynlib: libXrandr, importc.} | |
217 proc XRRConfigRotations*(config: PXRRScreenConfiguration, | |
218 current_rotation: PRotation): Rotation{.cdecl, | |
219 dynlib: libXrandr, importc.} | |
220 proc XRRConfigTimes*(config: PXRRScreenConfiguration, config_timestamp: PTime): Time{. | |
221 cdecl, dynlib: libXrandr, importc.} | |
222 proc XRRConfigSizes*(config: PXRRScreenConfiguration, nsizes: Pcint): PXRRScreenSize{. | |
223 cdecl, dynlib: libXrandr, importc.} | |
224 proc XRRConfigRates*(config: PXRRScreenConfiguration, sizeID: cint, | |
225 nrates: Pcint): ptr int16{.cdecl, dynlib: libXrandr, importc.} | |
226 proc XRRConfigCurrentConfiguration*(config: PXRRScreenConfiguration, | |
227 rotation: PRotation): SizeID{.cdecl, | |
228 dynlib: libXrandr, importc.} | |
229 proc XRRConfigCurrentRate*(config: PXRRScreenConfiguration): cshort{.cdecl, | |
230 dynlib: libXrandr, importc.} | |
231 proc XRRRootToScreen*(dpy: PDisplay, root: Window): cint{.cdecl, | |
232 dynlib: libXrandr, importc.} | |
233 # | |
234 # returns the screen configuration for the specified screen; does a lazy | |
235 # evalution to delay getting the information, and caches the result. | |
236 # These routines should be used in preference to XRRGetScreenInfo | |
237 # to avoid unneeded round trips to the X server. These are new | |
238 # in protocol version 0.1. | |
239 # | |
240 proc XRRScreenConfig*(dpy: PDisplay, screen: cint): PXRRScreenConfiguration{. | |
241 cdecl, dynlib: libXrandr, importc.} | |
242 proc XRRConfig*(screen: PScreen): PXRRScreenConfiguration{.cdecl, | |
243 dynlib: libXrandr, importc.} | |
244 proc XRRSelectInput*(dpy: PDisplay, window: Window, mask: cint){.cdecl, | |
245 dynlib: libXrandr, importc.} | |
246 # | |
247 # the following are always safe to call, even if RandR is not implemented | |
248 # on a screen | |
249 # | |
250 proc XRRRotations*(dpy: PDisplay, screen: cint, current_rotation: PRotation): Rotation{. | |
251 cdecl, dynlib: libXrandr, importc.} | |
252 proc XRRSizes*(dpy: PDisplay, screen: cint, nsizes: Pcint): PXRRScreenSize{. | |
253 cdecl, dynlib: libXrandr, importc.} | |
254 proc XRRRates*(dpy: PDisplay, screen: cint, sizeID: cint, nrates: Pcint): ptr int16{. | |
255 cdecl, dynlib: libXrandr, importc.} | |
256 proc XRRTimes*(dpy: PDisplay, screen: cint, config_timestamp: PTime): Time{. | |
257 cdecl, dynlib: libXrandr, importc.} | |
258 # | |
259 # intended to take RRScreenChangeNotify, or | |
260 # ConfigureNotify (on the root window) | |
261 # returns 1 if it is an event type it understands, 0 if not | |
262 # | |
263 proc XRRUpdateConfiguration*(event: PXEvent): cint{.cdecl, dynlib: libXrandr, | |
264 importc.} | |
265 # implementation | |
266 proc XRRGetScreenResourcesCurrent*(dpy: PDisplay, win: Window): | |
267 PXRRScreenResources {.cdecl, dynlib: libXrandr, importc.} | |
268 proc XRRFreeScreenResources*(res: PXRRScreenResources) {.cdecl, | |
269 dynlib: libXrandr, importc.} | |
270 proc XRRGetOutputInfo*(dpy: PDisplay, res: PXRRScreenResources, ret: RROutput): | |
271 PXRROutputInfo {.cdecl, dynlib: libXrandr, importc.} | |
272 proc XRRFreeOutputInfo*(info: PXRROutputInfo) {.cdecl, dynlib: libXrandr, | |
273 importc.} |