]> git.sesse.net Git - rdpsrv/blob - Xserver/include/extensions/XKBsrv.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / include / extensions / XKBsrv.h
1 /* $XConsortium: XKBsrv.h /main/25 1996/09/28 16:32:19 rws $ */
2 /************************************************************
3 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for any purpose and without
7 fee is hereby granted, provided that the above copyright
8 notice appear in all copies and that both that copyright
9 notice and this permission notice appear in supporting
10 documentation, and that the name of Silicon Graphics not be 
11 used in advertising or publicity pertaining to distribution 
12 of the software without specific prior written permission.
13 Silicon Graphics makes no representation about the suitability 
14 of this software for any purpose. It is provided "as is"
15 without any express or implied warranty.
16
17 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
18 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
19 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
20 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
21 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
22 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
23 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
24 THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
26 ********************************************************/
27
28 #ifndef _XKBSRV_H_
29 #define _XKBSRV_H_
30
31 #ifdef XKB_IN_SERVER
32 #define XkbAllocClientMap               SrvXkbAllocClientMap
33 #define XkbAllocServerMap               SrvXkbAllocServerMap
34 #define XkbChangeTypesOfKey             SrvXkbChangeTypesOfKey
35 #define XkbAddKeyType                   SrvXkbAddKeyType
36 #define XkbCopyKeyType                  SrvXkbCopyKeyType
37 #define XkbCopyKeyTypes                 SrvXkbCopyKeyTypes
38 #define XkbFreeClientMap                SrvXkbFreeClientMap
39 #define XkbFreeServerMap                SrvXkbFreeServerMap
40 #define XkbInitCanonicalKeyTypes        SrvXkbInitCanonicalKeyTypes
41 #define XkbKeyTypesForCoreSymbols       SrvXkbKeyTypesForCoreSymbols
42 #define XkbApplyCompatMapToKey          SrvXkbApplyCompatMapToKey
43 #define XkbUpdateMapFromCore            SrvXkbUpdateMapFromCore
44 #define XkbResizeKeyActions             SrvXkbResizeKeyActions
45 #define XkbResizeKeySyms                SrvXkbResizeKeySyms
46 #define XkbResizeKeyType                SrvXkbResizeKeyType
47 #define XkbAllocCompatMap               SrvXkbAllocCompatMap
48 #define XkbAllocControls                SrvXkbAllocControls
49 #define XkbAllocIndicatorMaps           SrvXkbAllocIndicatorMaps
50 #define XkbAllocKeyboard                SrvXkbAllocKeyboard
51 #define XkbAllocNames                   SrvXkbAllocNames
52 #define XkbFreeCompatMap                SrvXkbFreeCompatMap
53 #define XkbFreeControls                 SrvXkbFreeControls
54 #define XkbFreeIndicatorMaps            SrvXkbFreeIndicatorMaps
55 #define XkbFreeKeyboard                 SrvXkbFreeKeyboard
56 #define XkbFreeNames                    SrvXkbFreeNames
57 #define XkbAddDeviceLedInfo             SrvXkbAddDeviceLedInfo
58 #define XkbAllocDeviceInfo              SrvXkbAllocDeviceInfo
59 #define XkbFreeDeviceInfo               SrvXkbFreeDeviceInfo
60 #define XkbResizeDeviceButtonActions    SrvXkbResizeDeviceButtonActions
61 #define XkbLatchModifiers               SrvXkbLatchModifiers
62 #define XkbLatchGroup                   SrvXkbLatchGroup
63 #define XkbVirtualModsToReal            SrvXkbVirtualModsToReal
64 #define XkbChangeKeycodeRange           SrvXkbChangeKeycodeRange
65 #define XkbApplyVirtualModChanges       SrvXkbApplyVirtualModChanges
66 #define XkbUpdateActionVirtualMods      SrvXkbUpdateActionVirtualMods
67 #define XkbUpdateKeyTypeVirtualMods     SrvXkbUpdateKeyTypeVirtualMods
68 #endif
69
70 #include <X11/extensions/XKBstr.h>
71 #include <X11/extensions/XKBproto.h>
72
73 typedef struct _XkbInterest {
74         DeviceIntPtr            dev;
75         ClientPtr               client;
76         XID                     resource;
77         struct _XkbInterest *   next;
78         CARD16                  extDevNotifyMask;
79         CARD16                  stateNotifyMask;
80         CARD16                  namesNotifyMask;
81         CARD32                  ctrlsNotifyMask;
82         CARD8                   compatNotifyMask;
83         BOOL                    bellNotifyMask;
84         BOOL                    actionMessageMask;
85         CARD16                  accessXNotifyMask;
86         CARD32                  iStateNotifyMask;
87         CARD32                  iMapNotifyMask;
88         CARD16                  altSymsNotifyMask;
89         CARD32                  autoCtrls;
90         CARD32                  autoCtrlValues;
91 } XkbInterestRec,*XkbInterestPtr;
92
93 typedef struct _XkbRadioGroup {
94         CARD8           flags;
95         CARD8           nMembers;
96         CARD8           dfltDown;
97         CARD8           currentDown;
98         CARD8           members[XkbRGMaxMembers];
99 } XkbRadioGroupRec, *XkbRadioGroupPtr;
100
101 typedef struct  _XkbEventCause {
102         CARD8           kc;
103         CARD8           event;
104         CARD8           mjr;
105         CARD8           mnr;
106         ClientPtr       client;
107 } XkbEventCauseRec,*XkbEventCausePtr;
108 #define XkbSetCauseKey(c,k,e)   { (c)->kc= (k),(c)->event= (e),\
109                                   (c)->mjr= (c)->mnr= 0; \
110                                   (c)->client= NULL; }
111 #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\
112                                   (c)->mjr= (j),(c)->mnr= (n);\
113                                   (c)->client= (cl); }
114 #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl)
115 #define XkbSetCauseXkbReq(c,e,cl)  XkbSetCauseReq(c,XkbReqCode,e,cl)
116 #define XkbSetCauseUnknown(c)      XkbSetCauseKey(c,0,0)
117
118 #define _OFF_TIMER              0
119 #define _KRG_WARN_TIMER         1
120 #define _KRG_TIMER              2
121 #define _SK_TIMEOUT_TIMER       3
122 #define _ALL_TIMEOUT_TIMER      4
123
124 #define _BEEP_NONE              0
125 #define _BEEP_FEATURE_ON        1
126 #define _BEEP_FEATURE_OFF       2
127 #define _BEEP_FEATURE_CHANGE    3
128 #define _BEEP_SLOW_WARN         4
129 #define _BEEP_SLOW_PRESS        5
130 #define _BEEP_SLOW_ACCEPT       6
131 #define _BEEP_SLOW_REJECT       7
132 #define _BEEP_SLOW_RELEASE      8
133 #define _BEEP_STICKY_LATCH      9
134 #define _BEEP_STICKY_LOCK       10
135 #define _BEEP_STICKY_UNLOCK     11
136 #define _BEEP_LED_ON            12
137 #define _BEEP_LED_OFF           13
138 #define _BEEP_LED_CHANGE        14
139 #define _BEEP_BOUNCE_REJECT     15
140
141 typedef struct _XkbSrvInfo {
142         XkbStateRec      prev_state;
143         XkbStateRec      state;
144         XkbDescPtr       desc;
145
146         DeviceIntPtr     device;
147         KbdCtrlProcPtr   kbdProc;
148
149         XkbRadioGroupPtr radioGroups;
150         CARD8            nRadioGroups;
151         CARD8            clearMods;
152         CARD8            setMods;
153         INT16            groupChange;
154
155         CARD16           dfltPtrDelta;
156
157         double           mouseKeysCurve;
158         double           mouseKeysCurveFactor;
159         INT16            mouseKeysDX;
160         INT16            mouseKeysDY;
161         CARD8            mouseKeysFlags;
162         Bool             mouseKeysAccel;
163         CARD8            mouseKeysCounter;
164
165         CARD8            lockedPtrButtons;
166         CARD8            shiftKeyCount;
167         KeyCode          mouseKey;
168         KeyCode          inactiveKey;
169         KeyCode          slowKey;
170         KeyCode          repeatKey;
171         CARD8            krgTimerActive;
172         CARD8            beepType;
173         CARD8            beepCount;
174
175         CARD32           flags;
176         CARD32           lastPtrEventTime;
177         CARD32           lastShiftEventTime;
178         OsTimerPtr       beepTimer;
179         OsTimerPtr       mouseKeyTimer;
180         OsTimerPtr       slowKeysTimer;
181         OsTimerPtr       bounceKeysTimer;
182         OsTimerPtr       repeatKeyTimer;
183         OsTimerPtr       krgTimer;
184 } XkbSrvInfoRec, *XkbSrvInfoPtr;
185
186 #define XkbSLI_IsDefault        (1L<<0)
187 #define XkbSLI_HasOwnState      (1L<<1)
188
189 typedef struct  _XkbSrvLedInfo {
190         CARD16                  flags;
191         CARD16                  class;
192         CARD16                  id;
193         union {
194             KbdFeedbackPtr      kf;
195             LedFeedbackPtr      lf;
196         }                       fb;
197
198         CARD32                  physIndicators;
199         CARD32                  autoState;
200         CARD32                  explicitState;
201         CARD32                  effectiveState;
202
203         CARD32                  mapsPresent;
204         CARD32                  namesPresent;
205         XkbIndicatorMapPtr      maps;
206         Atom *                  names;
207
208         CARD32                  usesBase;
209         CARD32                  usesLatched;
210         CARD32                  usesLocked;
211         CARD32                  usesEffective;
212         CARD32                  usesCompat;
213         CARD32                  usesControls;
214
215         CARD32                  usedComponents;
216 } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
217
218 /*
219  * Settings for xkbClientFlags field (used by DIX)
220  * These flags _must_ not overlap with XkbPCF_*
221  */
222 #define _XkbClientInitialized           (1<<15)
223
224 #define _XkbWantsDetectableAutoRepeat(c)\
225         ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask)
226
227 /*
228  * Settings for flags field
229  */
230 #define _XkbStateNotifyInProgress       (1<<0)
231
232 /***====================================================================***/
233
234 #define XkbAX_KRGMask    (XkbSlowKeysMask|XkbBounceKeysMask)
235 #define XkbAllFilteredEventsMask \
236                         (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbAX_KRGMask)
237
238 /***====================================================================***/
239
240 extern int      XkbReqCode;
241 extern int      XkbEventBase;
242 extern int      XkbKeyboardErrorCode;
243 extern int      XkbDisableLockActions;
244 extern char *   XkbBaseDirectory;
245 extern char *   XkbInitialMap;
246 extern int      _XkbClientMajor;
247 extern int      _XkbClientMinor;
248 extern unsigned int XkbXIUnsupported;
249
250 extern char *   XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed;
251 extern Bool     noXkbExtension;
252 extern Bool     XkbWantRulesProp;
253
254 extern pointer  XkbLastRepeatEvent;
255
256 extern CARD32   xkbDebugFlags;
257 extern CARD32   xkbDebugCtrls;
258
259 #define _XkbAlloc(s)            xalloc((s))
260 #define _XkbCalloc(n,s)         Xcalloc((n)*(s))
261 #define _XkbRealloc(o,s)        Xrealloc((o),(s))
262 #define _XkbTypedAlloc(t)       ((t *)xalloc(sizeof(t)))
263 #define _XkbTypedCalloc(n,t)    ((t *)Xcalloc((n)*sizeof(t)))
264 #define _XkbTypedRealloc(o,n,t) \
265         ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
266 #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
267 #define _XkbFree(p)             Xfree(p)
268
269 #define _XkbLibError(c,l,d) \
270         { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
271 #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
272 #define _XkbErrCode3(a,b,c)     _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
273 #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
274
275 extern  int     DeviceKeyPress,DeviceKeyRelease;
276 extern  int     DeviceButtonPress,DeviceButtonRelease;
277
278 #ifdef XINPUT
279 #define _XkbIsPressEvent(t)     (((t)==KeyPress)||((t)==DeviceKeyPress))
280 #define _XkbIsReleaseEvent(t)   (((t)==KeyRelease)||((t)==DeviceKeyRelease))
281 #else
282 #define _XkbIsPressEvent(t)     ((t)==KeyPress)
283 #define _XkbIsReleaseEvent(t)   ((t)==KeyRelease)
284 #endif
285
286 #define _XkbCoreKeycodeInRange(c,k)     (((k)>=(c)->curKeySyms.minKeyCode)&&\
287                                          ((k)<=(c)->curKeySyms.maxKeyCode))
288 #define _XkbCoreNumKeys(c)      ((c)->curKeySyms.maxKeyCode-\
289                                  (c)->curKeySyms.minKeyCode+1)
290
291 #define XConvertCase(s,l,u)     XkbConvertCase(s,l,u)
292 #define IsKeypadKey(s)          XkbKSIsKeypad(s)
293
294 #define Status          int
295 #define XPointer        pointer
296 #define Display         struct _XDisplay
297
298 #ifndef True
299 #define True    1
300 #define False   0
301 #endif
302
303 #ifndef PATH_MAX
304 #ifdef MAXPATHLEN
305 #define PATH_MAX MAXPATHLEN
306 #else
307 #define PATH_MAX 1024
308 #endif
309 #endif
310
311 _XFUNCPROTOBEGIN
312
313 extern  void    XkbFreeCompatMap(
314 #if NeedFunctionPrototypes
315     XkbDescPtr                  /* xkb */,
316     unsigned int                /* which */,
317     Bool                        /* freeMap */
318 #endif
319 );
320
321 extern  void XkbFreeNames(
322 #if NeedFunctionPrototypes
323         XkbDescPtr              /* xkb */,
324         unsigned int            /* which */,
325         Bool                    /* freeMap */
326 #endif
327 );
328
329 extern DeviceIntPtr _XkbLookupAnyDevice(
330 #if NeedFunctionPrototypes
331     int                 /* id */,
332     int *               /* why_rtrn */
333 #endif
334 );
335
336 extern DeviceIntPtr _XkbLookupKeyboard(
337 #if NeedFunctionPrototypes
338     int                 /* id */,
339     int *               /* why_rtrn */
340 #endif
341 );
342
343 extern DeviceIntPtr _XkbLookupBellDevice(
344 #if NeedFunctionPrototypes
345     int                 /* id */,
346     int *               /* why_rtrn */
347 #endif
348 );
349
350 extern DeviceIntPtr _XkbLookupLedDevice(
351 #if NeedFunctionPrototypes
352     int                 /* id */,
353     int *               /* why_rtrn */
354 #endif
355 );
356
357 extern DeviceIntPtr _XkbLookupButtonDevice(
358 #if NeedFunctionPrototypes
359     int                 /* id */,
360     int *               /* why_rtrn */
361 #endif
362 );
363
364 extern  XkbDescPtr XkbAllocKeyboard(
365 #if NeedFunctionPrototypes
366         void
367 #endif
368 );
369
370 extern  Status XkbAllocClientMap(
371 #if NeedFunctionPrototypes
372         XkbDescPtr              /* xkb */,
373         unsigned int            /* which */,
374         unsigned int            /* nTypes */
375 #endif
376 );
377
378 extern  Status XkbAllocServerMap(
379 #if NeedFunctionPrototypes
380         XkbDescPtr              /* xkb */,
381         unsigned int            /* which */,
382         unsigned int            /* nNewActions */
383 #endif
384 );
385
386 extern  void    XkbFreeClientMap(
387 #if NeedFunctionPrototypes
388     XkbDescPtr                  /* xkb */,
389     unsigned int                /* what */,
390     Bool                        /* freeMap */
391 #endif
392 );
393
394 extern  void    XkbFreeServerMap(
395 #if NeedFunctionPrototypes
396     XkbDescPtr                  /* xkb */,
397     unsigned int                /* what */,
398     Bool                        /* freeMap */
399 #endif
400 );
401
402 extern  Status XkbAllocIndicatorMaps(
403 #if NeedFunctionPrototypes
404         XkbDescPtr              /* xkb */
405 #endif
406 );
407
408 extern  Status  XkbAllocCompatMap(
409 #if NeedFunctionPrototypes
410     XkbDescPtr                  /* xkb */,
411     unsigned int                /* which */,
412     unsigned int                /* nInterpret */
413 #endif
414 );
415
416 extern  Status XkbAllocNames(
417 #if NeedFunctionPrototypes
418         XkbDescPtr              /* xkb */,
419         unsigned int            /* which */,
420         int                     /* nTotalRG */,
421         int                     /* nTotalAliases */
422 #endif
423 );
424
425 extern  Status  XkbAllocControls(
426 #if NeedFunctionPrototypes
427         XkbDescPtr              /* xkb */,
428         unsigned int            /* which*/
429 #endif
430 );
431
432 extern  Status  XkbCopyKeyType(
433 #if NeedFunctionPrototypes
434     XkbKeyTypePtr               /* from */,
435     XkbKeyTypePtr               /* into */
436 #endif
437 );
438
439 extern  Status  XkbCopyKeyTypes(
440 #if NeedFunctionPrototypes
441     XkbKeyTypePtr               /* from */,
442     XkbKeyTypePtr               /* into */,
443     int                         /* num_types */
444 #endif
445 );
446
447 extern  Status  XkbResizeKeyType(
448 #if NeedFunctionPrototypes
449     XkbDescPtr          /* xkb */,
450     int                 /* type_ndx */,
451     int                 /* map_count */,
452     Bool                /* want_preserve */,
453     int                 /* new_num_lvls */
454 #endif
455 );
456
457 extern  void    XkbFreeKeyboard(
458 #if NeedFunctionPrototypes
459         XkbDescPtr              /* xkb */,
460         unsigned int            /* which */,
461         Bool                    /* freeDesc */
462 #endif
463 );
464
465 extern  void XkbSetActionKeyMods(
466 #if NeedFunctionPrototypes
467         XkbDescPtr              /* xkb */,
468         XkbAction *             /* act */,
469         unsigned int            /* mods */
470 #endif
471 );
472
473 extern Bool XkbCheckActionVMods(
474 #if NeedFunctionPrototypes
475         XkbDescPtr              /* xkb */,
476         XkbAction *             /* act */,
477         unsigned int            /* changed */
478 #endif
479 );
480
481 extern Bool XkbApplyVModChanges(
482 #if NeedFunctionPrototypes
483     XkbSrvInfoPtr       /* xkbi */,
484     unsigned int        /* changed */,
485     XkbChangesPtr       /* pChanges */,
486     unsigned int *      /* needChecksRtrn */,
487     XkbEventCausePtr    /* cause */
488 #endif
489 );
490
491 extern void XkbApplyVModChangesToAllDevices(
492 #if NeedFunctionPrototypes
493     DeviceIntPtr        /* dev */,
494     XkbDescPtr          /* xkb */,
495     unsigned int        /* changed */,
496     XkbEventCausePtr    /* cause */
497 #endif
498 );
499
500 extern  unsigned int XkbMaskForVMask(
501 #if NeedFunctionPrototypes
502     XkbDescPtr          /* xkb */,
503     unsigned int        /* vmask */
504 #endif
505 );
506
507 extern Bool XkbVirtualModsToReal(
508 #if NeedFunctionPrototypes
509         XkbDescPtr      /* xkb */,
510         unsigned int    /* virtua_mask */,
511         unsigned int *  /* mask_rtrn */
512 #endif
513 );
514
515 extern  unsigned int    XkbAdjustGroup(
516 #if NeedFunctionPrototypes
517     int                 /* group */,
518     XkbControlsPtr      /* ctrls */
519 #endif
520 );
521
522 extern KeySym *XkbResizeKeySyms(
523 #if NeedFunctionPrototypes
524     XkbDescPtr          /* xkb */,
525     int                 /* key */,
526     int                 /* needed */
527 #endif
528 );
529
530 extern XkbAction *XkbResizeKeyActions(
531 #if NeedFunctionPrototypes
532     XkbDescPtr          /* xkb */,
533     int                 /* key */,
534     int                 /* needed */
535 #endif
536 );
537
538 extern void XkbUpdateKeyTypesFromCore(
539 #if NeedFunctionPrototypes
540     DeviceIntPtr        /* pXDev */,
541     KeyCode             /* first */,
542     CARD8               /* num */,
543     XkbChangesPtr       /* pChanges */
544 #endif
545 );
546
547 extern  void XkbUpdateDescActions(      
548 #if NeedFunctionPrototypes
549     XkbDescPtr          /* xkb */,
550     KeyCode             /* first */,
551     CARD8               /* num */,
552     XkbChangesPtr       /* changes */
553 #endif
554 );
555
556 extern void XkbUpdateActions(
557 #if NeedFunctionPrototypes
558     DeviceIntPtr        /* pXDev */,
559     KeyCode             /* first */,
560     CARD8               /* num */,
561     XkbChangesPtr       /* pChanges */,
562     unsigned int *      /* needChecksRtrn */,
563     XkbEventCausePtr    /* cause */
564 #endif
565 );
566
567 extern void XkbUpdateCoreDescription(
568 #if NeedFunctionPrototypes
569     DeviceIntPtr        /* keybd */,
570     Bool                /* resize */
571 #endif
572 );
573
574 extern void XkbApplyMappingChange(
575 #if NeedFunctionPrototypes
576     DeviceIntPtr        /* pXDev */,
577     CARD8               /* request */,
578     KeyCode             /* firstKey */,
579     CARD8               /* num */,
580     ClientPtr           /* client */
581 #endif
582 );
583
584 extern void XkbSetIndicators(
585 #if NeedFunctionPrototypes
586     DeviceIntPtr                /* pXDev */,
587     CARD32                      /* affect */,
588     CARD32                      /* values */,
589     XkbEventCausePtr            /* cause */
590 #endif
591 );
592
593 extern void XkbUpdateIndicators(
594 #if NeedFunctionPrototypes
595     DeviceIntPtr                /* keybd */,
596     CARD32                      /* changed */,
597     Bool                        /* check_edevs */,
598     XkbChangesPtr               /* pChanges */,
599     XkbEventCausePtr            /* cause */
600 #endif
601 );
602
603 extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
604 #if NeedFunctionPrototypes
605     DeviceIntPtr                /* dev */,
606     KbdFeedbackPtr              /* kf */,
607     LedFeedbackPtr              /* lf */,
608     unsigned int                /* needed_parts */
609 #endif
610 );
611
612 extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
613 #if NeedFunctionPrototypes
614     DeviceIntPtr                /* dev */,
615     unsigned int                /* class */,
616     unsigned int                /* id */,
617     unsigned int                /* needed_parts */
618 #endif
619 );
620
621 extern void XkbApplyLedNameChanges(
622 #if NeedFunctionPrototypes
623     DeviceIntPtr                /* dev */,
624     XkbSrvLedInfoPtr            /* sli */,
625     unsigned int                /* changed_names */,
626     xkbExtensionDeviceNotify *  /* ed */,
627     XkbChangesPtr               /* changes */,
628     XkbEventCausePtr            /* cause */
629 #endif
630 );
631
632 extern void XkbApplyLedMapChanges(
633 #if NeedFunctionPrototypes
634     DeviceIntPtr                /* dev */,
635     XkbSrvLedInfoPtr            /* sli */,
636     unsigned int                /* changed_maps */,
637     xkbExtensionDeviceNotify *  /* ed */,
638     XkbChangesPtr               /* changes */,
639     XkbEventCausePtr            /* cause */
640 #endif
641 );
642
643 extern void XkbApplyLedStateChanges(
644 #if NeedFunctionPrototypes
645     DeviceIntPtr                /* dev */,
646     XkbSrvLedInfoPtr            /* sli */,
647     unsigned int                /* changed_leds */,
648     xkbExtensionDeviceNotify *  /* ed */,
649     XkbChangesPtr               /* changes */,
650     XkbEventCausePtr            /* cause */
651 #endif
652 );
653
654 extern void XkbUpdateLedAutoState(
655 #if NeedFunctionPrototypes
656     DeviceIntPtr                /* dev */,
657     XkbSrvLedInfoPtr            /* sli */,
658     unsigned int                /* maps_to_check */,
659     xkbExtensionDeviceNotify *  /* ed */,
660     XkbChangesPtr               /* changes */,
661     XkbEventCausePtr            /* cause */
662 #endif
663 );
664
665 extern void XkbFlushLedEvents(  
666 #if NeedFunctionPrototypes
667     DeviceIntPtr                /* dev */,
668     DeviceIntPtr                /* kbd */,
669     XkbSrvLedInfoPtr            /* sli */,
670     xkbExtensionDeviceNotify *  /* ed */,
671     XkbChangesPtr               /* changes */,
672     XkbEventCausePtr            /* cause */
673 #endif
674 );
675
676 extern void XkbUpdateAllDeviceIndicators(
677 #if NeedFunctionPrototypes
678     XkbChangesPtr               /* changes */,
679     XkbEventCausePtr            /* cause */
680 #endif
681 );
682
683 extern unsigned int XkbIndicatorsToUpdate(
684 #if NeedFunctionPrototypes
685     DeviceIntPtr                /* dev */,
686     unsigned long               /* state_changes */,
687     Bool                        /* enabled_ctrl_changes */
688 #endif
689 );
690
691 extern void XkbComputeDerivedState(
692 #if NeedFunctionPrototypes
693     XkbSrvInfoPtr               /* xkbi */
694 #endif
695 );
696
697 extern void XkbCheckSecondaryEffects(
698 #if NeedFunctionPrototypes
699     XkbSrvInfoPtr               /* xkbi */,
700     unsigned int                /* which */,
701     XkbChangesPtr               /* changes */,
702     XkbEventCausePtr            /* cause */
703 #endif
704 );
705
706 extern void XkbCheckIndicatorMaps(
707 #if NeedFunctionPrototypes
708     DeviceIntPtr                /* dev */,
709     XkbSrvLedInfoPtr            /* sli */,
710     unsigned int                /* which */
711 #endif
712 );
713
714 extern unsigned int XkbStateChangedFlags(
715 #if NeedFunctionPrototypes
716     XkbStatePtr                 /* old */,
717     XkbStatePtr                 /* new */
718 #endif
719 );
720
721 extern  void XkbSendStateNotify(
722 #if NeedFunctionPrototypes
723        DeviceIntPtr     /* kbd */,
724        xkbStateNotify * /* pSN */
725 #endif
726 );
727
728 extern  void XkbSendMapNotify(
729 #if NeedFunctionPrototypes
730        DeviceIntPtr     /* kbd */,
731        xkbMapNotify *   /* ev */
732 #endif
733 );
734
735 extern  int  XkbComputeControlsNotify(
736 #if NeedFunctionPrototypes
737         DeviceIntPtr            /* kbd */,
738         XkbControlsPtr          /* old */,
739         XkbControlsPtr          /* new */,
740         xkbControlsNotify *     /* pCN */,
741         Bool                    /* forceCtrlProc */
742 #endif
743 );
744
745 extern  void XkbSendControlsNotify(
746 #if NeedFunctionPrototypes
747        DeviceIntPtr             /* kbd */,
748        xkbControlsNotify *      /* ev */
749 #endif
750 );
751
752 extern  void XkbSendCompatMapNotify(
753 #if NeedFunctionPrototypes
754         DeviceIntPtr            /* kbd */,
755         xkbCompatMapNotify *    /* ev */
756 #endif
757 );
758
759 extern  void XkbSendIndicatorNotify(
760 #if NeedFunctionPrototypes
761        DeviceIntPtr             /* kbd */,
762        int                      /* xkbType */,
763        xkbIndicatorNotify *     /* ev */
764 #endif
765 );
766
767 extern  void XkbHandleBell(
768 #if NeedFunctionPrototypes
769        BOOL             /* force */,
770        BOOL             /* eventOnly */,
771        DeviceIntPtr     /* kbd */,
772        CARD8            /* percent */,
773        pointer          /* ctrl */,
774        CARD8            /* class */,
775        Atom             /* name */,
776        WindowPtr        /* pWin */,
777        ClientPtr        /* pClient */
778 #endif
779 );
780
781 extern  void XkbSendAccessXNotify(
782 #if NeedFunctionPrototypes
783        DeviceIntPtr             /* kbd */,
784        xkbAccessXNotify *       /* pEv */
785 #endif
786 );
787
788 extern  void XkbSendNamesNotify(
789 #if NeedFunctionPrototypes
790        DeviceIntPtr     /* kbd */,
791        xkbNamesNotify * /* ev */
792 #endif
793 );
794
795 extern  void XkbSendCompatNotify(
796 #if NeedFunctionPrototypes
797        DeviceIntPtr             /* kbd */,
798        xkbCompatMapNotify *     /* ev */
799 #endif
800 );
801
802 extern  void XkbSendActionMessage(
803 #if NeedFunctionPrototypes
804        DeviceIntPtr             /* kbd */,
805        xkbActionMessage *       /* ev */
806 #endif
807 );
808
809 extern  void XkbSendExtensionDeviceNotify(
810 #if NeedFunctionPrototypes
811        DeviceIntPtr                     /* kbd */,
812        ClientPtr                        /* client */,
813        xkbExtensionDeviceNotify *       /* ev */
814 #endif
815 );
816
817 extern void XkbSendNotification(
818 #if NeedFunctionPrototypes
819     DeviceIntPtr                /* kbd */,
820     XkbChangesPtr               /* pChanges */,
821     XkbEventCausePtr            /* cause */
822 #endif
823 );
824
825 extern void XkbProcessKeyboardEvent(
826 #if NeedFunctionPrototypes
827     struct _xEvent *            /* xE */,
828     DeviceIntPtr                /* keybd */,
829     int                         /* count */
830 #endif
831 );
832
833 extern void XkbProcessOtherEvent(
834 #if NeedFunctionPrototypes
835     struct _xEvent *            /* xE */,
836     DeviceIntPtr                /* keybd */,
837     int                         /* count */
838 #endif
839 );
840
841 extern void XkbHandleActions(
842 #if NeedFunctionPrototypes
843     DeviceIntPtr                /* dev */,
844     DeviceIntPtr                /* kbd */,
845     struct _xEvent *            /* xE */,
846     int                         /* count */
847 #endif
848 );
849
850 extern Bool XkbEnableDisableControls(
851 #if NeedFunctionPrototypes
852     XkbSrvInfoPtr       /* xkbi */,
853     unsigned long       /* change */,
854     unsigned long       /* newValues */,
855     XkbChangesPtr       /* changes */,
856     XkbEventCausePtr    /* cause */
857 #endif
858 );
859
860 extern void AccessXInit(
861 #if NeedFunctionPrototypes
862     DeviceIntPtr        /* dev */
863 #endif
864 );
865
866 extern Bool AccessXFilterPressEvent(
867 #if NeedFunctionPrototypes
868     register struct _xEvent *   /* xE */,
869     register DeviceIntPtr       /* keybd */,
870     int                         /* count */
871 #endif
872 );
873
874 extern Bool AccessXFilterReleaseEvent(
875 #if NeedFunctionPrototypes
876     register struct _xEvent *   /* xE */,
877     register DeviceIntPtr       /* keybd */,
878     int                         /* count */
879 #endif
880 );
881
882 extern void AccessXCancelRepeatKey(
883 #if NeedFunctionPrototypes
884     XkbSrvInfoPtr       /* xkbi */,
885     KeyCode             /* key */
886 #endif
887 );
888
889 extern void AccessXComputeCurveFactor(
890 #if NeedFunctionPrototypes
891     XkbSrvInfoPtr       /* xkbi */,
892     XkbControlsPtr      /* ctrls */
893 #endif
894 );
895
896 extern  XkbDeviceLedInfoPtr     XkbAddDeviceLedInfo(
897 #if NeedFunctionPrototypes
898         XkbDeviceInfoPtr        /* devi */,
899         unsigned int            /* ledClass */,
900         unsigned int            /* ledId */
901 #endif
902 );
903
904 extern  XkbDeviceInfoPtr        XkbAllocDeviceInfo(
905 #if NeedFunctionPrototypes
906         unsigned int            /* deviceSpec */,
907         unsigned int            /* nButtons */,
908         unsigned int            /* szLeds */
909 #endif
910 );
911
912 extern  void XkbFreeDeviceInfo(
913 #if NeedFunctionPrototypes
914         XkbDeviceInfoPtr        /* devi */,
915         unsigned int            /* which */,
916         Bool                    /* freeDevI */
917 #endif
918 );
919
920 extern Status XkbResizeDeviceButtonActions(
921 #if NeedFunctionPrototypes
922         XkbDeviceInfoPtr        /* devi */,
923         unsigned int            /* newTotal */
924 #endif
925 );
926
927 extern  XkbInterestPtr XkbFindClientResource(
928 #if NeedFunctionPrototypes
929        DevicePtr        /* inDev */,
930        ClientPtr        /* client */
931 #endif
932 );
933
934 extern  XkbInterestPtr XkbAddClientResource(
935 #if NeedFunctionPrototypes
936        DevicePtr        /* inDev */,
937        ClientPtr        /* client */,
938        XID              /* id */
939 #endif
940 );
941
942 extern  int XkbRemoveClient(
943 #if NeedFunctionPrototypes
944        DevicePtr        /* inDev */,
945        ClientPtr        /* client */
946 #endif
947 );
948
949 extern  int XkbRemoveResourceClient(
950 #if NeedFunctionPrototypes
951        DevicePtr        /* inDev */,
952        XID              /* id */
953 #endif
954 );
955
956 extern int XkbDDXInitDevice(
957 #if NeedFunctionPrototypes
958     DeviceIntPtr        /* dev */
959 #endif
960 );
961
962 extern  int XkbDDXAccessXBeep(
963 #if NeedFunctionPrototypes
964     DeviceIntPtr        /* dev */,
965     unsigned int        /* what */,
966     unsigned int        /* which */
967 #endif
968 );
969
970 extern  void XkbDDXKeyClick(
971 #if NeedFunctionPrototypes
972     DeviceIntPtr        /* dev */,
973     int                 /* keycode */,
974     int                 /* synthetic */
975 #endif
976 );
977
978 extern  int XkbDDXUsesSoftRepeat(
979 #if NeedFunctionPrototypes
980     DeviceIntPtr        /* dev */
981 #endif
982 );
983
984 extern  void XkbDDXKeybdCtrlProc(
985 #if NeedFunctionPrototypes
986         DeviceIntPtr    /* dev */,
987         KeybdCtrl *     /* ctrl */
988 #endif
989 );
990
991 extern void XkbDDXChangeControls(
992 #if NeedFunctionPrototypes
993         DeviceIntPtr    /* dev */,
994         XkbControlsPtr  /* old */,
995         XkbControlsPtr  /* new */
996 #endif
997 );
998
999 extern void XkbDDXUpdateIndicators(
1000 #if NeedFunctionPrototypes
1001         DeviceIntPtr    /* keybd */,
1002         CARD32          /* newState */
1003 #endif
1004 );
1005
1006 extern void XkbDDXUpdateDeviceIndicators(
1007 #if NeedFunctionPrototypes
1008         DeviceIntPtr            /* dev */,
1009         XkbSrvLedInfoPtr        /* sli */,
1010         CARD32                  /* newState */
1011 #endif
1012 );
1013
1014 extern void XkbDDXFakePointerButton(
1015 #if NeedFunctionPrototypes
1016         int             /* event */,
1017         int             /* button */
1018 #endif
1019 );
1020
1021 extern void XkbDDXFakePointerMotion(
1022 #if NeedFunctionPrototypes
1023         unsigned int    /* flags */,
1024         int             /* x */,
1025         int             /* y */
1026 #endif
1027 );
1028
1029 extern void XkbDDXFakeDeviceButton(
1030 #if NeedFunctionPrototypes
1031         DeviceIntPtr    /* dev */,
1032         Bool            /* press */,
1033         int             /* button */
1034 #endif
1035 );
1036
1037 extern int XkbDDXTerminateServer(
1038 #if NeedFunctionPrototypes
1039         DeviceIntPtr    /* dev */,
1040         KeyCode         /* key */,
1041         XkbAction *     /* act */
1042 #endif
1043 );
1044
1045 extern int XkbDDXSwitchScreen(
1046 #if NeedFunctionPrototypes
1047         DeviceIntPtr    /* dev */,
1048         KeyCode         /* key */,
1049         XkbAction *     /* act */
1050 #endif
1051 );
1052
1053 extern void XkbDisableComputedAutoRepeats(
1054 #if NeedFunctionPrototypes
1055         DeviceIntPtr    /* pXDev */,
1056         unsigned int    /* key */
1057 #endif
1058 );
1059
1060 extern void XkbSetRepeatKeys(
1061 #if NeedFunctionPrototypes
1062         DeviceIntPtr    /* pXDev */,
1063         int             /* key */,
1064         int             /* onoff */
1065 #endif
1066 );
1067
1068 extern  int XkbLatchModifiers(
1069 #if NeedFunctionPrototypes
1070         DeviceIntPtr    /* pXDev */,
1071         CARD8           /* mask */,
1072         CARD8           /* latches */
1073 #endif
1074 );
1075
1076 extern  int XkbLatchGroup(
1077 #if NeedFunctionPrototypes
1078         DeviceIntPtr    /* pXDev */,
1079         int             /* group */
1080 #endif
1081 );
1082
1083 extern  void XkbClearAllLatchesAndLocks(
1084 #if NeedFunctionPrototypes
1085         DeviceIntPtr            /* dev */,
1086         XkbSrvInfoPtr           /* xkbi */,
1087         Bool                    /* genEv */,
1088         XkbEventCausePtr        /* cause */
1089 #endif
1090 );
1091
1092 extern  void    XkbSetRulesDflts(
1093 #if NeedFunctionPrototypes
1094         char *                  /* rulesFile */,
1095         char *                  /* model */,
1096         char *                  /* layout */,
1097         char *                  /* variant */,
1098         char *                  /* options */
1099 #endif
1100 );
1101
1102 extern  void    XkbInitDevice(
1103 #if NeedFunctionPrototypes
1104         DeviceIntPtr    /* pXDev */
1105 #endif
1106 );
1107
1108 extern  Bool    XkbInitKeyboardDeviceStruct(
1109 #if NeedFunctionPrototypes
1110         DeviceIntPtr            /* pXDev */,
1111         XkbComponentNamesPtr    /* pNames */,
1112         KeySymsPtr              /* pSyms */,
1113         CARD8                   /* pMods */[],
1114         BellProcPtr             /* bellProc */,
1115         KbdCtrlProcPtr          /* ctrlProc */
1116 #endif
1117 );
1118
1119 extern  void    XkbInitDevice(
1120 #if NeedFunctionPrototypes
1121         DeviceIntPtr            /* pXDev */
1122 #endif
1123 );
1124
1125 extern  int SProcXkbDispatch(
1126 #if NeedFunctionPrototypes
1127         ClientPtr               /* client */
1128 #endif
1129 );
1130
1131 extern XkbGeometryPtr XkbLookupNamedGeometry(
1132 #if NeedFunctionPrototypes
1133         DeviceIntPtr            /* dev */,
1134         Atom                    /* name */,
1135         Bool *                  /* shouldFree */
1136 #endif
1137 );
1138
1139 extern char *   _XkbDupString(
1140 #if NeedFunctionPrototypes
1141         char *                  /* str */
1142 #endif
1143 );
1144
1145 extern void     XkbConvertCase(
1146 #if NeedFunctionPrototypes
1147         KeySym                  /* sym */,
1148         KeySym *                /* lower */,
1149         KeySym *                /* upper */
1150 #endif
1151 );
1152
1153 extern  Status   XkbChangeKeycodeRange( 
1154 #if NeedFunctionPrototypes
1155         XkbDescPtr              /* xkb */,
1156         int                     /* minKC */,
1157         int                     /* maxKC */,
1158         XkbChangesPtr           /* changes */
1159 #endif
1160 );
1161
1162 #ifdef XKBSRV_NEED_FILE_FUNCS
1163
1164 #include "extensions/XKMformat.h"
1165 #include "extensions/XKBfile.h"
1166 #include "extensions/XKBrules.h"
1167
1168 #define _XkbListKeymaps         0
1169 #define _XkbListKeycodes        1
1170 #define _XkbListTypes           2
1171 #define _XkbListCompat          3
1172 #define _XkbListSymbols         4
1173 #define _XkbListGeometry        5
1174 #define _XkbListNumComponents   6
1175
1176 typedef struct _XkbSrvListInfo {
1177         int             szPool;
1178         int             nPool;
1179         char *          pool;
1180
1181         int             maxRtrn;
1182         int             nTotal;
1183
1184         char *          pattern[_XkbListNumComponents];
1185         int             nFound[_XkbListNumComponents];
1186 } XkbSrvListInfoRec,*XkbSrvListInfoPtr;
1187
1188 char *
1189 XkbGetRulesDflts(
1190 #if NeedFunctionPrototypes
1191         XkbRF_VarDefsPtr        /* defs */
1192 #endif
1193 );
1194
1195 extern void     XkbSetRulesUsed(
1196 #if NeedFunctionPrototypes
1197         XkbRF_VarDefsPtr        /* defs */
1198 #endif
1199 );
1200
1201
1202 extern  Status  XkbDDXList(
1203 #if NeedFunctionPrototypes
1204         DeviceIntPtr            /* dev */,
1205         XkbSrvListInfoPtr       /* listing */,
1206         ClientPtr               /* client */
1207 #endif
1208 );
1209
1210 extern  unsigned int XkbDDXLoadKeymapByNames(
1211 #if NeedFunctionPrototypes
1212         DeviceIntPtr            /* keybd */,
1213         XkbComponentNamesPtr    /* names */,
1214         unsigned int            /* want */,
1215         unsigned int            /* need */,
1216         XkbFileInfoPtr          /* finfoRtrn */,
1217         char *                  /* keymapNameRtrn */,
1218         int                     /* keymapNameRtrnLen */
1219 #endif
1220 );
1221
1222 extern  Bool XkbDDXNamesFromRules(
1223 #if NeedFunctionPrototypes
1224         DeviceIntPtr            /* keybd */,
1225         char *                  /* rules */,
1226         XkbRF_VarDefsPtr        /* defs */,
1227         XkbComponentNamesPtr    /* names */
1228 #endif
1229 );
1230
1231 extern  FILE *XkbDDXOpenConfigFile(
1232 #if NeedFunctionPrototypes
1233         char *  /* mapName */,
1234         char *  /* fileNameRtrn */,
1235         int     /* fileNameRtrnLen */
1236 #endif
1237 );
1238
1239 extern  Bool XkbDDXApplyConfig(
1240 #if NeedFunctionPrototypes
1241         XPointer        /* cfg_in */,
1242         XkbSrvInfoPtr   /* xkbi */
1243 #endif
1244 );
1245
1246 extern XPointer XkbDDXPreloadConfig(
1247 #if NeedFunctionPrototypes
1248         char **                 /* rulesFileRtrn */,
1249         XkbRF_VarDefsPtr        /* defs */,
1250         XkbComponentNamesPtr    /* names */,
1251         DeviceIntPtr            /* dev */
1252 #endif
1253 );
1254
1255 extern  int XkbDDXUsesSoftRepeat(
1256 #if NeedFunctionPrototypes
1257         DeviceIntPtr    /* pXDev */
1258 #endif
1259 );
1260
1261 extern  void XkbDDXFakePointerMotion(
1262 #if NeedFunctionPrototypes
1263         unsigned int            /* flags */,
1264         int                     /* x */,
1265         int                     /* y */
1266 #endif
1267 );
1268
1269 extern  int _XkbStrCaseCmp(
1270 #if NeedFunctionPrototypes
1271         char *                  /* str1 */,
1272         char *                  /* str2 */
1273 #endif
1274 );
1275
1276 #endif /* XKBSRV_NEED_FILE_FUNCS */
1277
1278
1279 _XFUNCPROTOEND
1280
1281 #define XkbAtomGetString(d,s)   NameForAtom(s)
1282
1283 #endif /* _XKBSRV_H_ */
1284
1285