comparison semiconginev2/old/thirdparty/x11/xkb.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/xkb.nim@239adab121a3
children
comparison
equal deleted inserted replaced
1217:f819a874058f 1218:56781cc0fc7c
1 #
2 # $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
3 #************************************************************
4 # $Xorg: XKBstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
5 #************************************************************
6 # $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
7 #************************************************************
8 #
9 #Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
10 #
11 #Permission to use, copy, modify, and distribute this
12 #software and its documentation for any purpose and without
13 #fee is hereby granted, provided that the above copyright
14 #notice appear in all copies and that both that copyright
15 #notice and this permission notice appear in supporting
16 #documentation, and that the name of Silicon Graphics not be
17 #used in advertising or publicity pertaining to distribution
18 #of the software without specific prior written permission.
19 #Silicon Graphics makes no representation about the suitability
20 #of this software for any purpose. It is provided "as is"
21 #without any express or implied warranty.
22 #
23 #SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
24 #SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
25 #AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
26 #GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
27 #DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
28 #DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
29 #OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
30 #THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 #
32 #********************************************************
33 # $XFree86: xc/include/extensions/XKB.h,v 1.5 2002/11/20 04:49:01 dawes Exp $
34 # $XFree86: xc/include/extensions/XKBgeom.h,v 3.9 2002/09/18 17:11:40 tsi Exp $
35 #
36 # Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il
37 #
38 #Thanks:
39 # I want to thanks to oliebol for putting up with all of the problems that was found
40 # while translating this code. ;)
41 #
42 # I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my
43 # wierd questions ;)
44 #
45 # Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to
46 # understanding some of the problems I had converting this headers and pointing me to resources
47 # that helped translating this headers.
48 #
49 # Ido
50 #
51 #History:
52 # 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and
53 # chnaged it to "reocrd" only.
54 # 2004/10/04 - 06 - Convertion from the c header of XKBgeom.h.
55 # 2004/10/03 - Removed the XKBstr_UNIT compiler decleration. Afther the joined files,
56 # There is no need for it anymore.
57 # - There is a need to define (for now) XKBgeom (compiler define) in order
58 # to use the code of it. At this moment, I did not yet converted it to Pascal.
59 #
60 # 2004/09/17 - 10/04 - Convertion from the c header of XKBstr.
61 #
62 # 2004/10/03 - Joined xkbstr.pas into xkb.pas because of the circular calls problems.
63 # - Added the history of xkbstr.pas above this addition.
64 #
65 # 2004/09/17 - Fixed a wrong convertion number of XkbPerKeyBitArraySize, insted
66 # of float, it's now converted into integer (as it should have been).
67 #
68 # 2004/09/15 - 16 - Convertion from the c header of XKB.h.
69 #
70
71 import
72 x, xlib
73
74 include "x11pragma.nim"
75
76 proc XkbcharToInt*(v: int8): int16
77 proc XkbIntTo2chars*(i: int16, h, L: var int8)
78 proc Xkb2charsToInt*(h, L: int8): int16
79 #
80 # Common data structures and access macros
81 #
82 type
83 PWord* = ptr array[0..64_000, int16]
84 PByte* = ptr byte
85 PXkbStatePtr* = ptr XkbStateRec
86 XkbStateRec*{.final.} = object
87 group*: int8
88 locked_group*: int8
89 base_group*: int16
90 latched_group*: int16
91 mods*: int8
92 base_mods*: int8
93 latched_mods*: int8
94 locked_mods*: int8
95 compat_state*: int8
96 grab_mods*: int8
97 compat_grab_mods*: int8
98 lookup_mods*: int8
99 compat_lookup_mods*: int8
100 ptr_buttons*: int16
101
102
103
104 proc XkbModLocks*(s: PXkbStatePtr): int8
105 proc XkbStateMods*(s: PXkbStatePtr): int16
106 proc XkbGroupLock*(s: PXkbStatePtr): int8
107 proc XkbStateGroup*(s: PXkbStatePtr): int16
108 proc XkbStateFieldFromRec*(s: PXkbStatePtr): int
109 proc XkbGrabStateFromRec*(s: PXkbStatePtr): int
110 type
111 PXkbModsPtr* = ptr XkbModsRec
112 XkbModsRec*{.final.} = object
113 mask*: int8 # effective mods
114 real_mods*: int8
115 vmods*: int16
116
117
118
119 type
120 PXkbKTMapEntryPtr* = ptr XkbKTMapEntryRec
121 XkbKTMapEntryRec*{.final.} = object
122 active*: bool
123 level*: int8
124 mods*: XkbModsRec
125
126
127
128 type
129 PXkbKeyTypePtr* = ptr XkbKeyTypeRec
130 XkbKeyTypeRec*{.final.} = object
131 mods*: XkbModsRec
132 num_levels*: int8
133 map_count*: int8
134 map*: PXkbKTMapEntryPtr
135 preserve*: PXkbModsPtr
136 name*: Atom
137 level_names*: Atom
138
139
140
141 proc XkbNumGroups*(g: int16): int16
142 proc XkbOutOfRangeGroupInfo*(g: int16): int16
143 proc XkbOutOfRangeGroupAction*(g: int16): int16
144 proc XkbOutOfRangeGroupNumber*(g: int16): int16
145 proc XkbSetGroupInfo*(g, w, n: int16): int16
146 proc XkbSetNumGroups*(g, n: int16): int16
147 #
148 # Structures and access macros used primarily by the server
149 #
150 type
151 PXkbBehavior* = ptr XkbBehavior
152 XkbBehavior*{.final.} = object
153 theType*: int8
154 data*: int8
155
156
157
158 type
159 PXkbModAction* = ptr XkbModAction
160 XkbModAction*{.final.} = object
161 theType*: int8
162 flags*: int8
163 mask*: int8
164 real_mods*: int8
165 vmods1*: int8
166 vmods2*: int8
167
168
169
170 proc XkbModActionVMods*(a: PXkbModAction): int16
171 proc XkbSetModActionVMods*(a: PXkbModAction, v: int8)
172 type
173 PXkbGroupAction* = ptr XkbGroupAction
174 XkbGroupAction*{.final.} = object
175 theType*: int8
176 flags*: int8
177 group_XXX*: int8
178
179
180
181 proc XkbSAGroup*(a: PXkbGroupAction): int8
182 proc XkbSASetGroupProc*(a: PXkbGroupAction, g: int8)
183 type
184 PXkbISOAction* = ptr XkbISOAction
185 XkbISOAction*{.final.} = object
186 theType*: int8
187 flags*: int8
188 mask*: int8
189 real_mods*: int8
190 group_XXX*: int8
191 affect*: int8
192 vmods1*: int8
193 vmods2*: int8
194
195
196
197 type
198 PXkbPtrAction* = ptr XkbPtrAction
199 XkbPtrAction*{.final.} = object
200 theType*: int8
201 flags*: int8
202 high_XXX*: int8
203 low_XXX*: int8
204 high_YYY*: int8
205 low_YYY*: int8
206
207
208
209 proc XkbPtrActionX*(a: PXkbPtrAction): int16
210 proc XkbPtrActionY*(a: PXkbPtrAction): int16
211 proc XkbSetPtrActionX*(a: PXkbPtrAction, x: int8)
212 proc XkbSetPtrActionY*(a: PXkbPtrAction, y: int8)
213 type
214 PXkbPtrBtnAction* = ptr XkbPtrBtnAction
215 XkbPtrBtnAction*{.final.} = object
216 theType*: int8
217 flags*: int8
218 count*: int8
219 button*: int8
220
221
222
223 type
224 PXkbPtrDfltAction* = ptr XkbPtrDfltAction
225 XkbPtrDfltAction*{.final.} = object
226 theType*: int8
227 flags*: int8
228 affect*: int8
229 valueXXX*: int8
230
231
232
233 proc XkbSAPtrDfltValue*(a: PXkbPtrDfltAction): int8
234 proc XkbSASetPtrDfltValue*(a: PXkbPtrDfltAction, c: pointer)
235 type
236 PXkbSwitchScreenAction* = ptr XkbSwitchScreenAction
237 XkbSwitchScreenAction*{.final.} = object
238 theType*: int8
239 flags*: int8
240 screenXXX*: int8
241
242
243
244 proc XkbSAScreen*(a: PXkbSwitchScreenAction): int8
245 proc XkbSASetScreen*(a: PXkbSwitchScreenAction, s: pointer)
246 type
247 PXkbCtrlsAction* = ptr XkbCtrlsAction
248 XkbCtrlsAction*{.final.} = object
249 theType*: int8
250 flags*: int8
251 ctrls3*: int8
252 ctrls2*: int8
253 ctrls1*: int8
254 ctrls0*: int8
255
256
257
258 proc XkbActionSetCtrls*(a: PXkbCtrlsAction, c: int8)
259 proc XkbActionCtrls*(a: PXkbCtrlsAction): int16
260 type
261 PXkbMessageAction* = ptr XkbMessageAction
262 XkbMessageAction*{.final.} = object
263 theType*: int8
264 flags*: int8
265 message*: array[0..5, char]
266
267
268
269 type
270 PXkbRedirectKeyAction* = ptr XkbRedirectKeyAction
271 XkbRedirectKeyAction*{.final.} = object
272 theType*: int8
273 new_key*: int8
274 mods_mask*: int8
275 mods*: int8
276 vmods_mask0*: int8
277 vmods_mask1*: int8
278 vmods0*: int8
279 vmods1*: int8
280
281
282
283 proc XkbSARedirectVMods*(a: PXkbRedirectKeyAction): int16
284 proc XkbSARedirectSetVMods*(a: PXkbRedirectKeyAction, m: int8)
285 proc XkbSARedirectVModsMask*(a: PXkbRedirectKeyAction): int16
286 proc XkbSARedirectSetVModsMask*(a: PXkbRedirectKeyAction, m: int8)
287 type
288 PXkbDeviceBtnAction* = ptr XkbDeviceBtnAction
289 XkbDeviceBtnAction*{.final.} = object
290 theType*: int8
291 flags*: int8
292 count*: int8
293 button*: int8
294 device*: int8
295
296
297
298 type
299 PXkbDeviceValuatorAction* = ptr XkbDeviceValuatorAction
300 XkbDeviceValuatorAction*{.final.} = object #
301 # Macros to classify key actions
302 #
303 theType*: int8
304 device*: int8
305 v1_what*: int8
306 v1_ndx*: int8
307 v1_value*: int8
308 v2_what*: int8
309 v2_ndx*: int8
310 v2_value*: int8
311
312
313
314 const
315 XkbAnyActionDataSize* = 7
316
317 type
318 PXkbAnyAction* = ptr XkbAnyAction
319 XkbAnyAction*{.final.} = object
320 theType*: int8
321 data*: array[0..XkbAnyActionDataSize - 1, int8]
322
323
324
325 proc XkbIsModAction*(a: PXkbAnyAction): bool
326 proc XkbIsGroupAction*(a: PXkbAnyAction): bool
327 proc XkbIsPtrAction*(a: PXkbAnyAction): bool
328 type
329 PXkbAction* = ptr XkbAction
330 XkbAction*{.final.} = object #
331 # XKB request codes, used in:
332 # - xkbReqType field of all requests
333 # - requestMinor field of some events
334 #
335 any*: XkbAnyAction
336 mods*: XkbModAction
337 group*: XkbGroupAction
338 iso*: XkbISOAction
339 thePtr*: XkbPtrAction
340 btn*: XkbPtrBtnAction
341 dflt*: XkbPtrDfltAction
342 screen*: XkbSwitchScreenAction
343 ctrls*: XkbCtrlsAction
344 msg*: XkbMessageAction
345 redirect*: XkbRedirectKeyAction
346 devbtn*: XkbDeviceBtnAction
347 devval*: XkbDeviceValuatorAction
348 theType*: int8
349
350
351
352 const
353 X_kbUseExtension* = 0
354 X_kbSelectEvents* = 1
355 X_kbBell* = 3
356 X_kbGetState* = 4
357 X_kbLatchLockState* = 5
358 X_kbGetControls* = 6
359 X_kbSetControls* = 7
360 X_kbGetMap* = 8
361 X_kbSetMap* = 9
362 X_kbGetCompatMap* = 10
363 X_kbSetCompatMap* = 11
364 X_kbGetIndicatorState* = 12
365 X_kbGetIndicatorMap* = 13
366 X_kbSetIndicatorMap* = 14
367 X_kbGetNamedIndicator* = 15
368 X_kbSetNamedIndicator* = 16
369 X_kbGetNames* = 17
370 X_kbSetNames* = 18
371 X_kbGetGeometry* = 19
372 X_kbSetGeometry* = 20
373 X_kbPerClientFlags* = 21
374 X_kbListComponents* = 22
375 X_kbGetKbdByName* = 23
376 X_kbGetDeviceInfo* = 24
377 X_kbSetDeviceInfo* = 25
378 X_kbSetDebuggingFlags* = 101 #
379 # In the X sense, XKB reports only one event.
380 # The type field of all XKB events is XkbEventCode
381 #
382
383 const
384 XkbEventCode* = 0
385 XkbNumberEvents* = XkbEventCode + 1 #
386 # XKB has a minor event code so it can use one X event code for
387 # multiple purposes.
388 # - reported in the xkbType field of all XKB events.
389 # - XkbSelectEventDetails: Indicates the event for which event details
390 # are being changed
391 #
392
393 const
394 XkbNewKeyboardNotify* = 0
395 XkbMapNotify* = 1
396 XkbStateNotify* = 2
397 XkbControlsNotify* = 3
398 XkbIndicatorStateNotify* = 4
399 XkbIndicatorMapNotify* = 5
400 XkbNamesNotify* = 6
401 XkbCompatMapNotify* = 7
402 XkbBellNotify* = 8
403 XkbActionMessage* = 9
404 XkbAccessXNotify* = 10
405 XkbExtensionDeviceNotify* = 11 #
406 # Event Mask:
407 # - XkbSelectEvents: Specifies event interest.
408 #
409
410 const
411 XkbNewKeyboardNotifyMask* = int(1) shl 0
412 XkbMapNotifyMask* = int(1) shl 1
413 XkbStateNotifyMask* = int(1) shl 2
414 XkbControlsNotifyMask* = int(1) shl 3
415 XkbIndicatorStateNotifyMask* = int(1) shl 4
416 XkbIndicatorMapNotifyMask* = int(1) shl 5
417 XkbNamesNotifyMask* = int(1) shl 6
418 XkbCompatMapNotifyMask* = int(1) shl 7
419 XkbBellNotifyMask* = int(1) shl 8
420 XkbActionMessageMask* = int(1) shl 9
421 XkbAccessXNotifyMask* = int(1) shl 10
422 XkbExtensionDeviceNotifyMask* = int(1) shl 11
423 XkbAllEventsMask* = 0x00000FFF #
424 # NewKeyboardNotify event details:
425 #
426
427 const
428 XkbNKN_KeycodesMask* = int(1) shl 0
429 XkbNKN_GeometryMask* = int(1) shl 1
430 XkbNKN_DeviceIDMask* = int(1) shl 2
431 XkbAllNewKeyboardEventsMask* = 0x00000007 #
432 # AccessXNotify event types:
433 # - The 'what' field of AccessXNotify events reports the
434 # reason that the event was generated.
435 #
436
437 const
438 XkbAXN_SKPress* = 0
439 XkbAXN_SKAccept* = 1
440 XkbAXN_SKReject* = 2
441 XkbAXN_SKRelease* = 3
442 XkbAXN_BKAccept* = 4
443 XkbAXN_BKReject* = 5
444 XkbAXN_AXKWarning* = 6 #
445 # AccessXNotify details:
446 # - Used as an event detail mask to limit the conditions under which
447 # AccessXNotify events are reported
448 #
449
450 const
451 XkbAXN_SKPressMask* = int(1) shl 0
452 XkbAXN_SKAcceptMask* = int(1) shl 1
453 XkbAXN_SKRejectMask* = int(1) shl 2
454 XkbAXN_SKReleaseMask* = int(1) shl 3
455 XkbAXN_BKAcceptMask* = int(1) shl 4
456 XkbAXN_BKRejectMask* = int(1) shl 5
457 XkbAXN_AXKWarningMask* = int(1) shl 6
458 XkbAllAccessXEventsMask* = 0x0000000F #
459 # State detail mask:
460 # - The 'changed' field of StateNotify events reports which of
461 # the keyboard state components have changed.
462 # - Used as an event detail mask to limit the conditions under
463 # which StateNotify events are reported.
464 #
465
466 const
467 XkbModifierStateMask* = int(1) shl 0
468 XkbModifierBaseMask* = int(1) shl 1
469 XkbModifierLatchMask* = int(1) shl 2
470 XkbModifierLockMask* = int(1) shl 3
471 XkbGroupStateMask* = int(1) shl 4
472 XkbGroupBaseMask* = int(1) shl 5
473 XkbGroupLatchMask* = int(1) shl 6
474 XkbGroupLockMask* = int(1) shl 7
475 XkbCompatStateMask* = int(1) shl 8
476 XkbGrabModsMask* = int(1) shl 9
477 XkbCompatGrabModsMask* = int(1) shl 10
478 XkbLookupModsMask* = int(1) shl 11
479 XkbCompatLookupModsMask* = int(1) shl 12
480 XkbPointerButtonMask* = int(1) shl 13
481 XkbAllStateComponentsMask* = 0x00003FFF #
482 # Controls detail masks:
483 # The controls specified in XkbAllControlsMask:
484 # - The 'changed' field of ControlsNotify events reports which of
485 # the keyboard controls have changed.
486 # - The 'changeControls' field of the SetControls request specifies
487 # the controls for which values are to be changed.
488 # - Used as an event detail mask to limit the conditions under
489 # which ControlsNotify events are reported.
490 #
491 # The controls specified in the XkbAllBooleanCtrlsMask:
492 # - The 'enabledControls' field of ControlsNotify events reports the
493 # current status of the boolean controls.
494 # - The 'enabledControlsChanges' field of ControlsNotify events reports
495 # any boolean controls that have been turned on or off.
496 # - The 'affectEnabledControls' and 'enabledControls' fields of the
497 # kbSetControls request change the set of enabled controls.
498 # - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
499 # an XkbControlsRec specify the controls to be changed if the keyboard
500 # times out and the values to which they should be changed.
501 # - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
502 # request specifies the specify the controls to be reset when the
503 # client exits and the values to which they should be reset.
504 # - The 'ctrls' field of an indicator map specifies the controls
505 # that drive the indicator.
506 # - Specifies the boolean controls affected by the SetControls and
507 # LockControls key actions.
508 #
509
510 const
511 XkbRepeatKeysMask* = int(1) shl 0
512 XkbSlowKeysMask* = int(1) shl 1
513 XkbBounceKeysMask* = int(1) shl 2
514 XkbStickyKeysMask* = int(1) shl 3
515 XkbMouseKeysMask* = int(1) shl 4
516 XkbMouseKeysAccelMask* = int(1) shl 5
517 XkbAccessXKeysMask* = int(1) shl 6
518 XkbAccessXTimeoutMask* = int(1) shl 7
519 XkbAccessXFeedbackMask* = int(1) shl 8
520 XkbAudibleBellMask* = int(1) shl 9
521 XkbOverlay1Mask* = int(1) shl 10
522 XkbOverlay2Mask* = int(1) shl 11
523 XkbIgnoreGroupLockMask* = int(1) shl 12
524 XkbGroupsWrapMask* = int(1) shl 27
525 XkbInternalModsMask* = int(1) shl 28
526 XkbIgnoreLockModsMask* = int(1) shl 29
527 XkbPerKeyRepeatMask* = int(1) shl 30
528 XkbControlsEnabledMask* = int(1) shl 31
529 XkbAccessXOptionsMask* = XkbStickyKeysMask or XkbAccessXFeedbackMask
530 XkbAllBooleanCtrlsMask* = 0x00001FFF
531 XkbAllControlsMask* = 0xF8001FFF #
532 # Compatibility Map Compontents:
533 # - Specifies the components to be allocated in XkbAllocCompatMap.
534 #
535
536 const
537 XkbSymInterpMask* = 1 shl 0
538 XkbGroupCompatMask* = 1 shl 1
539 XkbAllCompatMask* = 0x00000003 #
540 # Assorted constants and limits.
541 #
542
543 const
544 XkbAllIndicatorsMask* = 0xFFFFFFFF #
545 # Map components masks:
546 # Those in AllMapComponentsMask:
547 # - Specifies the individual fields to be loaded or changed for the
548 # GetMap and SetMap requests.
549 # Those in ClientInfoMask:
550 # - Specifies the components to be allocated by XkbAllocClientMap.
551 # Those in ServerInfoMask:
552 # - Specifies the components to be allocated by XkbAllocServerMap.
553 #
554
555 const
556 XkbKeyTypesMask* = 1 shl 0
557 XkbKeySymsMask* = 1 shl 1
558 XkbModifierMapMask* = 1 shl 2
559 XkbExplicitComponentsMask* = 1 shl 3
560 XkbKeyActionsMask* = 1 shl 4
561 XkbKeyBehaviorsMask* = 1 shl 5
562 XkbVirtualModsMask* = 1 shl 6
563 XkbVirtualModMapMask* = 1 shl 7
564 XkbAllClientInfoMask* = XkbKeyTypesMask or XkbKeySymsMask or
565 XkbModifierMapMask
566 XkbAllServerInfoMask* = XkbExplicitComponentsMask or XkbKeyActionsMask or
567 XkbKeyBehaviorsMask or XkbVirtualModsMask or XkbVirtualModMapMask
568 XkbAllMapComponentsMask* = XkbAllClientInfoMask or XkbAllServerInfoMask #
569 # Names component mask:
570 # - Specifies the names to be loaded or changed for the GetNames and
571 # SetNames requests.
572 # - Specifies the names that have changed in a NamesNotify event.
573 # - Specifies the names components to be allocated by XkbAllocNames.
574 #
575
576 const
577 XkbKeycodesNameMask* = 1 shl 0
578 XkbGeometryNameMask* = 1 shl 1
579 XkbSymbolsNameMask* = 1 shl 2
580 XkbPhysSymbolsNameMask* = 1 shl 3
581 XkbTypesNameMask* = 1 shl 4
582 XkbCompatNameMask* = 1 shl 5
583 XkbKeyTypeNamesMask* = 1 shl 6
584 XkbKTLevelNamesMask* = 1 shl 7
585 XkbIndicatorNamesMask* = 1 shl 8
586 XkbKeyNamesMask* = 1 shl 9
587 XkbKeyAliasesMask* = 1 shl 10
588 XkbVirtualModNamesMask* = 1 shl 11
589 XkbGroupNamesMask* = 1 shl 12
590 XkbRGNamesMask* = 1 shl 13
591 XkbComponentNamesMask* = 0x0000003F
592 XkbAllNamesMask* = 0x00003FFF #
593 # Miscellaneous event details:
594 # - event detail masks for assorted events that don't reall
595 # have any details.
596 #
597
598 const
599 XkbAllStateEventsMask* = XkbAllStateComponentsMask
600 XkbAllMapEventsMask* = XkbAllMapComponentsMask
601 XkbAllControlEventsMask* = XkbAllControlsMask
602 XkbAllIndicatorEventsMask* = XkbAllIndicatorsMask
603 XkbAllNameEventsMask* = XkbAllNamesMask
604 XkbAllCompatMapEventsMask* = XkbAllCompatMask
605 XkbAllBellEventsMask* = int(1) shl 0
606 XkbAllActionMessagesMask* = int(1) shl 0 #
607 # XKB reports one error: BadKeyboard
608 # A further reason for the error is encoded into to most significant
609 # byte of the resourceID for the error:
610 # XkbErr_BadDevice - the device in question was not found
611 # XkbErr_BadClass - the device was found but it doesn't belong to
612 # the appropriate class.
613 # XkbErr_BadId - the device was found and belongs to the right
614 # class, but not feedback with a matching id was
615 # found.
616 # The low byte of the resourceID for this error contains the device
617 # id, class specifier or feedback id that failed.
618 #
619
620 const
621 XkbKeyboard* = 0
622 XkbNumberErrors* = 1
623 XkbErr_BadDevice* = 0x000000FF
624 XkbErr_BadClass* = 0x000000FE
625 XkbErr_BadId* = 0x000000FD #
626 # Keyboard Components Mask:
627 # - Specifies the components that follow a GetKeyboardByNameReply
628 #
629
630 const
631 XkbClientMapMask* = int(1) shl 0
632 XkbServerMapMask* = int(1) shl 1
633 XkbCompatMapMask* = int(1) shl 2
634 XkbIndicatorMapMask* = int(1) shl 3
635 XkbNamesMask* = int(1) shl 4
636 XkbGeometryMask* = int(1) shl 5
637 XkbControlsMask* = int(1) shl 6
638 XkbAllComponentsMask* = 0x0000007F #
639 # AccessX Options Mask
640 # - The 'accessXOptions' field of an XkbControlsRec specifies the
641 # AccessX options that are currently in effect.
642 # - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
643 # fields of an XkbControlsRec specify the Access X options to be
644 # changed if the keyboard times out and the values to which they
645 # should be changed.
646 #
647
648 const
649 XkbAX_SKPressFBMask* = int(1) shl 0
650 XkbAX_SKAcceptFBMask* = int(1) shl 1
651 XkbAX_FeatureFBMask* = int(1) shl 2
652 XkbAX_SlowWarnFBMask* = int(1) shl 3
653 XkbAX_IndicatorFBMask* = int(1) shl 4
654 XkbAX_StickyKeysFBMask* = int(1) shl 5
655 XkbAX_TwoKeysMask* = int(1) shl 6
656 XkbAX_LatchToLockMask* = int(1) shl 7
657 XkbAX_SKReleaseFBMask* = int(1) shl 8
658 XkbAX_SKRejectFBMask* = int(1) shl 9
659 XkbAX_BKRejectFBMask* = int(1) shl 10
660 XkbAX_DumbBellFBMask* = int(1) shl 11
661 XkbAX_FBOptionsMask* = 0x00000F3F
662 XkbAX_SKOptionsMask* = 0x000000C0
663 XkbAX_AllOptionsMask* = 0x00000FFF #
664 # XkbUseCoreKbd is used to specify the core keyboard without having
665 # to look up its X input extension identifier.
666 # XkbUseCorePtr is used to specify the core pointer without having
667 # to look up its X input extension identifier.
668 # XkbDfltXIClass is used to specify "don't care" any place that the
669 # XKB protocol is looking for an X Input Extension
670 # device class.
671 # XkbDfltXIId is used to specify "don't care" any place that the
672 # XKB protocol is looking for an X Input Extension
673 # feedback identifier.
674 # XkbAllXIClasses is used to get information about all device indicators,
675 # whether they're part of the indicator feedback class
676 # or the keyboard feedback class.
677 # XkbAllXIIds is used to get information about all device indicator
678 # feedbacks without having to list them.
679 # XkbXINone is used to indicate that no class or id has been specified.
680 # XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs
681 # XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
682 # XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
683 # XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class
684 # XkbExplicitXIId(c) True if 'i' explicitly specifies a device id
685 # XkbSingleXIClass(c) True if 'c' specifies exactly one device class,
686 # including the default.
687 # XkbSingleXIId(i) True if 'i' specifies exactly one device
688 # identifier, including the default.
689 #
690
691 const
692 XkbUseCoreKbd* = 0x00000100
693 XkbUseCorePtr* = 0x00000200
694 XkbDfltXIClass* = 0x00000300
695 XkbDfltXIId* = 0x00000400
696 XkbAllXIClasses* = 0x00000500
697 XkbAllXIIds* = 0x00000600
698 XkbXINone* = 0x0000FF00
699
700 proc XkbLegalXILedClass*(c: int): bool
701 proc XkbLegalXIBellClass*(c: int): bool
702 proc XkbExplicitXIDevice*(c: int): bool
703 proc XkbExplicitXIClass*(c: int): bool
704 proc XkbExplicitXIId*(c: int): bool
705 proc XkbSingleXIClass*(c: int): bool
706 proc XkbSingleXIId*(c: int): bool
707 const
708 XkbNoModifier* = 0x000000FF
709 XkbNoShiftLevel* = 0x000000FF
710 XkbNoShape* = 0x000000FF
711 XkbNoIndicator* = 0x000000FF
712 XkbNoModifierMask* = 0
713 XkbAllModifiersMask* = 0x000000FF
714 XkbAllVirtualModsMask* = 0x0000FFFF
715 XkbNumKbdGroups* = 4
716 XkbMaxKbdGroup* = XkbNumKbdGroups - 1
717 XkbMaxMouseKeysBtn* = 4 #
718 # Group Index and Mask:
719 # - Indices into the kt_index array of a key type.
720 # - Mask specifies types to be changed for XkbChangeTypesOfKey
721 #
722
723 const
724 XkbGroup1Index* = 0
725 XkbGroup2Index* = 1
726 XkbGroup3Index* = 2
727 XkbGroup4Index* = 3
728 XkbAnyGroup* = 254
729 XkbAllGroups* = 255
730 XkbGroup1Mask* = 1 shl 0
731 XkbGroup2Mask* = 1 shl 1
732 XkbGroup3Mask* = 1 shl 2
733 XkbGroup4Mask* = 1 shl 3
734 XkbAnyGroupMask* = 1 shl 7
735 XkbAllGroupsMask* = 0x0000000F #
736 # BuildCoreState: Given a keyboard group and a modifier state,
737 # construct the value to be reported an event.
738 # GroupForCoreState: Given the state reported in an event,
739 # determine the keyboard group.
740 # IsLegalGroup: Returns TRUE if 'g' is a valid group index.
741 #
742
743 proc XkbBuildCoreState*(m, g: int): int
744 proc XkbGroupForCoreState*(s: int): int
745 proc XkbIsLegalGroup*(g: int): bool
746 #
747 # GroupsWrap values:
748 # - The 'groupsWrap' field of an XkbControlsRec specifies the
749 # treatment of out of range groups.
750 # - Bits 6 and 7 of the group info field of a key symbol map
751 # specify the interpretation of out of range groups for the
752 # corresponding key.
753 #
754 const
755 XkbWrapIntoRange* = 0x00000000
756 XkbClampIntoRange* = 0x00000040
757 XkbRedirectIntoRange* = 0x00000080 #
758 # Action flags: Reported in the 'flags' field of most key actions.
759 # Interpretation depends on the type of the action; not all actions
760 # accept all flags.
761 #
762 # Option Used for Actions
763 # ------ ----------------
764 # ClearLocks SetMods, LatchMods, SetGroup, LatchGroup
765 # LatchToLock SetMods, LatchMods, SetGroup, LatchGroup
766 # LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
767 # LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
768 # UseModMapMods SetMods, LatchMods, LockMods, ISOLock
769 # GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock
770 # UseDfltButton PtrBtn, LockPtrBtn
771 # NoAcceleration MovePtr
772 # MoveAbsoluteX MovePtr
773 # MoveAbsoluteY MovePtr
774 # ISODfltIsGroup ISOLock
775 # ISONoAffectMods ISOLock
776 # ISONoAffectGroup ISOLock
777 # ISONoAffectPtr ISOLock
778 # ISONoAffectCtrls ISOLock
779 # MessageOnPress ActionMessage
780 # MessageOnRelease ActionMessage
781 # MessageGenKeyEvent ActionMessage
782 # AffectDfltBtn SetPtrDflt
783 # DfltBtnAbsolute SetPtrDflt
784 # SwitchApplication SwitchScreen
785 # SwitchAbsolute SwitchScreen
786 #
787
788 const
789 XkbSA_ClearLocks* = int(1) shl 0
790 XkbSA_LatchToLock* = int(1) shl 1
791 XkbSA_LockNoLock* = int(1) shl 0
792 XkbSA_LockNoUnlock* = int(1) shl 1
793 XkbSA_UseModMapMods* = int(1) shl 2
794 XkbSA_GroupAbsolute* = int(1) shl 2
795 XkbSA_UseDfltButton* = 0
796 XkbSA_NoAcceleration* = int(1) shl 0
797 XkbSA_MoveAbsoluteX* = int(1) shl 1
798 XkbSA_MoveAbsoluteY* = int(1) shl 2
799 XkbSA_ISODfltIsGroup* = int(1) shl 7
800 XkbSA_ISONoAffectMods* = int(1) shl 6
801 XkbSA_ISONoAffectGroup* = int(1) shl 5
802 XkbSA_ISONoAffectPtr* = int(1) shl 4
803 XkbSA_ISONoAffectCtrls* = int(1) shl 3
804 XkbSA_ISOAffectMask* = 0x00000078
805 XkbSA_MessageOnPress* = int(1) shl 0
806 XkbSA_MessageOnRelease* = int(1) shl 1
807 XkbSA_MessageGenKeyEvent* = int(1) shl 2
808 XkbSA_AffectDfltBtn* = 1
809 XkbSA_DfltBtnAbsolute* = int(1) shl 2
810 XkbSA_SwitchApplication* = int(1) shl 0
811 XkbSA_SwitchAbsolute* = int(1) shl 2 #
812 # The following values apply to the SA_DeviceValuator
813 # action only. Valuator operations specify the action
814 # to be taken. Values specified in the action are
815 # multiplied by 2^scale before they are applied.
816 #
817
818 const
819 XkbSA_IgnoreVal* = 0x00000000
820 XkbSA_SetValMin* = 0x00000010
821 XkbSA_SetValCenter* = 0x00000020
822 XkbSA_SetValMax* = 0x00000030
823 XkbSA_SetValRelative* = 0x00000040
824 XkbSA_SetValAbsolute* = 0x00000050
825 XkbSA_ValOpMask* = 0x00000070
826 XkbSA_ValScaleMask* = 0x00000007
827
828 proc XkbSA_ValOp*(a: int): int
829 proc XkbSA_ValScale*(a: int): int
830 #
831 # Action types: specifies the type of a key action. Reported in the
832 # type field of all key actions.
833 #
834 const
835 XkbSA_NoAction* = 0x00000000
836 XkbSA_SetMods* = 0x00000001
837 XkbSA_LatchMods* = 0x00000002
838 XkbSA_LockMods* = 0x00000003
839 XkbSA_SetGroup* = 0x00000004
840 XkbSA_LatchGroup* = 0x00000005
841 XkbSA_LockGroup* = 0x00000006
842 XkbSA_MovePtr* = 0x00000007
843 XkbSA_PtrBtn* = 0x00000008
844 XkbSA_LockPtrBtn* = 0x00000009
845 XkbSA_SetPtrDflt* = 0x0000000A
846 XkbSA_ISOLock* = 0x0000000B
847 XkbSA_Terminate* = 0x0000000C
848 XkbSA_SwitchScreen* = 0x0000000D
849 XkbSA_SetControls* = 0x0000000E
850 XkbSA_LockControls* = 0x0000000F
851 XkbSA_ActionMessage* = 0x00000010
852 XkbSA_RedirectKey* = 0x00000011
853 XkbSA_DeviceBtn* = 0x00000012
854 XkbSA_LockDeviceBtn* = 0x00000013
855 XkbSA_DeviceValuator* = 0x00000014
856 XkbSA_LastAction* = XkbSA_DeviceValuator
857 XkbSA_NumActions* = XkbSA_LastAction + 1
858
859 const
860 XkbSA_XFree86Private* = 0x00000086
861 #
862 # Specifies the key actions that clear latched groups or modifiers.
863 #
864
865 const ##define XkbSA_BreakLatch \
866 # ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
867 # (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
868 # (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
869 # (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
870 #
871 XkbSA_BreakLatch* = (1 shl XkbSA_PtrBtn) or (1 shl XkbSA_LockPtrBtn) or
872 (1 shl XkbSA_Terminate) or (1 shl XkbSA_SwitchScreen) or
873 (1 shl XkbSA_SetControls) or (1 shl XkbSA_LockControls) or
874 (1 shl XkbSA_ActionMessage) or (1 shl XkbSA_RedirectKey) or
875 (1 shl XkbSA_DeviceBtn) or (1 shl XkbSA_LockDeviceBtn) #
876 # Key Behavior Qualifier:
877 # KB_Permanent indicates that the behavior describes an unalterable
878 # characteristic of the keyboard, not an XKB software-simulation of
879 # the listed behavior.
880 # Key Behavior Types:
881 # Specifies the behavior of the underlying key.
882 #
883
884 const
885 XkbKB_Permanent* = 0x00000080
886 XkbKB_OpMask* = 0x0000007F
887 XkbKB_Default* = 0x00000000
888 XkbKB_Lock* = 0x00000001
889 XkbKB_RadioGroup* = 0x00000002
890 XkbKB_Overlay1* = 0x00000003
891 XkbKB_Overlay2* = 0x00000004
892 XkbKB_RGAllowNone* = 0x00000080 #
893 # Various macros which describe the range of legal keycodes.
894 #
895
896 const
897 XkbMinLegalKeyCode* = 8
898 XkbMaxLegalKeyCode* = 255
899 XkbMaxKeyCount* = XkbMaxLegalKeyCode - XkbMinLegalKeyCode + 1
900 XkbPerKeyBitArraySize* = (XkbMaxLegalKeyCode + 1) div 8
901
902 proc XkbIsLegalKeycode*(k: int): bool
903 type
904 PXkbControlsPtr* = ptr XkbControlsRec
905 XkbControlsRec*{.final.} = object
906 mk_dflt_btn*: int8
907 num_groups*: int8
908 groups_wrap*: int8
909 internal*: XkbModsRec
910 ignore_lock*: XkbModsRec
911 enabled_ctrls*: int16
912 repeat_delay*: int16
913 repeat_interval*: int16
914 slow_keys_delay*: int16
915 debounce_delay*: int16
916 mk_delay*: int16
917 mk_interval*: int16
918 mk_time_to_max*: int16
919 mk_max_speed*: int16
920 mk_curve*: int16
921 ax_options*: int16
922 ax_timeout*: int16
923 axt_opts_mask*: int16
924 axt_opts_values*: int16
925 axt_ctrls_mask*: int16
926 axt_ctrls_values*: int16
927 per_key_repeat*: array[0..XkbPerKeyBitArraySize - 1, int8]
928
929
930
931 proc XkbAX_AnyFeedback*(c: PXkbControlsPtr): int16
932 proc XkbAX_NeedOption*(c: PXkbControlsPtr, w: int16): int16
933 proc XkbAX_NeedFeedback*(c: PXkbControlsPtr, w: int16): bool
934 #
935 # Assorted constants and limits.
936 #
937 const
938 XkbNumModifiers* = 8
939 XkbNumVirtualMods* = 16
940 XkbNumIndicators* = 32
941 XkbMaxRadioGroups* = 32
942 XkbAllRadioGroupsMask* = 0xFFFFFFFF
943 XkbMaxShiftLevel* = 63
944 XkbMaxSymsPerKey* = XkbMaxShiftLevel * XkbNumKbdGroups
945 XkbRGMaxMembers* = 12
946 XkbActionMessageLength* = 6
947 XkbKeyNameLength* = 4
948 XkbMaxRedirectCount* = 8
949 XkbGeomPtsPerMM* = 10
950 XkbGeomMaxColors* = 32
951 XkbGeomMaxLabelColors* = 3
952 XkbGeomMaxPriority* = 255
953
954 type
955 PXkbServerMapPtr* = ptr XkbServerMapRec
956 XkbServerMapRec*{.final.} = object
957 num_acts*: int16
958 size_acts*: int16
959 acts*: ptr array[0..0xfff, XkbAction]
960 behaviors*: PXkbBehavior
961 key_acts*: PWord
962 explicit*: PByte
963 vmods*: array[0..XkbNumVirtualMods - 1, int8]
964 vmodmap*: PWord
965
966
967
968 proc XkbSMKeyActionsPtr*(m: PXkbServerMapPtr, k: int16): PXkbAction
969 #
970 # Structures and access macros used primarily by clients
971 #
972 type
973 PXkbSymMapPtr* = ptr XkbSymMapRec
974 XkbSymMapRec*{.final.} = object
975 kt_index*: array[0..XkbNumKbdGroups - 1, int8]
976 group_info*: int8
977 width*: int8
978 offset*: int8
979
980
981
982 type
983 PXkbClientMapPtr* = ptr XkbClientMapRec
984 XkbClientMapRec*{.final.} = object
985 size_types*: int8
986 num_types*: int8
987 types*: ptr array[0..0xffff, XkbKeyTypeRec]
988 size_syms*: int16
989 num_syms*: int16
990 syms*: ptr array[0..0xffff, KeySym]
991 key_sym_map*: ptr array[0..0xffff, XkbSymMapRec]
992 modmap*: PByte
993
994
995
996 proc XkbCMKeyGroupInfo*(m: PXkbClientMapPtr, k: int16): int8
997 proc XkbCMKeyNumGroups*(m: PXkbClientMapPtr, k: int16): int8
998 proc XkbCMKeyGroupWidth*(m: PXkbClientMapPtr, k: int16, g: int8): int8
999 proc XkbCMKeyGroupsWidth*(m: PXkbClientMapPtr, k: int16): int8
1000 proc XkbCMKeyTypeIndex*(m: PXkbClientMapPtr, k: int16, g: int8): int8
1001 proc XkbCMKeyType*(m: PXkbClientMapPtr, k: int16, g: int8): PXkbKeyTypePtr
1002 proc XkbCMKeyNumSyms*(m: PXkbClientMapPtr, k: int16): int16
1003 proc XkbCMKeySymsOffset*(m: PXkbClientMapPtr, k: int16): int8
1004 #
1005 # Compatibility structures and access macros
1006 #
1007 type
1008 PXkbSymInterpretPtr* = ptr XkbSymInterpretRec
1009 XkbSymInterpretRec*{.final.} = object
1010 sym*: KeySym
1011 flags*: int8
1012 match*: int8
1013 mods*: int8
1014 virtual_mod*: int8
1015 act*: XkbAnyAction
1016
1017
1018
1019 type
1020 PXkbCompatMapPtr* = ptr XkbCompatMapRec
1021 XkbCompatMapRec*{.final.} = object
1022 sym_interpret*: PXkbSymInterpretPtr
1023 groups*: array[0..XkbNumKbdGroups - 1, XkbModsRec]
1024 num_si*: int16
1025 size_si*: int16
1026
1027
1028
1029 type
1030 PXkbIndicatorMapPtr* = ptr XkbIndicatorMapRec
1031 XkbIndicatorMapRec*{.final.} = object
1032 flags*: int8
1033 which_groups*: int8
1034 groups*: int8
1035 which_mods*: int8
1036 mods*: XkbModsRec
1037 ctrls*: int16
1038
1039
1040
1041 proc XkbIM_IsAuto*(i: PXkbIndicatorMapPtr): bool
1042 proc XkbIM_InUse*(i: PXkbIndicatorMapPtr): bool
1043 type
1044 PXkbIndicatorPtr* = ptr XkbIndicatorRec
1045 XkbIndicatorRec*{.final.} = object
1046 phys_indicators*: int32
1047 maps*: array[0..XkbNumIndicators - 1, XkbIndicatorMapRec]
1048
1049
1050
1051 type
1052 PXkbKeyNamePtr* = ptr XkbKeyNameRec
1053 XkbKeyNameRec*{.final.} = object
1054 name*: array[0..XkbKeyNameLength - 1, char]
1055
1056
1057
1058 type
1059 PXkbKeyAliasPtr* = ptr XkbKeyAliasRec
1060 XkbKeyAliasRec*{.final.} = object #
1061 # Names for everything
1062 #
1063 float*: array[0..XkbKeyNameLength - 1, char]
1064 alias*: array[0..XkbKeyNameLength - 1, char]
1065
1066
1067
1068 type
1069 PXkbNamesPtr* = ptr XkbNamesRec
1070 XkbNamesRec*{.final.} = object #
1071 # Key Type index and mask for the four standard key types.
1072 #
1073 keycodes*: Atom
1074 geometry*: Atom
1075 symbols*: Atom
1076 types*: Atom
1077 compat*: Atom
1078 vmods*: array[0..XkbNumVirtualMods - 1, Atom]
1079 indicators*: array[0..XkbNumIndicators - 1, Atom]
1080 groups*: array[0..XkbNumKbdGroups - 1, Atom]
1081 keys*: PXkbKeyNamePtr
1082 key_aliases*: PXkbKeyAliasPtr
1083 radio_groups*: PAtom
1084 phys_symbols*: Atom
1085 num_keys*: int8
1086 num_key_aliases*: int8
1087 num_rg*: int16
1088
1089
1090
1091 const
1092 XkbOneLevelIndex* = 0
1093 XkbTwoLevelIndex* = 1
1094 XkbAlphabeticIndex* = 2
1095 XkbKeypadIndex* = 3
1096 XkbLastRequiredType* = XkbKeypadIndex
1097 XkbNumRequiredTypes* = XkbLastRequiredType + 1
1098 XkbMaxKeyTypes* = 255
1099 XkbOneLevelMask* = 1 shl 0
1100 XkbTwoLevelMask* = 1 shl 1
1101 XkbAlphabeticMask* = 1 shl 2
1102 XkbKeypadMask* = 1 shl 3
1103 XkbAllRequiredTypes* = 0x0000000F
1104
1105 proc XkbShiftLevel*(n: int8): int8
1106 proc XkbShiftLevelMask*(n: int8): int8
1107 #
1108 # Extension name and version information
1109 #
1110 const
1111 XkbName* = "XKEYBOARD"
1112 XkbMajorVersion* = 1
1113 XkbMinorVersion* = 0 #
1114 # Explicit map components:
1115 # - Used in the 'explicit' field of an XkbServerMap. Specifies
1116 # the keyboard components that should _not_ be updated automatically
1117 # in response to core protocol keyboard mapping requests.
1118 #
1119
1120 const
1121 XkbExplicitKeyTypesMask* = 0x0000000F
1122 XkbExplicitKeyType1Mask* = 1 shl 0
1123 XkbExplicitKeyType2Mask* = 1 shl 1
1124 XkbExplicitKeyType3Mask* = 1 shl 2
1125 XkbExplicitKeyType4Mask* = 1 shl 3
1126 XkbExplicitInterpretMask* = 1 shl 4
1127 XkbExplicitAutoRepeatMask* = 1 shl 5
1128 XkbExplicitBehaviorMask* = 1 shl 6
1129 XkbExplicitVModMapMask* = 1 shl 7
1130 XkbAllExplicitMask* = 0x000000FF #
1131 # Symbol interpretations flags:
1132 # - Used in the flags field of a symbol interpretation
1133 #
1134
1135 const
1136 XkbSI_AutoRepeat* = 1 shl 0
1137 XkbSI_LockingKey* = 1 shl 1 #
1138 # Symbol interpretations match specification:
1139 # - Used in the match field of a symbol interpretation to specify
1140 # the conditions under which an interpretation is used.
1141 #
1142
1143 const
1144 XkbSI_LevelOneOnly* = 0x00000080
1145 XkbSI_OpMask* = 0x0000007F
1146 XkbSI_NoneOf* = 0
1147 XkbSI_AnyOfOrNone* = 1
1148 XkbSI_AnyOf* = 2
1149 XkbSI_AllOf* = 3
1150 XkbSI_Exactly* = 4 #
1151 # Indicator map flags:
1152 # - Used in the flags field of an indicator map to indicate the
1153 # conditions under which and indicator can be changed and the
1154 # effects of changing the indicator.
1155 #
1156
1157 const
1158 XkbIM_NoExplicit* = int(1) shl 7
1159 XkbIM_NoAutomatic* = int(1) shl 6
1160 XkbIM_LEDDrivesKB* = int(1) shl 5 #
1161 # Indicator map component specifications:
1162 # - Used by the 'which_groups' and 'which_mods' fields of an indicator
1163 # map to specify which keyboard components should be used to drive
1164 # the indicator.
1165 #
1166
1167 const
1168 XkbIM_UseBase* = int(1) shl 0
1169 XkbIM_UseLatched* = int(1) shl 1
1170 XkbIM_UseLocked* = int(1) shl 2
1171 XkbIM_UseEffective* = int(1) shl 3
1172 XkbIM_UseCompat* = int(1) shl 4
1173 XkbIM_UseNone* = 0
1174 XkbIM_UseAnyGroup* = XkbIM_UseBase or XkbIM_UseLatched or XkbIM_UseLocked or
1175 XkbIM_UseEffective
1176 XkbIM_UseAnyMods* = XkbIM_UseAnyGroup or XkbIM_UseCompat #
1177 # GetByName components:
1178 # - Specifies desired or necessary components to GetKbdByName request.
1179 # - Reports the components that were found in a GetKbdByNameReply
1180 #
1181
1182 const
1183 XkbGBN_TypesMask* = int(1) shl 0
1184 XkbGBN_CompatMapMask* = int(1) shl 1
1185 XkbGBN_ClientSymbolsMask* = int(1) shl 2
1186 XkbGBN_ServerSymbolsMask* = int(1) shl 3
1187 XkbGBN_SymbolsMask* = XkbGBN_ClientSymbolsMask or XkbGBN_ServerSymbolsMask
1188 XkbGBN_IndicatorMapMask* = int(1) shl 4
1189 XkbGBN_KeyNamesMask* = int(1) shl 5
1190 XkbGBN_GeometryMask* = int(1) shl 6
1191 XkbGBN_OtherNamesMask* = int(1) shl 7
1192 XkbGBN_AllComponentsMask* = 0x000000FF #
1193 # ListComponents flags
1194 #
1195
1196 const
1197 XkbLC_Hidden* = int(1) shl 0
1198 XkbLC_Default* = int(1) shl 1
1199 XkbLC_Partial* = int(1) shl 2
1200 XkbLC_AlphanumericKeys* = int(1) shl 8
1201 XkbLC_ModifierKeys* = int(1) shl 9
1202 XkbLC_KeypadKeys* = int(1) shl 10
1203 XkbLC_FunctionKeys* = int(1) shl 11
1204 XkbLC_AlternateGroup* = int(1) shl 12 #
1205 # X Input Extension Interactions
1206 # - Specifies the possible interactions between XKB and the X input
1207 # extension
1208 # - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
1209 # XKB information about an extension device.
1210 # - Reports the list of supported optional features in the reply to
1211 # XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
1212 # XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
1213 # events to indicate an attempt to use an unsupported feature.
1214 #
1215
1216 const
1217 XkbXI_KeyboardsMask* = int(1) shl 0
1218 XkbXI_ButtonActionsMask* = int(1) shl 1
1219 XkbXI_IndicatorNamesMask* = int(1) shl 2
1220 XkbXI_IndicatorMapsMask* = int(1) shl 3
1221 XkbXI_IndicatorStateMask* = int(1) shl 4
1222 XkbXI_UnsupportedFeatureMask* = int(1) shl 15
1223 XkbXI_AllFeaturesMask* = 0x0000001F
1224 XkbXI_AllDeviceFeaturesMask* = 0x0000001E
1225 XkbXI_IndicatorsMask* = 0x0000001C
1226 XkbAllExtensionDeviceEventsMask* = 0x0000801F #
1227 # Per-Client Flags:
1228 # - Specifies flags to be changed by the PerClientFlags request.
1229 #
1230
1231 const
1232 XkbPCF_DetectableAutoRepeatMask* = int(1) shl 0
1233 XkbPCF_GrabsUseXKBStateMask* = int(1) shl 1
1234 XkbPCF_AutoResetControlsMask* = int(1) shl 2
1235 XkbPCF_LookupStateWhenGrabbed* = int(1) shl 3
1236 XkbPCF_SendEventUsesXKBState* = int(1) shl 4
1237 XkbPCF_AllFlagsMask* = 0x0000001F #
1238 # Debugging flags and controls
1239 #
1240
1241 const
1242 XkbDF_DisableLocks* = 1 shl 0
1243
1244 type
1245 PXkbPropertyPtr* = ptr XkbPropertyRec
1246 XkbPropertyRec*{.final.} = object
1247 name*: cstring
1248 value*: cstring
1249
1250
1251
1252 type
1253 PXkbColorPtr* = ptr XkbColorRec
1254 XkbColorRec*{.final.} = object
1255 pixel*: int16
1256 spec*: cstring
1257
1258
1259
1260 type
1261 PXkbPointPtr* = ptr XkbPointRec
1262 XkbPointRec*{.final.} = object
1263 x*: int16
1264 y*: int16
1265
1266
1267
1268 type
1269 PXkbBoundsPtr* = ptr XkbBoundsRec
1270 XkbBoundsRec*{.final.} = object
1271 x1*: int16
1272 y1*: int16
1273 x2*: int16
1274 y2*: int16
1275
1276
1277
1278 proc XkbBoundsWidth*(b: PXkbBoundsPtr): int16
1279 proc XkbBoundsHeight*(b: PXkbBoundsPtr): int16
1280 type
1281 PXkbOutlinePtr* = ptr XkbOutlineRec
1282 XkbOutlineRec*{.final.} = object
1283 num_points*: int16
1284 sz_points*: int16
1285 corner_radius*: int16
1286 points*: PXkbPointPtr
1287
1288
1289
1290 type
1291 PXkbShapePtr* = ptr XkbShapeRec
1292 XkbShapeRec*{.final.} = object
1293 name*: Atom
1294 num_outlines*: int16
1295 sz_outlines*: int16
1296 outlines*: ptr array[0..0xffff, XkbOutlineRec]
1297 approx*: ptr array[0..0xffff, XkbOutlineRec]
1298 primary*: ptr array[0..0xffff, XkbOutlineRec]
1299 bounds*: XkbBoundsRec
1300
1301
1302
1303 proc XkbOutlineIndex*(s: PXkbShapePtr, o: PXkbOutlinePtr): int32
1304 type
1305 PXkbShapeDoodadPtr* = ptr XkbShapeDoodadRec
1306 XkbShapeDoodadRec*{.final.} = object
1307 name*: Atom
1308 theType*: int8
1309 priority*: int8
1310 top*: int16
1311 left*: int16
1312 angle*: int16
1313 color_ndx*: int16
1314 shape_ndx*: int16
1315
1316
1317
1318 type
1319 PXkbTextDoodadPtr* = ptr XkbTextDoodadRec
1320 XkbTextDoodadRec*{.final.} = object
1321 name*: Atom
1322 theType*: int8
1323 priority*: int8
1324 top*: int16
1325 left*: int16
1326 angle*: int16
1327 width*: int16
1328 height*: int16
1329 color_ndx*: int16
1330 text*: cstring
1331 font*: cstring
1332
1333
1334
1335 type
1336 PXkbIndicatorDoodadPtr* = ptr XkbIndicatorDoodadRec
1337 XkbIndicatorDoodadRec*{.final.} = object
1338 name*: Atom
1339 theType*: int8
1340 priority*: int8
1341 top*: int16
1342 left*: int16
1343 angle*: int16
1344 shape_ndx*: int16
1345 on_color_ndx*: int16
1346 off_color_ndx*: int16
1347
1348
1349
1350 type
1351 PXkbLogoDoodadPtr* = ptr XkbLogoDoodadRec
1352 XkbLogoDoodadRec*{.final.} = object
1353 name*: Atom
1354 theType*: int8
1355 priority*: int8
1356 top*: int16
1357 left*: int16
1358 angle*: int16
1359 color_ndx*: int16
1360 shape_ndx*: int16
1361 logo_name*: cstring
1362
1363
1364
1365 type
1366 PXkbAnyDoodadPtr* = ptr XkbAnyDoodadRec
1367 XkbAnyDoodadRec*{.final.} = object
1368 name*: Atom
1369 theType*: int8
1370 priority*: int8
1371 top*: int16
1372 left*: int16
1373 angle*: int16
1374
1375
1376
1377 type
1378 PXkbDoodadPtr* = ptr XkbDoodadRec
1379 XkbDoodadRec*{.final.} = object
1380 any*: XkbAnyDoodadRec
1381 shape*: XkbShapeDoodadRec
1382 text*: XkbTextDoodadRec
1383 indicator*: XkbIndicatorDoodadRec
1384 logo*: XkbLogoDoodadRec
1385
1386
1387
1388 const
1389 XkbUnknownDoodad* = 0
1390 XkbOutlineDoodad* = 1
1391 XkbSolidDoodad* = 2
1392 XkbTextDoodad* = 3
1393 XkbIndicatorDoodad* = 4
1394 XkbLogoDoodad* = 5
1395
1396 type
1397 PXkbKeyPtr* = ptr XkbKeyRec
1398 XkbKeyRec*{.final.} = object
1399 name*: XkbKeyNameRec
1400 gap*: int16
1401 shape_ndx*: int8
1402 color_ndx*: int8
1403
1404
1405
1406 type
1407 PXkbRowPtr* = ptr XkbRowRec
1408 XkbRowRec*{.final.} = object
1409 top*: int16
1410 left*: int16
1411 num_keys*: int16
1412 sz_keys*: int16
1413 vertical*: int16
1414 Keys*: PXkbKeyPtr
1415 bounds*: XkbBoundsRec
1416
1417
1418
1419 type
1420 PXkbOverlayPtr* = ptr XkbOverlayRec #forward for XkbSectionRec use.
1421 #Do not add more "type"
1422 PXkbSectionPtr* = ptr XkbSectionRec
1423 XkbSectionRec*{.final.} = object #Do not add more "type"
1424 name*: Atom
1425 priority*: int8
1426 top*: int16
1427 left*: int16
1428 width*: int16
1429 height*: int16
1430 angle*: int16
1431 num_rows*: int16
1432 num_doodads*: int16
1433 num_overlays*: int16
1434 rows*: PXkbRowPtr
1435 doodads*: PXkbDoodadPtr
1436 bounds*: XkbBoundsRec
1437 overlays*: PXkbOverlayPtr
1438
1439 PXkbOverlayKeyPtr* = ptr XkbOverlayKeyRec
1440 XkbOverlayKeyRec*{.final.} = object #Do not add more "type"
1441 over*: XkbKeyNameRec
1442 under*: XkbKeyNameRec
1443
1444 PXkbOverlayRowPtr* = ptr XkbOverlayRowRec
1445 XkbOverlayRowRec*{.final.} = object #Do not add more "type"
1446 row_under*: int16
1447 num_keys*: int16
1448 sz_keys*: int16
1449 keys*: PXkbOverlayKeyPtr
1450
1451 XkbOverlayRec*{.final.} = object
1452 name*: Atom
1453 section_under*: PXkbSectionPtr
1454 num_rows*: int16
1455 sz_rows*: int16
1456 rows*: PXkbOverlayRowPtr
1457 bounds*: PXkbBoundsPtr
1458
1459
1460 type
1461 PXkbGeometryRec* = ptr XkbGeometryRec
1462 PXkbGeometryPtr* = PXkbGeometryRec
1463 XkbGeometryRec*{.final.} = object
1464 name*: Atom
1465 width_mm*: int16
1466 height_mm*: int16
1467 label_font*: cstring
1468 label_color*: PXkbColorPtr
1469 base_color*: PXkbColorPtr
1470 sz_properties*: int16
1471 sz_colors*: int16
1472 sz_shapes*: int16
1473 sz_sections*: int16
1474 sz_doodads*: int16
1475 sz_key_aliases*: int16
1476 num_properties*: int16
1477 num_colors*: int16
1478 num_shapes*: int16
1479 num_sections*: int16
1480 num_doodads*: int16
1481 num_key_aliases*: int16
1482 properties*: ptr array[0..0xffff, XkbPropertyRec]
1483 colors*: ptr array[0..0xffff, XkbColorRec]
1484 shapes*: ptr array[0..0xffff, XkbShapeRec]
1485 sections*: ptr array[0..0xffff, XkbSectionRec]
1486 key_aliases*: ptr array[0..0xffff, XkbKeyAliasRec]
1487
1488
1489
1490 const
1491 XkbGeomPropertiesMask* = 1 shl 0
1492 XkbGeomColorsMask* = 1 shl 1
1493 XkbGeomShapesMask* = 1 shl 2
1494 XkbGeomSectionsMask* = 1 shl 3
1495 XkbGeomDoodadsMask* = 1 shl 4
1496 XkbGeomKeyAliasesMask* = 1 shl 5
1497 XkbGeomAllMask* = 0x0000003F
1498
1499 type
1500 PXkbGeometrySizesPtr* = ptr XkbGeometrySizesRec
1501 XkbGeometrySizesRec*{.final.} = object #
1502 # Tie it all together into one big keyboard description
1503 #
1504 which*: int16
1505 num_properties*: int16
1506 num_colors*: int16
1507 num_shapes*: int16
1508 num_sections*: int16
1509 num_doodads*: int16
1510 num_key_aliases*: int16
1511
1512
1513
1514 type
1515 PXkbDescPtr* = ptr XkbDescRec
1516 XkbDescRec*{.final.} = object
1517 dpy*: PDisplay
1518 flags*: int16
1519 device_spec*: int16
1520 min_key_code*: KeyCode
1521 max_key_code*: KeyCode
1522 ctrls*: PXkbControlsPtr
1523 server*: PXkbServerMapPtr
1524 map*: PXkbClientMapPtr
1525 indicators*: PXkbIndicatorPtr
1526 names*: PXkbNamesPtr
1527 compat*: PXkbCompatMapPtr
1528 geom*: PXkbGeometryPtr
1529
1530
1531
1532 proc XkbKeyKeyTypeIndex*(d: PXkbDescPtr, k: int16, g: int8): int8
1533 proc XkbKeyKeyType*(d: PXkbDescPtr, k: int16, g: int8): PXkbKeyTypePtr
1534 proc XkbKeyGroupWidth*(d: PXkbDescPtr, k: int16, g: int8): int8
1535 proc XkbKeyGroupsWidth*(d: PXkbDescPtr, k: int16): int8
1536 proc XkbKeyGroupInfo*(d: PXkbDescPtr, k: int16): int8
1537 proc XkbKeyNumGroups*(d: PXkbDescPtr, k: int16): int8
1538 proc XkbKeyNumSyms*(d: PXkbDescPtr, k: int16): int16
1539 proc XkbKeySym*(d: PXkbDescPtr, k: int16, n: int16): KeySym
1540 proc XkbKeySymEntry*(d: PXkbDescPtr, k: int16, sl: int16, g: int8): KeySym
1541 proc XkbKeyAction*(d: PXkbDescPtr, k: int16, n: int16): PXkbAction
1542 proc XkbKeyActionEntry*(d: PXkbDescPtr, k: int16, sl: int16, g: int8): int8
1543 proc XkbKeyHasActions*(d: PXkbDescPtr, k: int16): bool
1544 proc XkbKeyNumActions*(d: PXkbDescPtr, k: int16): int16
1545 proc XkbKeyActionsPtr*(d: PXkbDescPtr, k: int16): PXkbAction
1546 proc XkbKeycodeInRange*(d: PXkbDescPtr, k: int16): bool
1547 proc XkbNumKeys*(d: PXkbDescPtr): int8
1548 #
1549 # The following structures can be used to track changes
1550 # to a keyboard device
1551 #
1552 type
1553 PXkbMapChangesPtr* = ptr XkbMapChangesRec
1554 XkbMapChangesRec*{.final.} = object
1555 changed*: int16
1556 min_key_code*: KeyCode
1557 max_key_code*: KeyCode
1558 first_type*: int8
1559 num_types*: int8
1560 first_key_sym*: KeyCode
1561 num_key_syms*: int8
1562 first_key_act*: KeyCode
1563 num_key_acts*: int8
1564 first_key_behavior*: KeyCode
1565 num_key_behaviors*: int8
1566 first_key_explicit*: KeyCode
1567 num_key_explicit*: int8
1568 first_modmap_key*: KeyCode
1569 num_modmap_keys*: int8
1570 first_vmodmap_key*: KeyCode
1571 num_vmodmap_keys*: int8
1572 pad*: int8
1573 vmods*: int16
1574
1575
1576
1577 type
1578 PXkbControlsChangesPtr* = ptr XkbControlsChangesRec
1579 XkbControlsChangesRec*{.final.} = object
1580 changed_ctrls*: int16
1581 enabled_ctrls_changes*: int16
1582 num_groups_changed*: bool
1583
1584
1585
1586 type
1587 PXkbIndicatorChangesPtr* = ptr XkbIndicatorChangesRec
1588 XkbIndicatorChangesRec*{.final.} = object
1589 state_changes*: int16
1590 map_changes*: int16
1591
1592
1593
1594 type
1595 PXkbNameChangesPtr* = ptr XkbNameChangesRec
1596 XkbNameChangesRec*{.final.} = object
1597 changed*: int16
1598 first_type*: int8
1599 num_types*: int8
1600 first_lvl*: int8
1601 num_lvls*: int8
1602 num_aliases*: int8
1603 num_rg*: int8
1604 first_key*: int8
1605 num_keys*: int8
1606 changed_vmods*: int16
1607 changed_indicators*: int32
1608 changed_groups*: int8
1609
1610
1611
1612 type
1613 PXkbCompatChangesPtr* = ptr XkbCompatChangesRec
1614 XkbCompatChangesRec*{.final.} = object
1615 changed_groups*: int8
1616 first_si*: int16
1617 num_si*: int16
1618
1619
1620
1621 type
1622 PXkbChangesPtr* = ptr XkbChangesRec
1623 XkbChangesRec*{.final.} = object #
1624 # These data structures are used to construct a keymap from
1625 # a set of components or to list components in the server
1626 # database.
1627 #
1628 device_spec*: int16
1629 state_changes*: int16
1630 map*: XkbMapChangesRec
1631 ctrls*: XkbControlsChangesRec
1632 indicators*: XkbIndicatorChangesRec
1633 names*: XkbNameChangesRec
1634 compat*: XkbCompatChangesRec
1635
1636
1637
1638 type
1639 PXkbComponentNamesPtr* = ptr XkbComponentNamesRec
1640 XkbComponentNamesRec*{.final.} = object
1641 keymap*: ptr int16
1642 keycodes*: ptr int16
1643 types*: ptr int16
1644 compat*: ptr int16
1645 symbols*: ptr int16
1646 geometry*: ptr int16
1647
1648
1649
1650 type
1651 PXkbComponentNamePtr* = ptr XkbComponentNameRec
1652 XkbComponentNameRec*{.final.} = object
1653 flags*: int16
1654 name*: cstring
1655
1656
1657
1658 type
1659 PXkbComponentListPtr* = ptr XkbComponentListRec
1660 XkbComponentListRec*{.final.} = object #
1661 # The following data structures describe and track changes to a
1662 # non-keyboard extension device
1663 #
1664 num_keymaps*: int16
1665 num_keycodes*: int16
1666 num_types*: int16
1667 num_compat*: int16
1668 num_symbols*: int16
1669 num_geometry*: int16
1670 keymaps*: PXkbComponentNamePtr
1671 keycodes*: PXkbComponentNamePtr
1672 types*: PXkbComponentNamePtr
1673 compat*: PXkbComponentNamePtr
1674 symbols*: PXkbComponentNamePtr
1675 geometry*: PXkbComponentNamePtr
1676
1677
1678
1679 type
1680 PXkbDeviceLedInfoPtr* = ptr XkbDeviceLedInfoRec
1681 XkbDeviceLedInfoRec*{.final.} = object
1682 led_class*: int16
1683 led_id*: int16
1684 phys_indicators*: int16
1685 maps_present*: int16
1686 names_present*: int16
1687 state*: int16
1688 names*: array[0..XkbNumIndicators - 1, Atom]
1689 maps*: array[0..XkbNumIndicators - 1, XkbIndicatorMapRec]
1690
1691
1692
1693 type
1694 PXkbDeviceInfoPtr* = ptr XkbDeviceInfoRec
1695 XkbDeviceInfoRec*{.final.} = object
1696 name*: cstring
1697 theType*: Atom
1698 device_spec*: int16
1699 has_own_state*: bool
1700 supported*: int16
1701 unsupported*: int16
1702 num_btns*: int16
1703 btn_acts*: PXkbAction
1704 sz_leds*: int16
1705 num_leds*: int16
1706 dflt_kbd_fb*: int16
1707 dflt_led_fb*: int16
1708 leds*: PXkbDeviceLedInfoPtr
1709
1710
1711
1712 proc XkbXI_DevHasBtnActs*(d: PXkbDeviceInfoPtr): bool
1713 proc XkbXI_LegalDevBtn*(d: PXkbDeviceInfoPtr, b: int16): bool
1714 proc XkbXI_DevHasLeds*(d: PXkbDeviceInfoPtr): bool
1715 type
1716 PXkbDeviceLedChangesPtr* = ptr XkbDeviceLedChangesRec
1717 XkbDeviceLedChangesRec*{.final.} = object
1718 led_class*: int16
1719 led_id*: int16
1720 defined*: int16 #names or maps changed
1721 next*: PXkbDeviceLedChangesPtr
1722
1723
1724 type
1725 PXkbDeviceChangesPtr* = ptr XkbDeviceChangesRec
1726 XkbDeviceChangesRec*{.final.} = object
1727 changed*: int16
1728 first_btn*: int16
1729 num_btns*: int16
1730 leds*: XkbDeviceLedChangesRec
1731
1732
1733
1734 proc XkbShapeDoodadColor*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbColorPtr
1735 proc XkbShapeDoodadShape*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbShapePtr
1736 proc XkbSetShapeDoodadColor*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr,
1737 c: PXkbColorPtr)
1738 proc XkbSetShapeDoodadShape*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr,
1739 s: PXkbShapePtr)
1740 proc XkbTextDoodadColor*(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr): PXkbColorPtr
1741 proc XkbSetTextDoodadColor*(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr,
1742 c: PXkbColorPtr)
1743 proc XkbIndicatorDoodadShape*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbShapeDoodadPtr
1744 proc XkbIndicatorDoodadOnColor*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr
1745 proc XkbIndicatorDoodadOffColor*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr
1746 proc XkbSetIndicatorDoodadOnColor*(g: PXkbGeometryPtr,
1747 d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr)
1748 proc XkbSetIndicatorDoodadOffColor*(g: PXkbGeometryPtr,
1749 d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr)
1750 proc XkbSetIndicatorDoodadShape*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr,
1751 s: PXkbShapeDoodadPtr)
1752 proc XkbLogoDoodadColor*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbColorPtr
1753 proc XkbLogoDoodadShape*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbShapeDoodadPtr
1754 proc XkbSetLogoDoodadColor*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr,
1755 c: PXkbColorPtr)
1756 proc XkbSetLogoDoodadShape*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr,
1757 s: PXkbShapeDoodadPtr)
1758 proc XkbKeyShape*(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbShapeDoodadPtr
1759 proc XkbKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbColorPtr
1760 proc XkbSetKeyShape*(g: PXkbGeometryPtr, k: PXkbKeyPtr, s: PXkbShapeDoodadPtr)
1761 proc XkbSetKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr)
1762 proc XkbGeomColorIndex*(g: PXkbGeometryPtr, c: PXkbColorPtr): int32
1763 proc XkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring, value: cstring): PXkbPropertyPtr{.
1764 libx11c, importc: "XkbAddGeomProperty".}
1765 proc XkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
1766 libx11c, importc: "XkbAddGeomKeyAlias".}
1767 proc XkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
1768 libx11c, importc: "XkbAddGeomColor".}
1769 proc XkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
1770 libx11c, importc: "XkbAddGeomOutline".}
1771 proc XkbAddGeomShape*(geom: PXkbGeometryPtr, name: Atom, sz_outlines: int16): PXkbShapePtr{.
1772 libx11c, importc: "XkbAddGeomShape".}
1773 proc XkbAddGeomKey*(row: PXkbRowPtr): PXkbKeyPtr{.libx11c,
1774 importc: "XkbAddGeomKey".}
1775 proc XkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.libx11c, importc: "XkbAddGeomRow".}
1776 proc XkbAddGeomSection*(geom: PXkbGeometryPtr, name: Atom, sz_rows: int16,
1777 sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
1778 libx11c, importc: "XkbAddGeomSection".}
1779 proc XkbAddGeomOverlay*(section: PXkbSectionPtr, name: Atom, sz_rows: int16): PXkbOverlayPtr{.
1780 libx11c, importc: "XkbAddGeomOverlay".}
1781 proc XkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
1782 sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".}
1783 proc XkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
1784 over: cstring, under: cstring): PXkbOverlayKeyPtr{.
1785 libx11c, importc: "XkbAddGeomOverlayKey".}
1786 proc XkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
1787 name: Atom): PXkbDoodadPtr{.libx11c,
1788 importc: "XkbAddGeomDoodad".}
1789 proc XkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16, count: int16,
1790 freeAll: bool){.libx11c,
1791 importc: "XkbFreeGeomKeyAliases".}
1792 proc XkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
1793 freeAll: bool){.libx11c,
1794 importc: "XkbFreeGeomColors".}
1795 proc XkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16, freeAll: bool){.
1796 libx11c, importc: "XkbFreeGeomDoodads".}
1797 proc XkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16, count: int16,
1798 freeAll: bool){.libx11c,
1799 importc: "XkbFreeGeomProperties".}
1800 proc XkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16, count: int16,
1801 freeAll: bool){.libx11c,
1802 importc: "XkbFreeGeomOverlayKeys".}
1803 proc XkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
1804 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".}
1805 proc XkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16, count: int16,
1806 freeAll: bool){.libx11c,
1807 importc: "XkbFreeGeomOverlays".}
1808 proc XkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16, freeAll: bool){.
1809 libx11c, importc: "XkbFreeGeomKeys".}
1810 proc XkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
1811 freeAll: bool){.libx11c,
1812 importc: "XkbFreeGeomRows".}
1813 proc XkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16, count: int16,
1814 freeAll: bool){.libx11c,
1815 importc: "XkbFreeGeomSections".}
1816 proc XkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16, count: int16,
1817 freeAll: bool){.libx11c,
1818 importc: "XkbFreeGeomPoints".}
1819 proc XkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
1820 freeAll: bool){.libx11c,
1821 importc: "XkbFreeGeomOutlines".}
1822 proc XkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
1823 freeAll: bool){.libx11c,
1824 importc: "XkbFreeGeomShapes".}
1825 proc XkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
1826 libx11c, importc: "XkbFreeGeometry".}
1827 proc XkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): Status{.libx11c, importc: "XkbAllocGeomProps".}
1828 proc XkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): Status{.
1829 libx11c, importc: "XkbAllocGeomKeyAliases".}
1830 proc XkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): Status{.libx11c, importc: "XkbAllocGeomColors".}
1831 proc XkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): Status{.libx11c, importc: "XkbAllocGeomShapes".}
1832 proc XkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): Status{.
1833 libx11c, importc: "XkbAllocGeomSections".}
1834 proc XkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): Status{.
1835 libx11c, importc: "XkbAllocGeomOverlays".}
1836 proc XkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): Status{.
1837 libx11c, importc: "XkbAllocGeomOverlayRows".}
1838 proc XkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): Status{.
1839 libx11c, importc: "XkbAllocGeomOverlayKeys".}
1840 proc XkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): Status{.
1841 libx11c, importc: "XkbAllocGeomDoodads".}
1842 proc XkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): Status{.
1843 libx11c, importc: "XkbAllocGeomSectionDoodads".}
1844 proc XkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): Status{.libx11c, importc: "XkbAllocGeomOutlines".}
1845 proc XkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): Status{.libx11c, importc: "XkbAllocGeomRows".}
1846 proc XkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): Status{.libx11c, importc: "XkbAllocGeomPoints".}
1847 proc XkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): Status{.libx11c, importc: "XkbAllocGeomKeys".}
1848 proc XkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): Status{.
1849 libx11c, importc: "XkbAllocGeometry".}
1850 proc XkbSetGeometryProc*(dpy: PDisplay, deviceSpec: int16, geom: PXkbGeometryPtr): Status{.
1851 libx11c, importc: "XkbSetGeometry".}
1852 proc XkbComputeShapeTop*(shape: PXkbShapePtr, bounds: PXkbBoundsPtr): bool{.
1853 libx11c, importc: "XkbComputeShapeTop".}
1854 proc XkbComputeShapeBounds*(shape: PXkbShapePtr): bool{.libx11c,
1855 importc: "XkbComputeShapeBounds".}
1856 proc XkbComputeRowBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
1857 row: PXkbRowPtr): bool{.libx11c,
1858 importc: "XkbComputeRowBounds".}
1859 proc XkbComputeSectionBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr): bool{.
1860 libx11c, importc: "XkbComputeSectionBounds".}
1861 proc XkbFindOverlayForKey*(geom: PXkbGeometryPtr, wanted: PXkbSectionPtr,
1862 under: cstring): cstring{.libx11c,
1863 importc: "XkbFindOverlayForKey".}
1864 proc XkbGetGeometryProc*(dpy: PDisplay, xkb: PXkbDescPtr): Status{.libx11c, importc: "XkbGetGeometry".}
1865 proc XkbGetNamedGeometry*(dpy: PDisplay, xkb: PXkbDescPtr, name: Atom): Status{.
1866 libx11c, importc: "XkbGetNamedGeometry".}
1867 when defined(XKB_IN_SERVER):
1868 proc SrvXkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring,
1869 float: cstring): PXkbKeyAliasPtr{.libx11c, importc: "XkbAddGeomKeyAlias".}
1870 proc SrvXkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
1871 libx11c, importc: "XkbAddGeomColor".}
1872 proc SrvXkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
1873 name: Atom): PXkbDoodadPtr{.libx11c,
1874 importc: "XkbAddGeomDoodad".}
1875 proc SrvXkbAddGeomKey*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
1876 libx11c, importc: "XkbAddGeomKeyAlias".}
1877 proc SrvXkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
1878 libx11c, importc: "XkbAddGeomOutline".}
1879 proc SrvXkbAddGeomOverlay*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
1880 over: cstring, under: cstring): PXkbOverlayKeyPtr{.
1881 libx11c, importc: "XkbAddGeomOverlayKey".}
1882 proc SrvXkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
1883 sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".}
1884 proc SrvXkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
1885 over: cstring, under: cstring): PXkbOverlayKeyPtr{.
1886 libx11c, importc: "XkbAddGeomOverlayKey".}
1887 proc SrvXkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring,
1888 value: cstring): PXkbPropertyPtr{.libx11c, importc: "XkbAddGeomProperty".}
1889 proc SrvXkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.
1890 libx11c, importc: "XkbAddGeomRow".}
1891 proc SrvXkbAddGeomSection*(geom: PXkbGeometryPtr, name: Atom, sz_rows: int16,
1892 sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
1893 libx11c, importc: "XkbAddGeomSection".}
1894 proc SrvXkbAddGeomShape*(geom: PXkbGeometryPtr, name: Atom,
1895 sz_outlines: int16): PXkbShapePtr{.libx11c, importc: "XkbAddGeomShape".}
1896 proc SrvXkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): Status{.
1897 libx11c, importc: "XkbAllocGeomKeyAliases".}
1898 proc SrvXkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): Status{.
1899 libx11c, importc: "XkbAllocGeomColors".}
1900 proc SrvXkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): Status{.
1901 libx11c, importc: "XkbAllocGeomDoodads".}
1902 proc SrvXkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): Status{.libx11c, importc: "XkbAllocGeomKeys".}
1903 proc SrvXkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): Status{.
1904 libx11c, importc: "XkbAllocGeomOutlines".}
1905 proc SrvXkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): Status{.libx11c, importc: "XkbAllocGeomPoints".}
1906 proc SrvXkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): Status{.
1907 libx11c, importc: "XkbAllocGeomProps".}
1908 proc SrvXkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): Status{.
1909 libx11c, importc: "XkbAllocGeomRows".}
1910 proc SrvXkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): Status{.
1911 libx11c, importc: "XkbAllocGeomSectionDoodads".}
1912 proc SrvXkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): Status{.
1913 libx11c, importc: "XkbAllocGeomSections".}
1914 proc SrvXkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): Status{.
1915 libx11c, importc: "XkbAllocGeomOverlays".}
1916 proc SrvXkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): Status{.
1917 libx11c, importc: "XkbAllocGeomOverlayRows".}
1918 proc SrvXkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): Status{.
1919 libx11c, importc: "XkbAllocGeomOverlayKeys".}
1920 proc SrvXkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): Status{.
1921 libx11c, importc: "XkbAllocGeomShapes".}
1922 proc SrvXkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): Status{.
1923 libx11c, importc: "XkbAllocGeometry".}
1924 proc SrvXkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16,
1925 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomKeyAliases".}
1926 proc SrvXkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
1927 freeAll: bool){.libx11c,
1928 importc: "XkbFreeGeomColors".}
1929 proc SrvXkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16,
1930 freeAll: bool){.libx11c,
1931 importc: "XkbFreeGeomDoodads".}
1932 proc SrvXkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16,
1933 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomProperties".}
1934 proc SrvXkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16,
1935 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayKeys".}
1936 proc SrvXkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
1937 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".}
1938 proc SrvXkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16,
1939 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlays".}
1940 proc SrvXkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16,
1941 freeAll: bool){.libx11c,
1942 importc: "XkbFreeGeomKeys".}
1943 proc SrvXkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
1944 freeAll: bool){.libx11c,
1945 importc: "XkbFreeGeomRows".}
1946 proc SrvXkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16,
1947 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomSections".}
1948 proc SrvXkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16,
1949 count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomPoints".}
1950 proc SrvXkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
1951 freeAll: bool){.libx11c,
1952 importc: "XkbFreeGeomOutlines".}
1953 proc SrvXkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
1954 freeAll: bool){.libx11c,
1955 importc: "XkbFreeGeomShapes".}
1956 proc SrvXkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
1957 libx11c, importc: "XkbFreeGeometry".}
1958 # implementation
1959
1960 import #************************************ xkb ************************************
1961 xi
1962
1963 proc XkbLegalXILedClass(c: int): bool =
1964 ##define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||((c)==LedFeedbackClass)||
1965 # ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses))
1966 result = (c == KbdFeedbackClass) or (c == LedFeedbackClass) or
1967 (c == XkbDfltXIClass) or (c == XkbAllXIClasses)
1968
1969 proc XkbLegalXIBellClass(c: int): bool =
1970 ##define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||((c)==BellFeedbackClass)||
1971 # ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses))
1972 result = (c == KbdFeedbackClass) or (c == BellFeedbackClass) or
1973 (c == XkbDfltXIClass) or (c == XkbAllXIClasses)
1974
1975 proc XkbExplicitXIDevice(c: int): bool =
1976 ##define XkbExplicitXIDevice(c) (((c)&(~0xff))==0)
1977 result = (c and (not 0x000000FF)) == 0
1978
1979 proc XkbExplicitXIClass(c: int): bool =
1980 ##define XkbExplicitXIClass(c) (((c)&(~0xff))==0)
1981 result = (c and (not 0x000000FF)) == 0
1982
1983 proc XkbExplicitXIId(c: int): bool =
1984 ##define XkbExplicitXIId(c) (((c)&(~0xff))==0)
1985 result = (c and (not 0x000000FF)) == 0
1986
1987 proc XkbSingleXIClass(c: int): bool =
1988 ##define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
1989 result = ((c and (not 0x000000FF)) == 0) or (c == XkbDfltXIClass)
1990
1991 proc XkbSingleXIId(c: int): bool =
1992 ##define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
1993 result = ((c and (not 0x000000FF)) == 0) or (c == XkbDfltXIId)
1994
1995 proc XkbBuildCoreState(m, g: int): int =
1996 ##define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff))
1997 result = ((g and 0x00000003) shl 13) or (m and 0x000000FF)
1998
1999 proc XkbGroupForCoreState(s: int): int =
2000 ##define XkbGroupForCoreState(s) (((s)>>13)&0x3)
2001 result = (s shr 13) and 0x00000003
2002
2003 proc XkbIsLegalGroup(g: int): bool =
2004 ##define XkbIsLegalGroup(g) (((g)>=0)&&((g)<XkbNumKbdGroups))
2005 result = (g >= 0) and (g < XkbNumKbdGroups)
2006
2007 proc XkbSA_ValOp(a: int): int =
2008 ##define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask)
2009 result = a and XkbSA_ValOpMask
2010
2011 proc XkbSA_ValScale(a: int): int =
2012 ##define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask)
2013 result = a and XkbSA_ValScaleMask
2014
2015 proc XkbIsModAction(a: PXkbAnyAction): bool =
2016 ##define XkbIsModAction(a) (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
2017 result = (a.theType) >= XkbSA_SetMods and (a.theType) <= XkbSA_LockMods
2018
2019 proc XkbIsGroupAction(a: PXkbAnyAction): bool =
2020 ##define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
2021 result = (a.theType >= XkbSA_SetGroup) or (a.theType <= XkbSA_LockGroup)
2022
2023 proc XkbIsPtrAction(a: PXkbAnyAction): bool =
2024 ##define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
2025 result = (a.theType >= XkbSA_MovePtr) and
2026 (a.theType <= XkbSA_SetPtrDflt)
2027
2028 proc XkbIsLegalKeycode(k: int): bool =
2029 ##define XkbIsLegalKeycode(k) (((k)>=XkbMinLegalKeyCode)&&((k)<=XkbMaxLegalKeyCode))
2030 result = (k >= XkbMinLegalKeyCode) and (k <= XkbMaxLegalKeyCode)
2031
2032 proc XkbShiftLevel(n: int8): int8 =
2033 ##define XkbShiftLevel(n) ((n)-1)
2034 result = n - 1'i8
2035
2036 proc XkbShiftLevelMask(n: int8): int8 =
2037 ##define XkbShiftLevelMask(n) (1<<((n)-1))
2038 result = 1'i8 shl (n - 1'i8)
2039
2040 proc XkbcharToInt(v: int8): int16 =
2041 ##define XkbcharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
2042 if ((v and 0x80'i8) != 0'i8): result = v or (not 0xFF'i16)
2043 else: result = int16(v and 0x7F'i8)
2044
2045 proc XkbIntTo2chars(i: int16, h, L: var int8) =
2046 ##define XkbIntTo2chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
2047 h = int8((i shr 8'i16) and 0x00FF'i16)
2048 L = int8(i and 0xFF'i16)
2049
2050 proc Xkb2charsToInt(h, L: int8): int16 =
2051 when defined(cpu64):
2052 ##define Xkb2charsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)): (int)(((h)<<8)|(l)&0x7fff))
2053 if (h and 0x80'i8) != 0'i8:
2054 result = int16((h shl 8) or L or not 0x0000FFFF)
2055 else:
2056 result = int16((h shl 8) or L and 0x00007FFF)
2057 else:
2058 ##define Xkb2charsToInt(h,l) ((short)(((h)<<8)|(l)))
2059 result = int16(h shl 8 or L)
2060
2061 proc XkbModLocks(s: PXkbStatePtr): int8 =
2062 ##define XkbModLocks(s) ((s)->locked_mods)
2063 result = s.locked_mods
2064
2065 proc XkbStateMods(s: PXkbStatePtr): int16 =
2066 ##define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
2067 result = s.base_mods or s.latched_mods or XkbModLocks(s)
2068
2069 proc XkbGroupLock(s: PXkbStatePtr): int8 =
2070 ##define XkbGroupLock(s) ((s)->locked_group)
2071 result = s.locked_group
2072
2073 proc XkbStateGroup(s: PXkbStatePtr): int16 =
2074 ##define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
2075 result = s.base_group + (s.latched_group) + XkbGroupLock(s)
2076
2077 proc XkbStateFieldFromRec(s: PXkbStatePtr): int =
2078 ##define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
2079 result = XkbBuildCoreState(s.lookup_mods, s.group)
2080
2081 proc XkbGrabStateFromRec(s: PXkbStatePtr): int =
2082 ##define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)
2083 result = XkbBuildCoreState(s.grab_mods, s.group)
2084
2085 proc XkbNumGroups(g: int16): int16 =
2086 ##define XkbNumGroups(g) ((g)&0x0f)
2087 result = g and 0x0000000F'i16
2088
2089 proc XkbOutOfRangeGroupInfo(g: int16): int16 =
2090 ##define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)
2091 result = g and 0x000000F0'i16
2092
2093 proc XkbOutOfRangeGroupAction(g: int16): int16 =
2094 ##define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
2095 result = g and 0x000000C0'i16
2096
2097 proc XkbOutOfRangeGroupNumber(g: int16): int16 =
2098 ##define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
2099 result = (g and 0x00000030'i16) shr 4'i16
2100
2101 proc XkbSetGroupInfo(g, w, n: int16): int16 =
2102 ##define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
2103 result = (w and 0x000000C0'i16) or
2104 ((n and 3'i16) shl 4'i16) or (g and 0x0000000F'i16)
2105
2106 proc XkbSetNumGroups(g, n: int16): int16 =
2107 ##define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))
2108 result = (g and 0x000000F0'i16) or (n and 0x0000000F'i16)
2109
2110 proc XkbModActionVMods(a: PXkbModAction): int16 =
2111 ##define XkbModActionVMods(a) ((short)(((a)->vmods1<<8)|((a)->vmods2)))
2112 result = int16((a.vmods1 shl 8) or a.vmods2)
2113
2114 proc XkbSetModActionVMods(a: PXkbModAction, v: int8) =
2115 ##define XkbSetModActionVMods(a,v) (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
2116 a.vmods1 = int8((v shr 8) and 0x000000FF)
2117 a.vmods2 = int8(v and 0x000000FF)
2118
2119 proc XkbSAGroup(a: PXkbGroupAction): int8 =
2120 ##define XkbSAGroup(a) (XkbcharToInt((a)->group_XXX))
2121 result = int8(XkbcharToInt(a.group_XXX))
2122
2123 proc XkbSASetGroupProc(a: PXkbGroupAction, g: int8) =
2124 ##define XkbSASetGroup(a,g) ((a)->group_XXX=(g))
2125 a.group_XXX = g
2126
2127 proc XkbPtrActionX(a: PXkbPtrAction): int16 =
2128 ##define XkbPtrActionX(a) (Xkb2charsToInt((a)->high_XXX,(a)->low_XXX))
2129 result = int16(Xkb2charsToInt(a.high_XXX, a.low_XXX))
2130
2131 proc XkbPtrActionY(a: PXkbPtrAction): int16 =
2132 ##define XkbPtrActionY(a) (Xkb2charsToInt((a)->high_YYY,(a)->low_YYY))
2133 result = int16(Xkb2charsToInt(a.high_YYY, a.low_YYY))
2134
2135 proc XkbSetPtrActionX(a: PXkbPtrAction, x: int8) =
2136 ##define XkbSetPtrActionX(a,x) (XkbIntTo2chars(x,(a)->high_XXX,(a)->low_XXX))
2137 XkbIntTo2chars(x, a.high_XXX, a.low_XXX)
2138
2139 proc XkbSetPtrActionY(a: PXkbPtrAction, y: int8) =
2140 ##define XkbSetPtrActionY(a,y) (XkbIntTo2chars(y,(a)->high_YYY,(a)->low_YYY))
2141 XkbIntTo2chars(y, a.high_YYY, a.low_YYY)
2142
2143 proc XkbSAPtrDfltValue(a: PXkbPtrDfltAction): int8 =
2144 ##define XkbSAPtrDfltValue(a) (XkbcharToInt((a)->valueXXX))
2145 result = int8(XkbcharToInt(a.valueXXX))
2146
2147 proc XkbSASetPtrDfltValue(a: PXkbPtrDfltAction, c: pointer) =
2148 ##define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff))
2149 a.valueXXX = int8(cast[int](c))
2150
2151 proc XkbSAScreen(a: PXkbSwitchScreenAction): int8 =
2152 ##define XkbSAScreen(a) (XkbcharToInt((a)->screenXXX))
2153 result = int8(XkbcharToInt(a.screenXXX))
2154
2155 proc XkbSASetScreen(a: PXkbSwitchScreenAction, s: pointer) =
2156 ##define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff))
2157 a.screenXXX = int8(cast[int](s))
2158
2159 proc XkbActionSetCtrls(a: PXkbCtrlsAction, c: int8) =
2160 ##define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),((a)->ctrls2=(((c)>>16)&0xff)),
2161 # ((a)->ctrls1=(((c)>>8)&0xff)),((a)->ctrls0=((c)&0xff)))
2162 a.ctrls3 = int8((c shr 24) and 0x000000FF)
2163 a.ctrls2 = int8((c shr 16) and 0x000000FF)
2164 a.ctrls1 = int8((c shr 8) and 0x000000FF)
2165 a.ctrls0 = int8(c and 0x000000FF)
2166
2167 proc XkbActionCtrls(a: PXkbCtrlsAction): int16 =
2168 ##define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|(((unsigned int)(a)->ctrls2)<<16)|
2169 # (((unsigned int)(a)->ctrls1)<<8)|((unsigned int)((a)->ctrls0)))
2170 result = int16((a.ctrls3 shl 24) or (a.ctrls2 shl 16) or
2171 (a.ctrls1 shl 8) or a.ctrls0)
2172
2173 proc XkbSARedirectVMods(a: PXkbRedirectKeyAction): int16 =
2174 ##define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|((unsigned int)(a)->vmods0))
2175 result = int16((a.vmods1 shl 8) or a.vmods0)
2176
2177 proc XkbSARedirectSetVMods(a: PXkbRedirectKeyAction, m: int8) =
2178 ##define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff)))
2179 a.vmods_mask1 = int8((m shr 8) and 0x000000FF)
2180 a.vmods_mask0 = int8(m or 0x000000FF)
2181
2182 proc XkbSARedirectVModsMask(a: PXkbRedirectKeyAction): int16 =
2183 ##define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|
2184 # ((unsigned int)(a)->vmods_mask0))
2185 result = int16((a.vmods_mask1 shl 8) or a.vmods_mask0)
2186
2187 proc XkbSARedirectSetVModsMask(a: PXkbRedirectKeyAction, m: int8) =
2188 ##define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff)))
2189 a.vmods_mask1 = int8(m shr 8 and 0x000000FF)
2190 a.vmods_mask0 = int8(m and 0x000000FF)
2191
2192 proc XkbAX_AnyFeedback(c: PXkbControlsPtr): int16 =
2193 ##define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
2194 result = int16(c.enabled_ctrls and XkbAccessXFeedbackMask)
2195
2196 proc XkbAX_NeedOption(c: PXkbControlsPtr, w: int16): int16 =
2197 ##define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))
2198 result = int16(c.ax_options and w)
2199
2200 proc XkbAX_NeedFeedback(c: PXkbControlsPtr, w: int16): bool =
2201 ##define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
2202 result = (XkbAX_AnyFeedback(c) > 0'i16) and (XkbAX_NeedOption(c, w) > 0'i16)
2203
2204 proc XkbSMKeyActionsPtr(m: PXkbServerMapPtr, k: int16): PXkbAction =
2205 ##define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
2206 result = addr(m.acts[m.key_acts[k]])
2207
2208 proc XkbCMKeyGroupInfo(m: PXkbClientMapPtr, k: int16): int8 =
2209 ##define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info)
2210 result = m.key_sym_map[k].group_info
2211
2212 proc XkbCMKeyNumGroups(m: PXkbClientMapPtr, k: int16): int8 =
2213 ##define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info))
2214 result = int8(XkbNumGroups(m.key_sym_map[k].group_info))
2215
2216 proc XkbCMKeyGroupWidth(m: PXkbClientMapPtr, k: int16, g: int8): int8 =
2217 ##define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
2218 result = XkbCMKeyType(m, k, g).num_levels
2219
2220 proc XkbCMKeyGroupsWidth(m: PXkbClientMapPtr, k: int16): int8 =
2221 ##define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
2222 result = m.key_sym_map[k].width
2223
2224 proc XkbCMKeyTypeIndex(m: PXkbClientMapPtr, k: int16, g: int8): int8 =
2225 ##define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
2226 result = m.key_sym_map[k].kt_index[g and 0x00000003]
2227
2228 proc XkbCMKeyType(m: PXkbClientMapPtr, k: int16, g: int8): PXkbKeyTypePtr =
2229 ##define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
2230 result = addr(m.types[XkbCMKeyTypeIndex(m, k, g)])
2231
2232 proc XkbCMKeyNumSyms(m: PXkbClientMapPtr, k: int16): int16 =
2233 ##define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
2234 result = int16(XkbCMKeyGroupsWidth(m, k) or XkbCMKeyNumGroups(m, k))
2235
2236 proc XkbCMKeySymsOffset(m: PXkbClientMapPtr, k: int16): int8 =
2237 ##define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)
2238 result = m.key_sym_map[k].offset
2239
2240 proc XkbCMKeySymsPtr*(m: PXkbClientMapPtr, k: int16): PKeySym =
2241 ##define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)])
2242 result = addr(m.syms[XkbCMKeySymsOffset(m, k)])
2243
2244 proc XkbIM_IsAuto(i: PXkbIndicatorMapPtr): bool =
2245 ##define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&(((i)->which_groups&&(i)->groups)||
2246 # ((i)->which_mods&&(i)->mods.mask)|| ((i)->ctrls)))
2247 result = ((i.flags and XkbIM_NoAutomatic) == 0) and
2248 (((i.which_groups > 0'i8) and (i.groups > 0'i8)) or
2249 ((i.which_mods > 0'i8) and (i.mods.mask > 0'i8)) or (i.ctrls > 0'i8))
2250
2251 proc XkbIM_InUse(i: PXkbIndicatorMapPtr): bool =
2252 ##define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||((i)->which_mods)||((i)->ctrls))
2253 result = (i.flags > 0'i8) or (i.which_groups > 0'i8) or (i.which_mods > 0'i8) or
2254 (i.ctrls > 0'i8)
2255
2256 proc XkbKeyKeyTypeIndex(d: PXkbDescPtr, k: int16, g: int8): int8 =
2257 ##define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g))
2258 result = XkbCMKeyTypeIndex(d.map, k, g)
2259
2260 proc XkbKeyKeyType(d: PXkbDescPtr, k: int16, g: int8): PXkbKeyTypePtr =
2261 ##define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g))
2262 result = XkbCMKeyType(d.map, k, g)
2263
2264 proc XkbKeyGroupWidth(d: PXkbDescPtr, k: int16, g: int8): int8 =
2265 ##define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g))
2266 result = XkbCMKeyGroupWidth(d.map, k, g)
2267
2268 proc XkbKeyGroupsWidth(d: PXkbDescPtr, k: int16): int8 =
2269 ##define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k))
2270 result = XkbCMKeyGroupsWidth(d.map, k)
2271
2272 proc XkbKeyGroupInfo(d: PXkbDescPtr, k: int16): int8 =
2273 ##define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k)))
2274 result = XkbCMKeyGroupInfo(d.map, k)
2275
2276 proc XkbKeyNumGroups(d: PXkbDescPtr, k: int16): int8 =
2277 ##define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k)))
2278 result = XkbCMKeyNumGroups(d.map, k)
2279
2280 proc XkbKeyNumSyms(d: PXkbDescPtr, k: int16): int16 =
2281 ##define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k)))
2282 result = XkbCMKeyNumSyms(d.map, k)
2283
2284 proc XkbKeySymsPtr*(d: PXkbDescPtr, k: int16): PKeySym =
2285 ##define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k)))
2286 result = XkbCMKeySymsPtr(d.map, k)
2287
2288 proc XkbKeySym(d: PXkbDescPtr, k: int16, n: int16): KeySym =
2289 ##define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n])
2290 result = cast[ptr array[0..0xffff, KeySym]](XkbKeySymsPtr(d, k))[n] # XXX: this seems strange!
2291
2292 proc XkbKeySymEntry(d: PXkbDescPtr, k: int16, sl: int16, g: int8): KeySym =
2293 ##define XkbKeySymEntry(d,k,sl,g) (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
2294 result = XkbKeySym(d, k, int16(XkbKeyGroupsWidth(d, k) * g + sl))
2295
2296 proc XkbKeyAction(d: PXkbDescPtr, k: int16, n: int16): PXkbAction =
2297 ##define XkbKeyAction(d,k,n) (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
2298 #if (XkbKeyHasActions(d, k)):
2299 # result = XkbKeyActionsPtr(d, k)[n] #Buggy !!!
2300 assert(false)
2301 result = nil
2302
2303 proc XkbKeyActionEntry(d: PXkbDescPtr, k: int16, sl: int16, g: int8): int8 =
2304 ##define XkbKeyActionEntry(d,k,sl,g) (XkbKeyHasActions(d,k) ?
2305 # XkbKeyAction(d, k, ((XkbKeyGroupsWidth(d, k) * (g))+(sl))):NULL)
2306 if XkbKeyHasActions(d, k):
2307 result = XkbKeyGroupsWidth(d, k) *% g +% int8(sl)
2308 else:
2309 result = 0'i8
2310
2311 proc XkbKeyHasActions(d: PXkbDescPtr, k: int16): bool =
2312 ##define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0)
2313 result = d.server.key_acts[k] != 0'i16
2314
2315 proc XkbKeyNumActions(d: PXkbDescPtr, k: int16): int16 =
2316 ##define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
2317 if (XkbKeyHasActions(d, k)): result = XkbKeyNumSyms(d, k)
2318 else: result = 1'i16
2319
2320 proc XkbKeyActionsPtr(d: PXkbDescPtr, k: int16): PXkbAction =
2321 ##define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k))
2322 result = XkbSMKeyActionsPtr(d.server, k)
2323
2324 proc XkbKeycodeInRange(d: PXkbDescPtr, k: int16): bool =
2325 ##define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&& ((k)<=(d)->max_key_code))
2326 result = (char(int8(k)) >= d.min_key_code) and (char(int8(k)) <= d.max_key_code)
2327
2328 proc XkbNumKeys(d: PXkbDescPtr): int8 =
2329 ##define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)
2330 result = int8(ord(d.max_key_code) - ord(d.min_key_code) + 1)
2331
2332 proc XkbXI_DevHasBtnActs(d: PXkbDeviceInfoPtr): bool =
2333 ##define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL))
2334 result = (d.num_btns > 0'i16) and (not (d.btn_acts == nil))
2335
2336 proc XkbXI_LegalDevBtn(d: PXkbDeviceInfoPtr, b: int16): bool =
2337 ##define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
2338 result = XkbXI_DevHasBtnActs(d) and (b <% d.num_btns)
2339
2340 proc XkbXI_DevHasLeds(d: PXkbDeviceInfoPtr): bool =
2341 ##define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL))
2342 result = (d.num_leds > 0'i16) and (not (d.leds == nil))
2343
2344 proc XkbBoundsWidth(b: PXkbBoundsPtr): int16 =
2345 ##define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
2346 result = (b.x2) - b.x1
2347
2348 proc XkbBoundsHeight(b: PXkbBoundsPtr): int16 =
2349 ##define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
2350 result = (b.y2) - b.y1
2351
2352 proc XkbOutlineIndex(s: PXkbShapePtr, o: PXkbOutlinePtr): int32 =
2353 ##define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
2354 result = int32((cast[int](o) - cast[int](addr(s.outlines[0]))) div sizeof(PXkbOutlinePtr))
2355
2356 proc XkbShapeDoodadColor(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbColorPtr =
2357 ##define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
2358 result = addr((g.colors[d.color_ndx]))
2359
2360 proc XkbShapeDoodadShape(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbShapePtr =
2361 ##define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
2362 result = addr(g.shapes[d.shape_ndx])
2363
2364 proc XkbSetShapeDoodadColor(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr,
2365 c: PXkbColorPtr) =
2366 ##define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
2367 d.color_ndx = int16((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2368
2369 proc XkbSetShapeDoodadShape(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr,
2370 s: PXkbShapePtr) =
2371 ##define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
2372 d.shape_ndx = int16((cast[int](s) - cast[int](addr(g.shapes[0]))) div sizeof(XkbShapeRec))
2373
2374 proc XkbTextDoodadColor(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr): PXkbColorPtr =
2375 ##define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
2376 result = addr(g.colors[d.color_ndx])
2377
2378 proc XkbSetTextDoodadColor(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr,
2379 c: PXkbColorPtr) =
2380 ##define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
2381 d.color_ndx = int16((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2382
2383 proc XkbIndicatorDoodadShape(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbShapeDoodadPtr =
2384 ##define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
2385 result = cast[PXkbShapeDoodadPtr](addr(g.shapes[d.shape_ndx]))
2386
2387 proc XkbIndicatorDoodadOnColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr =
2388 ##define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
2389 result = addr(g.colors[d.on_color_ndx])
2390
2391 proc XkbIndicatorDoodadOffColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr =
2392 ##define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
2393 result = addr(g.colors[d.off_color_ndx])
2394
2395 proc XkbSetIndicatorDoodadOnColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr,
2396 c: PXkbColorPtr) =
2397 ##define XkbSetIndicatorDoodadOnColor(g,d,c) ((d)->on_color_ndx= (c)-&(g)->colors[0])
2398 d.on_color_ndx = int16((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2399
2400 proc XkbSetIndicatorDoodadOffColor(g: PXkbGeometryPtr,
2401 d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr) =
2402 ##define XkbSetIndicatorDoodadOffColor(g,d,c) ((d)->off_color_ndx= (c)-&(g)->colors[0])
2403 d.off_color_ndx = int16((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2404
2405 proc XkbSetIndicatorDoodadShape(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr,
2406 s: PXkbShapeDoodadPtr) =
2407 ##define XkbSetIndicatorDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
2408 d.shape_ndx = int16((cast[int](s) - (cast[int](addr(g.shapes[0])))) div sizeof(XkbShapeRec))
2409
2410 proc XkbLogoDoodadColor(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbColorPtr =
2411 ##define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
2412 result = addr(g.colors[d.color_ndx])
2413
2414 proc XkbLogoDoodadShape(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbShapeDoodadPtr =
2415 ##define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
2416 result = cast[PXkbShapeDoodadPtr](addr(g.shapes[d.shape_ndx]))
2417
2418 proc XkbSetLogoDoodadColor(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr,
2419 c: PXkbColorPtr) =
2420 ##define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
2421 d.color_ndx = int16((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2422
2423 proc XkbSetLogoDoodadShape(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr,
2424 s: PXkbShapeDoodadPtr) =
2425 ##define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
2426 d.shape_ndx = int16((cast[int](s) - cast[int](addr(g.shapes[0]))) div sizeof(XkbShapeRec))
2427
2428 proc XkbKeyShape(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbShapeDoodadPtr =
2429 ##define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
2430 result = cast[PXkbShapeDoodadPtr](addr(g.shapes[k.shape_ndx]))
2431
2432 proc XkbKeyColor(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbColorPtr =
2433 ##define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
2434 result = addr(g.colors[k.color_ndx])
2435
2436 proc XkbSetKeyShape(g: PXkbGeometryPtr, k: PXkbKeyPtr, s: PXkbShapeDoodadPtr) =
2437 ##define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
2438 k.shape_ndx = int8((cast[int](s) - cast[int](addr(g.shapes[0]))) div sizeof(XkbShapeRec))
2439
2440 proc XkbSetKeyColor(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr) =
2441 ##define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
2442 k.color_ndx = int8((cast[int](c) - cast[int](addr(g.colors[0]))) div sizeof(XkbColorRec))
2443
2444 proc XkbGeomColorIndex(g: PXkbGeometryPtr, c: PXkbColorPtr): int32 =
2445 ##define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
2446 result = int16((cast[int](c) - (cast[int](addr(g.colors[0])))) div sizeof(XkbColorRec))