Mercurial > games > semicongine
comparison semiconginev2/thirdparty/x11/xutil.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/xutil.nim@239adab121a3 |
children |
comparison
equal
deleted
inserted
replaced
1217:f819a874058f | 1218:56781cc0fc7c |
---|---|
1 | |
2 import | |
3 x, xlib, keysym | |
4 | |
5 #const | |
6 # libX11* = "libX11.so" | |
7 | |
8 # | |
9 # Automatically converted by H2Pas 0.99.15 from xutil.h | |
10 # The following command line parameters were used: | |
11 # -p | |
12 # -T | |
13 # -S | |
14 # -d | |
15 # -c | |
16 # xutil.h | |
17 # | |
18 | |
19 const | |
20 NoValue* = 0x00000000 | |
21 XValue* = 0x00000001 | |
22 YValue* = 0x00000002 | |
23 WidthValue* = 0x00000004 | |
24 HeightValue* = 0x00000008 | |
25 AllValues* = 0x0000000F | |
26 XNegative* = 0x00000010 | |
27 YNegative* = 0x00000020 | |
28 | |
29 type | |
30 CPoint*{.final.} = object | |
31 x*: cint | |
32 y*: cint | |
33 | |
34 PXSizeHints* = ptr XSizeHints | |
35 XSizeHints*{.final.} = object | |
36 flags*: clong | |
37 x*, y*: cint | |
38 width*, height*: cint | |
39 min_width*, min_height*: cint | |
40 max_width*, max_height*: cint | |
41 width_inc*, height_inc*: cint | |
42 min_aspect*, max_aspect*: CPoint | |
43 base_width*, base_height*: cint | |
44 win_gravity*: cint | |
45 | |
46 const | |
47 USPosition* = 1 shl 0 | |
48 USSize* = 1 shl 1 | |
49 PPosition* = 1 shl 2 | |
50 PSize* = 1 shl 3 | |
51 PMinSize* = 1 shl 4 | |
52 PMaxSize* = 1 shl 5 | |
53 PResizeInc* = 1 shl 6 | |
54 PAspect* = 1 shl 7 | |
55 PBaseSize* = 1 shl 8 | |
56 PWinGravity* = 1 shl 9 | |
57 PAllHints* = PPosition or PSize or PMinSize or PMaxSize or PResizeInc or | |
58 PAspect | |
59 | |
60 type | |
61 PXWMHints* = ptr XWMHints | |
62 XWMHints*{.final.} = object | |
63 flags*: clong | |
64 input*: XBool | |
65 initial_state*: cint | |
66 icon_pixmap*: Pixmap | |
67 icon_window*: Window | |
68 icon_x*, icon_y*: cint | |
69 icon_mask*: Pixmap | |
70 window_group*: XID | |
71 | |
72 | |
73 const | |
74 InputHint* = 1 shl 0 | |
75 StateHint* = 1 shl 1 | |
76 IconPixmapHint* = 1 shl 2 | |
77 IconWindowHint* = 1 shl 3 | |
78 IconPositionHint* = 1 shl 4 | |
79 IconMaskHint* = 1 shl 5 | |
80 WindowGroupHint* = 1 shl 6 | |
81 AllHints* = InputHint or StateHint or IconPixmapHint or IconWindowHint or | |
82 IconPositionHint or IconMaskHint or WindowGroupHint | |
83 XUrgencyHint* = 1 shl 8 | |
84 WithdrawnState* = 0 | |
85 NormalState* = 1 | |
86 IconicState* = 3 | |
87 DontCareState* = 0 | |
88 ZoomState* = 2 | |
89 InactiveState* = 4 | |
90 | |
91 type | |
92 PXTextProperty* = ptr XTextProperty | |
93 XTextProperty*{.final.} = object | |
94 value*: Pcuchar | |
95 encoding*: Atom | |
96 format*: cint | |
97 nitems*: culong | |
98 | |
99 | |
100 const | |
101 XNoMemory* = - 1 | |
102 XLocaleNotSupported* = - 2 | |
103 XConverterNotFound* = - 3 | |
104 | |
105 type | |
106 PXICCEncodingStyle* = ptr XICCEncodingStyle | |
107 XICCEncodingStyle* = enum | |
108 XStringStyle, XCompoundTextStyle, XTextStyle, XStdICCTextStyle, | |
109 XUTF8StringStyle | |
110 | |
111 PPXIconSize* = ptr PXIconSize | |
112 PXIconSize* = ptr XIconSize | |
113 XIconSize*{.final.} = object | |
114 min_width*, min_height*: cint | |
115 max_width*, max_height*: cint | |
116 width_inc*, height_inc*: cint | |
117 | |
118 PXClassHint* = ptr XClassHint | |
119 XClassHint*{.final.} = object | |
120 res_name*: cstring | |
121 res_class*: cstring | |
122 | |
123 | |
124 type | |
125 PXComposeStatus* = ptr XComposeStatus | |
126 XComposeStatus*{.final.} = object | |
127 compose_ptr*: XPointer | |
128 chars_matched*: cint | |
129 | |
130 | |
131 type | |
132 PXRegion* = ptr XRegion | |
133 XRegion*{.final.} = object | |
134 | |
135 PRegion* = ptr Region | |
136 Region* = PXRegion | |
137 | |
138 const | |
139 RectangleOut* = 0 | |
140 RectangleIn* = 1 | |
141 RectanglePart* = 2 | |
142 | |
143 type | |
144 PXVisualInfo* = ptr XVisualInfo | |
145 XVisualInfo*{.final.} = object | |
146 visual*: PVisual | |
147 visualid*: VisualID | |
148 screen*: cint | |
149 depth*: cint | |
150 class*: cint | |
151 red_mask*: culong | |
152 green_mask*: culong | |
153 blue_mask*: culong | |
154 colormap_size*: cint | |
155 bits_per_rgb*: cint | |
156 | |
157 | |
158 const | |
159 VisualNoMask* = 0x00000000 | |
160 VisualIDMask* = 0x00000001 | |
161 VisualScreenMask* = 0x00000002 | |
162 VisualDepthMask* = 0x00000004 | |
163 VisualClassMask* = 0x00000008 | |
164 VisualRedMaskMask* = 0x00000010 | |
165 VisualGreenMaskMask* = 0x00000020 | |
166 VisualBlueMaskMask* = 0x00000040 | |
167 VisualColormapSizeMask* = 0x00000080 | |
168 VisualBitsPerRGBMask* = 0x00000100 | |
169 VisualAllMask* = 0x000001FF | |
170 | |
171 type | |
172 PPXStandardColormap* = ptr PXStandardColormap | |
173 PXStandardColormap* = ptr XStandardColormap | |
174 XStandardColormap*{.final.} = object | |
175 colormap*: Colormap | |
176 red_max*: culong | |
177 red_mult*: culong | |
178 green_max*: culong | |
179 green_mult*: culong | |
180 blue_max*: culong | |
181 blue_mult*: culong | |
182 base_pixel*: culong | |
183 visualid*: VisualID | |
184 killid*: XID | |
185 | |
186 | |
187 const | |
188 BitmapSuccess* = 0 | |
189 BitmapOpenFailed* = 1 | |
190 BitmapFileInvalid* = 2 | |
191 BitmapNoMemory* = 3 | |
192 XCSUCCESS* = 0 | |
193 XCNOMEM* = 1 | |
194 XCNOENT* = 2 | |
195 ReleaseByFreeingColormap*: XID = XID(1) | |
196 | |
197 type | |
198 PXContext* = ptr XContext | |
199 XContext* = cint | |
200 | |
201 proc XAllocClassHint*(): PXClassHint{.cdecl, dynlib: libX11, importc.} | |
202 proc XAllocIconSize*(): PXIconSize{.cdecl, dynlib: libX11, importc.} | |
203 proc XAllocSizeHints*(): PXSizeHints{.cdecl, dynlib: libX11, importc.} | |
204 proc XAllocStandardColormap*(): PXStandardColormap{.cdecl, dynlib: libX11, | |
205 importc.} | |
206 proc XAllocWMHints*(): PXWMHints{.cdecl, dynlib: libX11, importc.} | |
207 proc XClipBox*(para1: Region, para2: PXRectangle): cint{.cdecl, dynlib: libX11, | |
208 importc.} | |
209 proc XCreateRegion*(): Region{.cdecl, dynlib: libX11, importc.} | |
210 proc XDefaultString*(): cstring{.cdecl, dynlib: libX11, importc.} | |
211 proc XDeleteContext*(para1: PDisplay, para2: XID, para3: XContext): cint{. | |
212 cdecl, dynlib: libX11, importc.} | |
213 proc XDestroyRegion*(para1: Region): cint{.cdecl, dynlib: libX11, importc.} | |
214 proc XEmptyRegion*(para1: Region): cint{.cdecl, dynlib: libX11, importc.} | |
215 proc XEqualRegion*(para1: Region, para2: Region): cint{.cdecl, dynlib: libX11, | |
216 importc.} | |
217 proc XFindContext*(para1: PDisplay, para2: XID, para3: XContext, | |
218 para4: PXPointer): cint{.cdecl, dynlib: libX11, importc.} | |
219 proc XGetClassHint*(para1: PDisplay, para2: Window, para3: PXClassHint): Status{. | |
220 cdecl, dynlib: libX11, importc.} | |
221 proc XGetIconSizes*(para1: PDisplay, para2: Window, para3: PPXIconSize, | |
222 para4: Pcint): Status{.cdecl, dynlib: libX11, importc.} | |
223 proc XGetNormalHints*(para1: PDisplay, para2: Window, para3: PXSizeHints): Status{. | |
224 cdecl, dynlib: libX11, importc.} | |
225 proc XGetRGBColormaps*(para1: PDisplay, para2: Window, | |
226 para3: PPXStandardColormap, para4: Pcint, para5: Atom): Status{. | |
227 cdecl, dynlib: libX11, importc.} | |
228 proc XGetSizeHints*(para1: PDisplay, para2: Window, para3: PXSizeHints, | |
229 para4: Atom): Status{.cdecl, dynlib: libX11, importc.} | |
230 proc XGetStandardColormap*(para1: PDisplay, para2: Window, | |
231 para3: PXStandardColormap, para4: Atom): Status{. | |
232 cdecl, dynlib: libX11, importc.} | |
233 proc XGetTextProperty*(para1: PDisplay, para2: Window, para3: PXTextProperty, | |
234 para4: Atom): Status{.cdecl, dynlib: libX11, importc.} | |
235 proc XGetVisualInfo*(para1: PDisplay, para2: clong, para3: PXVisualInfo, | |
236 para4: Pcint): PXVisualInfo{.cdecl, dynlib: libX11, importc.} | |
237 proc XGetWMClientMachine*(para1: PDisplay, para2: Window, para3: PXTextProperty): Status{. | |
238 cdecl, dynlib: libX11, importc.} | |
239 proc XGetWMHints*(para1: PDisplay, para2: Window): PXWMHints{.cdecl, | |
240 dynlib: libX11, importc.} | |
241 proc XGetWMIconName*(para1: PDisplay, para2: Window, para3: PXTextProperty): Status{. | |
242 cdecl, dynlib: libX11, importc.} | |
243 proc XGetWMName*(para1: PDisplay, para2: Window, para3: PXTextProperty): Status{. | |
244 cdecl, dynlib: libX11, importc.} | |
245 proc XGetWMNormalHints*(para1: PDisplay, para2: Window, para3: PXSizeHints, | |
246 para4: ptr int): Status{.cdecl, dynlib: libX11, importc.} | |
247 proc XGetWMSizeHints*(para1: PDisplay, para2: Window, para3: PXSizeHints, | |
248 para4: ptr int, para5: Atom): Status{.cdecl, | |
249 dynlib: libX11, importc.} | |
250 proc XGetZoomHints*(para1: PDisplay, para2: Window, para3: PXSizeHints): Status{. | |
251 cdecl, dynlib: libX11, importc.} | |
252 proc XIntersectRegion*(para1: Region, para2: Region, para3: Region): cint{. | |
253 cdecl, dynlib: libX11, importc.} | |
254 proc XConvertCase*(para1: KeySym, para2: PKeySym, para3: PKeySym){.cdecl, | |
255 dynlib: libX11, importc.} | |
256 proc XLookupString*(para1: PXKeyEvent, para2: cstring, para3: cint, | |
257 para4: PKeySym, para5: PXComposeStatus): cint{.cdecl, | |
258 dynlib: libX11, importc.} | |
259 proc XMatchVisualInfo*(para1: PDisplay, para2: cint, para3: cint, para4: cint, | |
260 para5: PXVisualInfo): Status{.cdecl, dynlib: libX11, | |
261 importc.} | |
262 proc XOffsetRegion*(para1: Region, para2: cint, para3: cint): cint{.cdecl, | |
263 dynlib: libX11, importc.} | |
264 proc XPointInRegion*(para1: Region, para2: cint, para3: cint): XBool{.cdecl, | |
265 dynlib: libX11, importc.} | |
266 proc XPolygonRegion*(para1: PXPoint, para2: cint, para3: cint): Region{.cdecl, | |
267 dynlib: libX11, importc.} | |
268 proc XRectInRegion*(para1: Region, para2: cint, para3: cint, para4: cuint, | |
269 para5: cuint): cint{.cdecl, dynlib: libX11, importc.} | |
270 proc XSaveContext*(para1: PDisplay, para2: XID, para3: XContext, | |
271 para4: cstring): cint{.cdecl, dynlib: libX11, importc.} | |
272 proc XSetClassHint*(para1: PDisplay, para2: Window, para3: PXClassHint): cint{. | |
273 cdecl, dynlib: libX11, importc.} | |
274 proc XSetIconSizes*(para1: PDisplay, para2: Window, para3: PXIconSize, | |
275 para4: cint): cint{.cdecl, dynlib: libX11, importc.} | |
276 proc XSetNormalHints*(para1: PDisplay, para2: Window, para3: PXSizeHints): cint{. | |
277 cdecl, dynlib: libX11, importc.} | |
278 proc XSetRGBColormaps*(para1: PDisplay, para2: Window, | |
279 para3: PXStandardColormap, para4: cint, para5: Atom){. | |
280 cdecl, dynlib: libX11, importc.} | |
281 proc XSetSizeHints*(para1: PDisplay, para2: Window, para3: PXSizeHints, | |
282 para4: Atom): cint{.cdecl, dynlib: libX11, importc.} | |
283 proc XSetStandardProperties*(para1: PDisplay, para2: Window, para3: cstring, | |
284 para4: cstring, para5: Pixmap, para6: PPchar, | |
285 para7: cint, para8: PXSizeHints): cint{.cdecl, | |
286 dynlib: libX11, importc.} | |
287 proc XSetTextProperty*(para1: PDisplay, para2: Window, para3: PXTextProperty, | |
288 para4: Atom){.cdecl, dynlib: libX11, importc.} | |
289 proc XSetWMClientMachine*(para1: PDisplay, para2: Window, para3: PXTextProperty){. | |
290 cdecl, dynlib: libX11, importc.} | |
291 proc XSetWMHints*(para1: PDisplay, para2: Window, para3: PXWMHints): cint{. | |
292 cdecl, dynlib: libX11, importc.} | |
293 proc XSetWMIconName*(para1: PDisplay, para2: Window, para3: PXTextProperty){. | |
294 cdecl, dynlib: libX11, importc.} | |
295 proc XSetWMName*(para1: PDisplay, para2: Window, para3: PXTextProperty){.cdecl, | |
296 dynlib: libX11, importc.} | |
297 proc XSetWMNormalHints*(para1: PDisplay, para2: Window, para3: PXSizeHints){. | |
298 cdecl, dynlib: libX11, importc.} | |
299 proc XSetWMProperties*(para1: PDisplay, para2: Window, para3: PXTextProperty, | |
300 para4: PXTextProperty, para5: PPchar, para6: cint, | |
301 para7: PXSizeHints, para8: PXWMHints, para9: PXClassHint){. | |
302 cdecl, dynlib: libX11, importc.} | |
303 proc XmbSetWMProperties*(para1: PDisplay, para2: Window, para3: cstring, | |
304 para4: cstring, para5: PPchar, para6: cint, | |
305 para7: PXSizeHints, para8: PXWMHints, | |
306 para9: PXClassHint){.cdecl, dynlib: libX11, importc.} | |
307 proc Xutf8SetWMProperties*(para1: PDisplay, para2: Window, para3: cstring, | |
308 para4: cstring, para5: PPchar, para6: cint, | |
309 para7: PXSizeHints, para8: PXWMHints, | |
310 para9: PXClassHint){.cdecl, dynlib: libX11, importc.} | |
311 proc XSetWMSizeHints*(para1: PDisplay, para2: Window, para3: PXSizeHints, | |
312 para4: Atom){.cdecl, dynlib: libX11, importc.} | |
313 proc XSetRegion*(para1: PDisplay, para2: GC, para3: Region): cint{.cdecl, | |
314 dynlib: libX11, importc.} | |
315 proc XSetStandardColormap*(para1: PDisplay, para2: Window, | |
316 para3: PXStandardColormap, para4: Atom){.cdecl, | |
317 dynlib: libX11, importc.} | |
318 proc XSetZoomHints*(para1: PDisplay, para2: Window, para3: PXSizeHints): cint{. | |
319 cdecl, dynlib: libX11, importc.} | |
320 proc XShrinkRegion*(para1: Region, para2: cint, para3: cint): cint{.cdecl, | |
321 dynlib: libX11, importc.} | |
322 proc XStringListToTextProperty*(para1: PPchar, para2: cint, | |
323 para3: PXTextProperty): Status{.cdecl, | |
324 dynlib: libX11, importc.} | |
325 proc XSubtractRegion*(para1: Region, para2: Region, para3: Region): cint{. | |
326 cdecl, dynlib: libX11, importc.} | |
327 proc XmbTextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint, | |
328 para4: XICCEncodingStyle, para5: PXTextProperty): cint{. | |
329 cdecl, dynlib: libX11, importc.} | |
330 proc XwcTextListToTextProperty*(para1: PDisplay, para2: ptr ptr int16, para3: cint, | |
331 para4: XICCEncodingStyle, para5: PXTextProperty): cint{. | |
332 cdecl, dynlib: libX11, importc.} | |
333 proc Xutf8TextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint, | |
334 para4: XICCEncodingStyle, | |
335 para5: PXTextProperty): cint{.cdecl, | |
336 dynlib: libX11, importc.} | |
337 proc XwcFreeStringList*(para1: ptr ptr int16){.cdecl, dynlib: libX11, importc.} | |
338 proc XTextPropertyToStringList*(para1: PXTextProperty, para2: PPPchar, | |
339 para3: Pcint): Status{.cdecl, dynlib: libX11, | |
340 importc.} | |
341 proc XmbTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, | |
342 para3: PPPchar, para4: Pcint): cint{.cdecl, | |
343 dynlib: libX11, importc.} | |
344 proc XwcTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, | |
345 para3: ptr ptr ptr int16, para4: Pcint): cint{.cdecl, | |
346 dynlib: libX11, importc.} | |
347 proc Xutf8TextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, | |
348 para3: PPPchar, para4: Pcint): cint{.cdecl, | |
349 dynlib: libX11, importc.} | |
350 proc XUnionRectWithRegion*(para1: PXRectangle, para2: Region, para3: Region): cint{. | |
351 cdecl, dynlib: libX11, importc.} | |
352 proc XUnionRegion*(para1: Region, para2: Region, para3: Region): cint{.cdecl, | |
353 dynlib: libX11, importc.} | |
354 proc XWMGeometry*(para1: PDisplay, para2: cint, para3: cstring, para4: cstring, | |
355 para5: cuint, para6: PXSizeHints, para7: Pcint, para8: Pcint, | |
356 para9: Pcint, para10: Pcint, para11: Pcint): cint{.cdecl, | |
357 dynlib: libX11, importc.} | |
358 proc XXorRegion*(para1: Region, para2: Region, para3: Region): cint{.cdecl, | |
359 dynlib: libX11, importc.} | |
360 #when defined(MACROS): | |
361 proc XDestroyImage*(ximage: PXImage): cint | |
362 proc XGetPixel*(ximage: PXImage, x, y: cint): culong | |
363 proc XPutPixel*(ximage: PXImage, x, y: cint, pixel: culong): cint | |
364 proc XSubImage*(ximage: PXImage, x, y: cint, width, height: cuint): PXImage | |
365 proc XAddPixel*(ximage: PXImage, value: clong): cint | |
366 proc IsKeypadKey*(keysym: KeySym): bool | |
367 proc IsPrivateKeypadKey*(keysym: KeySym): bool | |
368 proc IsCursorKey*(keysym: KeySym): bool | |
369 proc IsPFKey*(keysym: KeySym): bool | |
370 proc IsFunctionKey*(keysym: KeySym): bool | |
371 proc IsMiscFunctionKey*(keysym: KeySym): bool | |
372 proc IsModifierKey*(keysym: KeySym): bool | |
373 #function XUniqueContext : XContext; | |
374 #function XStringToContext(_string : Pchar) : XContext; | |
375 # implementation | |
376 | |
377 #when defined(MACROS): | |
378 proc XDestroyImage(ximage: PXImage): cint = | |
379 ximage.f.destroy_image(ximage) | |
380 | |
381 proc XGetPixel(ximage: PXImage, x, y: cint): culong = | |
382 ximage.f.get_pixel(ximage, x, y) | |
383 | |
384 proc XPutPixel(ximage: PXImage, x, y: cint, pixel: culong): cint = | |
385 ximage.f.put_pixel(ximage, x, y, pixel) | |
386 | |
387 proc XSubImage(ximage: PXImage, x, y: cint, width, height: cuint): PXImage = | |
388 ximage.f.sub_image(ximage, x, y, width, height) | |
389 | |
390 proc XAddPixel(ximage: PXImage, value: clong): cint = | |
391 ximage.f.add_pixel(ximage, value) | |
392 | |
393 proc IsKeypadKey(keysym: KeySym): bool = | |
394 (keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal) | |
395 | |
396 proc IsPrivateKeypadKey(keysym: KeySym): bool = | |
397 (keysym >= 0x11000000.KeySym) and (keysym <= 0x1100FFFF.KeySym) | |
398 | |
399 proc IsCursorKey(keysym: KeySym): bool = | |
400 (keysym >= XK_Home) and (keysym < XK_Select) | |
401 | |
402 proc IsPFKey(keysym: KeySym): bool = | |
403 (keysym >= XK_KP_F1) and (keysym <= XK_KP_F4) | |
404 | |
405 proc IsFunctionKey(keysym: KeySym): bool = | |
406 (keysym >= XK_F1) and (keysym <= XK_F35) | |
407 | |
408 proc IsMiscFunctionKey(keysym: KeySym): bool = | |
409 (keysym >= XK_Select) and (keysym <= XK_Break) | |
410 | |
411 proc IsModifierKey(keysym: KeySym): bool = | |
412 ((keysym >= XK_Shift_L) and (keysym <= XK_Hyper_R)) or | |
413 (keysym == XK_Mode_switch) or (keysym == XK_Num_Lock) |