• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /************************************************************
2 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
3 
4 Permission to use, copy, modify, and distribute this
5 software and its documentation for any purpose and without
6 fee is hereby granted, provided that the above copyright
7 notice appear in all copies and that both that copyright
8 notice and this permission notice appear in supporting
9 documentation, and that the name of Silicon Graphics not be
10 used in advertising or publicity pertaining to distribution
11 of the software without specific prior written permission.
12 Silicon Graphics makes no representation about the suitability
13 of this software for any purpose. It is provided "as is"
14 without any express or implied warranty.
15 
16 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
23 THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 
25 ********************************************************/
26 
27 #ifndef _XKBSRV_H_
28 #define	_XKBSRV_H_
29 
30 #ifdef XKB_IN_SERVER
31 #define XkbAllocClientMap		SrvXkbAllocClientMap
32 #define XkbAllocServerMap		SrvXkbAllocServerMap
33 #define XkbChangeTypesOfKey		SrvXkbChangeTypesOfKey
34 #define	XkbAddKeyType			SrvXkbAddKeyType
35 #define XkbCopyKeyType			SrvXkbCopyKeyType
36 #define XkbCopyKeyTypes			SrvXkbCopyKeyTypes
37 #define XkbFreeClientMap		SrvXkbFreeClientMap
38 #define XkbFreeServerMap		SrvXkbFreeServerMap
39 #define XkbInitCanonicalKeyTypes	SrvXkbInitCanonicalKeyTypes
40 #define	XkbKeyTypesForCoreSymbols	SrvXkbKeyTypesForCoreSymbols
41 #define	XkbApplyCompatMapToKey		SrvXkbApplyCompatMapToKey
42 #define	XkbUpdateMapFromCore		SrvXkbUpdateMapFromCore
43 #define XkbResizeKeyActions		SrvXkbResizeKeyActions
44 #define XkbResizeKeySyms		SrvXkbResizeKeySyms
45 #define XkbResizeKeyType		SrvXkbResizeKeyType
46 #define XkbAllocCompatMap		SrvXkbAllocCompatMap
47 #define XkbAllocControls		SrvXkbAllocControls
48 #define XkbAllocIndicatorMaps		SrvXkbAllocIndicatorMaps
49 #define XkbAllocKeyboard		SrvXkbAllocKeyboard
50 #define XkbAllocNames			SrvXkbAllocNames
51 #define XkbFreeCompatMap		SrvXkbFreeCompatMap
52 #define XkbFreeControls			SrvXkbFreeControls
53 #define XkbFreeIndicatorMaps		SrvXkbFreeIndicatorMaps
54 #define XkbFreeKeyboard			SrvXkbFreeKeyboard
55 #define XkbFreeNames			SrvXkbFreeNames
56 #define	XkbAddDeviceLedInfo		SrvXkbAddDeviceLedInfo
57 #define	XkbAllocDeviceInfo		SrvXkbAllocDeviceInfo
58 #define	XkbFreeDeviceInfo		SrvXkbFreeDeviceInfo
59 #define	XkbResizeDeviceButtonActions	SrvXkbResizeDeviceButtonActions
60 #define XkbLatchModifiers		SrvXkbLatchModifiers
61 #define XkbLatchGroup			SrvXkbLatchGroup
62 #define XkbVirtualModsToReal		SrvXkbVirtualModsToReal
63 #define	XkbChangeKeycodeRange		SrvXkbChangeKeycodeRange
64 #define	XkbApplyVirtualModChanges	SrvXkbApplyVirtualModChanges
65 #define	XkbUpdateActionVirtualMods	SrvXkbUpdateActionVirtualMods
66 #define XkbUpdateKeyTypeVirtualMods	SrvXkbUpdateKeyTypeVirtualMods
67 #endif
68 
69 #include <X11/extensions/XKBstr.h>
70 #include <X11/extensions/XKBproto.h>
71 #include "inputstr.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 typedef struct
233 {
234     ProcessInputProc processInputProc;
235     ProcessInputProc realInputProc;
236     DeviceUnwrapProc unwrapProc;
237 } xkbDeviceInfoRec, *xkbDeviceInfoPtr;
238 
239 #define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
240 	device->public.processInputProc = proc; \
241 	oldprocs->processInputProc = \
242 	oldprocs->realInputProc = device->public.realInputProc; \
243 	device->public.realInputProc = proc; \
244 	oldprocs->unwrapProc = device->unwrapProc; \
245 	device->unwrapProc = unwrapproc;
246 
247 #define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
248 	if (device->public.processInputProc == device->public.realInputProc)\
249 	    device->public.processInputProc = proc; \
250 	oldprocs->processInputProc = \
251 	oldprocs->realInputProc = device->public.realInputProc; \
252 	device->public.realInputProc = proc; \
253 	oldprocs->unwrapProc = device->unwrapProc; \
254 	device->unwrapProc = unwrapproc;
255 
256 #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \
257 	device->public.processInputProc = oldprocs->processInputProc; \
258 	device->public.realInputProc = oldprocs->realInputProc; \
259 	device->unwrapProc = oldprocs->unwrapProc;
260 
261 #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr)
262 
263 /***====================================================================***/
264 
265 
266 /***====================================================================***/
267 
268 #define XkbAX_KRGMask	 (XkbSlowKeysMask|XkbBounceKeysMask)
269 #define	XkbAllFilteredEventsMask \
270 	(XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask)
271 
272 /***====================================================================***/
273 
274 extern int	XkbReqCode;
275 extern int	XkbEventBase;
276 extern int	XkbKeyboardErrorCode;
277 extern int	XkbDisableLockActions;
278 extern char *	XkbBaseDirectory;
279 extern char *	XkbBinDirectory;
280 extern char *	XkbInitialMap;
281 extern int	_XkbClientMajor;
282 extern int	_XkbClientMinor;
283 extern unsigned	int XkbXIUnsupported;
284 
285 extern char *	XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed;
286 extern Bool	noXkbExtension;
287 extern Bool	XkbWantRulesProp;
288 
289 extern pointer	XkbLastRepeatEvent;
290 
291 extern CARD32	xkbDebugFlags;
292 extern CARD32	xkbDebugCtrls;
293 
294 #define	_XkbAlloc(s)		xalloc((s))
295 #define	_XkbCalloc(n,s)		Xcalloc((n)*(s))
296 #define	_XkbRealloc(o,s)	Xrealloc((o),(s))
297 #define	_XkbTypedAlloc(t)	((t *)xalloc(sizeof(t)))
298 #define	_XkbTypedCalloc(n,t)	((t *)Xcalloc((n)*sizeof(t)))
299 #define	_XkbTypedRealloc(o,n,t) \
300 	((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
301 #define	_XkbClearElems(a,f,l,t)	bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
302 #define	_XkbFree(p)		Xfree(p)
303 
304 #define	_XkbLibError(c,l,d) \
305 	{ _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
306 #define	_XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
307 #define	_XkbErrCode3(a,b,c)	_XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
308 #define	_XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
309 
310 extern	int	DeviceKeyPress,DeviceKeyRelease;
311 extern	int	DeviceButtonPress,DeviceButtonRelease;
312 
313 #ifdef XINPUT
314 #define	_XkbIsPressEvent(t)	(((t)==KeyPress)||((t)==DeviceKeyPress))
315 #define	_XkbIsReleaseEvent(t)	(((t)==KeyRelease)||((t)==DeviceKeyRelease))
316 #else
317 #define	_XkbIsPressEvent(t)	((t)==KeyPress)
318 #define	_XkbIsReleaseEvent(t)	((t)==KeyRelease)
319 #endif
320 
321 #define	_XkbCoreKeycodeInRange(c,k)	(((k)>=(c)->curKeySyms.minKeyCode)&&\
322 					 ((k)<=(c)->curKeySyms.maxKeyCode))
323 #define	_XkbCoreNumKeys(c)	((c)->curKeySyms.maxKeyCode-\
324 				 (c)->curKeySyms.minKeyCode+1)
325 
326 #define	XConvertCase(s,l,u)	XkbConvertCase(s,l,u)
327 #undef	IsKeypadKey
328 #define	IsKeypadKey(s)		XkbKSIsKeypad(s)
329 
330 typedef int Status;
331 typedef pointer XPointer;
332 typedef struct _XDisplay Display;
333 
334 #ifndef True
335 #define	True	1
336 #define	False	0
337 #endif
338 
339 #ifndef PATH_MAX
340 #ifdef MAXPATHLEN
341 #define	PATH_MAX MAXPATHLEN
342 #else
343 #define	PATH_MAX 1024
344 #endif
345 #endif
346 
347 _XFUNCPROTOBEGIN
348 
349 extern void XkbUseMsg(
350     void
351 );
352 
353 extern int XkbProcessArguments(
354     int				/* argc */,
355     char **			/* argv */,
356     int				/* i */
357 );
358 
359 extern	void	XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
360 
361 extern	void	XkbFreeCompatMap(
362     XkbDescPtr			/* xkb */,
363     unsigned int		/* which */,
364     Bool			/* freeMap */
365 );
366 
367 extern	void XkbFreeNames(
368 	XkbDescPtr		/* xkb */,
369 	unsigned int		/* which */,
370 	Bool			/* freeMap */
371 );
372 
373 extern DeviceIntPtr _XkbLookupAnyDevice(
374     int			/* id */,
375     int *		/* why_rtrn */
376 );
377 
378 extern DeviceIntPtr _XkbLookupKeyboard(
379     int			/* id */,
380     int *		/* why_rtrn */
381 );
382 
383 extern DeviceIntPtr _XkbLookupBellDevice(
384     int			/* id */,
385     int *		/* why_rtrn */
386 );
387 
388 extern DeviceIntPtr _XkbLookupLedDevice(
389     int			/* id */,
390     int *		/* why_rtrn */
391 );
392 
393 extern DeviceIntPtr _XkbLookupButtonDevice(
394     int			/* id */,
395     int *		/* why_rtrn */
396 );
397 
398 extern	XkbDescPtr XkbAllocKeyboard(
399 	void
400 );
401 
402 extern	Status XkbAllocClientMap(
403 	XkbDescPtr		/* xkb */,
404 	unsigned int		/* which */,
405 	unsigned int		/* nTypes */
406 );
407 
408 extern	Status XkbAllocServerMap(
409 	XkbDescPtr		/* xkb */,
410 	unsigned int		/* which */,
411 	unsigned int		/* nNewActions */
412 );
413 
414 extern	void	XkbFreeClientMap(
415     XkbDescPtr			/* xkb */,
416     unsigned int		/* what */,
417     Bool			/* freeMap */
418 );
419 
420 extern	void	XkbFreeServerMap(
421     XkbDescPtr			/* xkb */,
422     unsigned int		/* what */,
423     Bool			/* freeMap */
424 );
425 
426 extern	Status XkbAllocIndicatorMaps(
427 	XkbDescPtr		/* xkb */
428 );
429 
430 extern	Status	XkbAllocCompatMap(
431     XkbDescPtr			/* xkb */,
432     unsigned int		/* which */,
433     unsigned int		/* nInterpret */
434 );
435 
436 extern	Status XkbAllocNames(
437 	XkbDescPtr		/* xkb */,
438 	unsigned int		/* which */,
439 	int			/* nTotalRG */,
440 	int			/* nTotalAliases */
441 );
442 
443 extern	Status	XkbAllocControls(
444 	XkbDescPtr		/* xkb */,
445 	unsigned int		/* which*/
446 );
447 
448 extern	Status	XkbCopyKeyType(
449     XkbKeyTypePtr		/* from */,
450     XkbKeyTypePtr		/* into */
451 );
452 
453 extern	Status	XkbCopyKeyTypes(
454     XkbKeyTypePtr		/* from */,
455     XkbKeyTypePtr		/* into */,
456     int				/* num_types */
457 );
458 
459 extern	Status	XkbResizeKeyType(
460     XkbDescPtr		/* xkb */,
461     int			/* type_ndx */,
462     int			/* map_count */,
463     Bool		/* want_preserve */,
464     int			/* new_num_lvls */
465 );
466 
467 extern	void	XkbFreeKeyboard(
468 	XkbDescPtr		/* xkb */,
469 	unsigned int		/* which */,
470 	Bool			/* freeDesc */
471 );
472 
473 extern  void XkbSetActionKeyMods(
474 	XkbDescPtr		/* xkb */,
475 	XkbAction *		/* act */,
476 	unsigned int 		/* mods */
477 );
478 
479 extern Bool XkbCheckActionVMods(
480 	XkbDescPtr		/* xkb */,
481 	XkbAction *		/* act */,
482 	unsigned int 		/* changed */
483 );
484 
485 extern Bool XkbApplyVModChanges(
486     XkbSrvInfoPtr	/* xkbi */,
487     unsigned int	/* changed */,
488     XkbChangesPtr	/* pChanges */,
489     unsigned int *	/* needChecksRtrn */,
490     XkbEventCausePtr	/* cause */
491 );
492 
493 extern void XkbApplyVModChangesToAllDevices(
494     DeviceIntPtr	/* dev */,
495     XkbDescPtr 		/* xkb */,
496     unsigned int 	/* changed */,
497     XkbEventCausePtr	/* cause */
498 );
499 
500 extern	unsigned int XkbMaskForVMask(
501     XkbDescPtr		/* xkb */,
502     unsigned int	/* vmask */
503 );
504 
505 extern Bool XkbVirtualModsToReal(
506 	XkbDescPtr	/* xkb */,
507 	unsigned int	/* virtua_mask */,
508 	unsigned int *	/* mask_rtrn */
509 );
510 
511 extern	unsigned int	XkbAdjustGroup(
512     int			/* group */,
513     XkbControlsPtr	/* ctrls */
514 );
515 
516 extern KeySym *XkbResizeKeySyms(
517     XkbDescPtr		/* xkb */,
518     int 		/* key */,
519     int 		/* needed */
520 );
521 
522 extern XkbAction *XkbResizeKeyActions(
523     XkbDescPtr		/* xkb */,
524     int 		/* key */,
525     int 		/* needed */
526 );
527 
528 extern void XkbUpdateKeyTypesFromCore(
529     DeviceIntPtr	/* pXDev */,
530     KeyCode 		/* first */,
531     CARD8 		/* num */,
532     XkbChangesPtr	/* pChanges */
533 );
534 
535 extern	void XkbUpdateDescActions(
536     XkbDescPtr		/* xkb */,
537     KeyCode		/* first */,
538     CARD8		/* num */,
539     XkbChangesPtr	/* changes */
540 );
541 
542 extern void XkbUpdateActions(
543     DeviceIntPtr	/* pXDev */,
544     KeyCode 		/* first */,
545     CARD8 		/* num */,
546     XkbChangesPtr  	/* pChanges */,
547     unsigned int *	/* needChecksRtrn */,
548     XkbEventCausePtr	/* cause */
549 );
550 
551 extern void XkbUpdateCoreDescription(
552     DeviceIntPtr	/* keybd */,
553     Bool		/* resize */
554 );
555 
556 extern void XkbApplyMappingChange(
557     DeviceIntPtr	/* pXDev */,
558     CARD8 		/* request */,
559     KeyCode 		/* firstKey */,
560     CARD8 		/* num */,
561     ClientPtr		/* client */
562 );
563 
564 extern void XkbSetIndicators(
565     DeviceIntPtr		/* pXDev */,
566     CARD32			/* affect */,
567     CARD32			/* values */,
568     XkbEventCausePtr		/* cause */
569 );
570 
571 extern void XkbUpdateIndicators(
572     DeviceIntPtr		/* keybd */,
573     CARD32		 	/* changed */,
574     Bool			/* check_edevs */,
575     XkbChangesPtr		/* pChanges */,
576     XkbEventCausePtr		/* cause */
577 );
578 
579 extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
580     DeviceIntPtr		/* dev */,
581     KbdFeedbackPtr		/* kf */,
582     LedFeedbackPtr		/* lf */,
583     unsigned int		/* needed_parts */
584 );
585 
586 extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
587     DeviceIntPtr		/* dev */,
588     unsigned int		/* class */,
589     unsigned int		/* id */,
590     unsigned int		/* needed_parts */
591 );
592 
593 extern void XkbApplyLedNameChanges(
594     DeviceIntPtr		/* dev */,
595     XkbSrvLedInfoPtr		/* sli */,
596     unsigned int		/* changed_names */,
597     xkbExtensionDeviceNotify *	/* ed */,
598     XkbChangesPtr		/* changes */,
599     XkbEventCausePtr		/* cause */
600 );
601 
602 extern void XkbApplyLedMapChanges(
603     DeviceIntPtr		/* dev */,
604     XkbSrvLedInfoPtr		/* sli */,
605     unsigned int		/* changed_maps */,
606     xkbExtensionDeviceNotify *	/* ed */,
607     XkbChangesPtr		/* changes */,
608     XkbEventCausePtr		/* cause */
609 );
610 
611 extern void XkbApplyLedStateChanges(
612     DeviceIntPtr		/* dev */,
613     XkbSrvLedInfoPtr		/* sli */,
614     unsigned int		/* changed_leds */,
615     xkbExtensionDeviceNotify *	/* ed */,
616     XkbChangesPtr		/* changes */,
617     XkbEventCausePtr		/* cause */
618 );
619 
620 extern void XkbUpdateLedAutoState(
621     DeviceIntPtr		/* dev */,
622     XkbSrvLedInfoPtr		/* sli */,
623     unsigned int		/* maps_to_check */,
624     xkbExtensionDeviceNotify *	/* ed */,
625     XkbChangesPtr		/* changes */,
626     XkbEventCausePtr		/* cause */
627 );
628 
629 extern void XkbFlushLedEvents(
630     DeviceIntPtr		/* dev */,
631     DeviceIntPtr		/* kbd */,
632     XkbSrvLedInfoPtr		/* sli */,
633     xkbExtensionDeviceNotify *	/* ed */,
634     XkbChangesPtr		/* changes */,
635     XkbEventCausePtr		/* cause */
636 );
637 
638 extern void XkbUpdateAllDeviceIndicators(
639     XkbChangesPtr		/* changes */,
640     XkbEventCausePtr		/* cause */
641 );
642 
643 extern unsigned int XkbIndicatorsToUpdate(
644     DeviceIntPtr		/* dev */,
645     unsigned long		/* state_changes */,
646     Bool			/* enabled_ctrl_changes */
647 );
648 
649 extern void XkbComputeDerivedState(
650     XkbSrvInfoPtr		/* xkbi */
651 );
652 
653 extern void XkbCheckSecondaryEffects(
654     XkbSrvInfoPtr		/* xkbi */,
655     unsigned int		/* which */,
656     XkbChangesPtr		/* changes */,
657     XkbEventCausePtr		/* cause */
658 );
659 
660 extern void XkbCheckIndicatorMaps(
661     DeviceIntPtr		/* dev */,
662     XkbSrvLedInfoPtr		/* sli */,
663     unsigned int		/* which */
664 );
665 
666 extern unsigned int XkbStateChangedFlags(
667     XkbStatePtr			/* old */,
668     XkbStatePtr			/* new */
669 );
670 
671 extern	void XkbSendStateNotify(
672        DeviceIntPtr	/* kbd */,
673        xkbStateNotify *	/* pSN */
674 );
675 
676 extern	void XkbSendMapNotify(
677        DeviceIntPtr	/* kbd */,
678        xkbMapNotify *	/* ev */
679 );
680 
681 extern	int  XkbComputeControlsNotify(
682 	DeviceIntPtr		/* kbd */,
683 	XkbControlsPtr		/* old */,
684 	XkbControlsPtr		/* new */,
685 	xkbControlsNotify *	/* pCN */,
686 	Bool			/* forceCtrlProc */
687 );
688 
689 extern	void XkbSendControlsNotify(
690        DeviceIntPtr		/* kbd */,
691        xkbControlsNotify *	/* ev */
692 );
693 
694 extern	void XkbSendCompatMapNotify(
695 	DeviceIntPtr		/* kbd */,
696 	xkbCompatMapNotify *	/* ev */
697 );
698 
699 extern	void XkbSendIndicatorNotify(
700        DeviceIntPtr		/* kbd */,
701        int			/* xkbType */,
702        xkbIndicatorNotify *	/* ev */
703 );
704 
705 extern	void XkbHandleBell(
706        BOOL		/* force */,
707        BOOL		/* eventOnly */,
708        DeviceIntPtr	/* kbd */,
709        CARD8		/* percent */,
710        pointer 		/* ctrl */,
711        CARD8		/* class */,
712        Atom		/* name */,
713        WindowPtr	/* pWin */,
714        ClientPtr	/* pClient */
715 );
716 
717 extern	void XkbSendAccessXNotify(
718        DeviceIntPtr		/* kbd */,
719        xkbAccessXNotify *	/* pEv */
720 );
721 
722 extern	void XkbSendNamesNotify(
723        DeviceIntPtr	/* kbd */,
724        xkbNamesNotify *	/* ev */
725 );
726 
727 extern	void XkbSendCompatNotify(
728        DeviceIntPtr		/* kbd */,
729        xkbCompatMapNotify *	/* ev */
730 );
731 
732 extern	void XkbSendActionMessage(
733        DeviceIntPtr		/* kbd */,
734        xkbActionMessage *	/* ev */
735 );
736 
737 extern	void XkbSendExtensionDeviceNotify(
738        DeviceIntPtr			/* kbd */,
739        ClientPtr			/* client */,
740        xkbExtensionDeviceNotify *	/* ev */
741 );
742 
743 extern void XkbSendNotification(
744     DeviceIntPtr		/* kbd */,
745     XkbChangesPtr		/* pChanges */,
746     XkbEventCausePtr		/* cause */
747 );
748 
749 extern void XkbProcessKeyboardEvent(
750     struct _xEvent * 		/* xE */,
751     DeviceIntPtr		/* keybd */,
752     int 			/* count */
753 );
754 
755 extern void XkbProcessOtherEvent(
756     struct _xEvent * 		/* xE */,
757     DeviceIntPtr		/* keybd */,
758     int 			/* count */
759 );
760 
761 extern void XkbHandleActions(
762     DeviceIntPtr		/* dev */,
763     DeviceIntPtr		/* kbd */,
764     struct _xEvent * 		/* xE */,
765     int 			/* count */
766 );
767 
768 extern Bool XkbEnableDisableControls(
769     XkbSrvInfoPtr	/* xkbi */,
770     unsigned long	/* change */,
771     unsigned long	/* newValues */,
772     XkbChangesPtr	/* changes */,
773     XkbEventCausePtr	/* cause */
774 );
775 
776 extern void AccessXInit(
777     DeviceIntPtr        /* dev */
778 );
779 
780 extern Bool AccessXFilterPressEvent(
781     register struct _xEvent *	/* xE */,
782     register DeviceIntPtr	/* keybd */,
783     int				/* count */
784 );
785 
786 extern Bool AccessXFilterReleaseEvent(
787     register struct _xEvent *	/* xE */,
788     register DeviceIntPtr	/* keybd */,
789     int				/* count */
790 );
791 
792 extern void AccessXCancelRepeatKey(
793     XkbSrvInfoPtr	/* xkbi */,
794     KeyCode		/* key */
795 );
796 
797 extern void AccessXComputeCurveFactor(
798     XkbSrvInfoPtr	/* xkbi */,
799     XkbControlsPtr	/* ctrls */
800 );
801 
802 extern	XkbDeviceLedInfoPtr	XkbAddDeviceLedInfo(
803 	XkbDeviceInfoPtr	/* devi */,
804 	unsigned int		/* ledClass */,
805 	unsigned int		/* ledId */
806 );
807 
808 extern	XkbDeviceInfoPtr	XkbAllocDeviceInfo(
809 	unsigned int		/* deviceSpec */,
810 	unsigned int		/* nButtons */,
811 	unsigned int		/* szLeds */
812 );
813 
814 extern	void XkbFreeDeviceInfo(
815 	XkbDeviceInfoPtr	/* devi */,
816 	unsigned int		/* which */,
817 	Bool			/* freeDevI */
818 );
819 
820 extern Status XkbResizeDeviceButtonActions(
821 	XkbDeviceInfoPtr        /* devi */,
822 	unsigned int            /* newTotal */
823 );
824 
825 extern	XkbInterestPtr XkbFindClientResource(
826        DevicePtr	/* inDev */,
827        ClientPtr	/* client */
828 );
829 
830 extern	XkbInterestPtr XkbAddClientResource(
831        DevicePtr	/* inDev */,
832        ClientPtr	/* client */,
833        XID		/* id */
834 );
835 
836 extern	int XkbRemoveClient(
837        DevicePtr	/* inDev */,
838        ClientPtr	/* client */
839 );
840 
841 extern	int XkbRemoveResourceClient(
842        DevicePtr	/* inDev */,
843        XID		/* id */
844 );
845 
846 extern int XkbDDXInitDevice(
847     DeviceIntPtr        /* dev */
848 );
849 
850 extern	int XkbDDXAccessXBeep(
851     DeviceIntPtr        /* dev */,
852     unsigned int	/* what */,
853     unsigned int	/* which */
854 );
855 
856 extern	void XkbDDXKeyClick(
857     DeviceIntPtr	/* dev */,
858     int			/* keycode */,
859     int			/* synthetic */
860 );
861 
862 extern 	int XkbDDXUsesSoftRepeat(
863     DeviceIntPtr	/* dev */
864 );
865 
866 extern	void XkbDDXKeybdCtrlProc(
867 	DeviceIntPtr	/* dev */,
868 	KeybdCtrl *	/* ctrl */
869 );
870 
871 extern void XkbDDXChangeControls(
872 	DeviceIntPtr	/* dev */,
873 	XkbControlsPtr 	/* old */,
874 	XkbControlsPtr 	/* new */
875 );
876 
877 extern void XkbDDXUpdateIndicators(
878 	DeviceIntPtr	/* keybd */,
879 	CARD32		/* newState */
880 );
881 
882 extern void XkbDDXUpdateDeviceIndicators(
883 	DeviceIntPtr		/* dev */,
884 	XkbSrvLedInfoPtr	/* sli */,
885 	CARD32			/* newState */
886 );
887 
888 extern void XkbDDXFakePointerButton(
889 	int 		/* event */,
890 	int		/* button */
891 );
892 
893 extern void XkbDDXFakePointerMotion(
894  	unsigned int	/* flags */,
895 	int		/* x */,
896 	int		/* y */
897 );
898 
899 extern void XkbDDXFakeDeviceButton(
900 	DeviceIntPtr	/* dev */,
901 	Bool		/* press */,
902 	int		/* button */
903 );
904 
905 extern int XkbDDXTerminateServer(
906 	DeviceIntPtr	/* dev */,
907 	KeyCode		/* key */,
908 	XkbAction *	/* act */
909 );
910 
911 extern int XkbDDXSwitchScreen(
912 	DeviceIntPtr	/* dev */,
913 	KeyCode		/* key */,
914 	XkbAction *	/* act */
915 );
916 
917 extern int XkbDDXPrivate(
918 	DeviceIntPtr	/* dev */,
919 	KeyCode		/* key */,
920 	XkbAction *	/* act */
921 );
922 
923 extern void XkbDisableComputedAutoRepeats(
924 	DeviceIntPtr 	/* pXDev */,
925 	unsigned int	/* key */
926 );
927 
928 extern void XkbSetRepeatKeys(
929 	DeviceIntPtr 	/* pXDev */,
930 	int		/* key */,
931 	int	 	/* onoff */
932 );
933 
934 extern	int XkbLatchModifiers(
935 	DeviceIntPtr 	/* pXDev */,
936 	CARD8 		/* mask */,
937 	CARD8 		/* latches */
938 );
939 
940 extern	int XkbLatchGroup(
941 	DeviceIntPtr  	/* pXDev */,
942 	int	  	/* group */
943 );
944 
945 extern	void XkbClearAllLatchesAndLocks(
946 	DeviceIntPtr		/* dev */,
947 	XkbSrvInfoPtr		/* xkbi */,
948 	Bool			/* genEv */,
949 	XkbEventCausePtr	/* cause */
950 );
951 
952 extern	void	XkbSetRulesDflts(
953 	char *			/* rulesFile */,
954 	char *			/* model */,
955 	char *			/* layout */,
956 	char *			/* variant */,
957 	char *			/* options */
958 );
959 
960 extern	void	XkbInitDevice(
961 	DeviceIntPtr 	/* pXDev */
962 );
963 
964 extern	Bool	XkbInitKeyboardDeviceStruct(
965 	DeviceIntPtr 		/* pXDev */,
966 	XkbComponentNamesPtr	/* pNames */,
967 	KeySymsPtr		/* pSyms */,
968 	CARD8 			/* pMods */[],
969 	BellProcPtr		/* bellProc */,
970 	KbdCtrlProcPtr		/* ctrlProc */
971 );
972 
973 extern	int SProcXkbDispatch(
974 	ClientPtr		/* client */
975 );
976 
977 extern XkbGeometryPtr XkbLookupNamedGeometry(
978 	DeviceIntPtr		/* dev */,
979 	Atom			/* name */,
980 	Bool *			/* shouldFree */
981 );
982 
983 extern char *	_XkbDupString(
984 	char *			/* str */
985 );
986 
987 extern void	XkbConvertCase(
988 	KeySym 			/* sym */,
989 	KeySym *		/* lower */,
990 	KeySym *		/* upper */
991 );
992 
993 extern	Status	 XkbChangeKeycodeRange(
994 	XkbDescPtr		/* xkb */,
995 	int 			/* minKC */,
996 	int 			/* maxKC */,
997 	XkbChangesPtr		/* changes */
998 );
999 
1000 extern int XkbFinishDeviceInit(
1001 	DeviceIntPtr		/* pXDev */
1002 );
1003 
1004 extern void XkbFreeSrvLedInfo(
1005 	XkbSrvLedInfoPtr	/* sli */
1006 );
1007 
1008 extern void XkbFreeInfo(
1009 	XkbSrvInfoPtr		/* xkbi */
1010 );
1011 
1012 extern Status XkbChangeTypesOfKey(
1013 	XkbDescPtr		/* xkb */,
1014 	int			/* key */,
1015 	int			/* nGroups */,
1016 	unsigned int		/* groups */,
1017 	int *			/* newTypesIn */,
1018 	XkbMapChangesPtr	/* changes */
1019 );
1020 
1021 extern XkbKeyTypePtr XkbAddKeyType(
1022 	XkbDescPtr		/* xkb */,
1023 	Atom			/* name */,
1024 	int			/* map_count */,
1025 	Bool			/* want_preserve */,
1026 	int			/* num_lvls */
1027 );
1028 
1029 extern Status XkbInitCanonicalKeyTypes(
1030 	XkbDescPtr		/* xkb */,
1031 	unsigned int		/* which */,
1032 	int			/* keypadVMod */
1033 );
1034 
1035 extern int XkbKeyTypesForCoreSymbols(
1036 	XkbDescPtr		/* xkb */,
1037 	int			/* map_width */,
1038 	KeySym *		/* core_syms */,
1039 	unsigned int		/* protected */,
1040 	int *			/* types_inout */,
1041 	KeySym *		/* xkb_syms_rtrn */
1042 );
1043 
1044 extern Bool XkbApplyCompatMapToKey(
1045 	XkbDescPtr		/* xkb */,
1046 	KeyCode			/* key */,
1047 	XkbChangesPtr		/* changes */
1048 );
1049 
1050 extern Bool XkbUpdateMapFromCore(
1051 	XkbDescPtr		/* xkb */,
1052 	KeyCode			/* first_key */,
1053 	int			/* num_keys */,
1054 	int			/* map_width */,
1055 	KeySym *		/* core_keysyms */,
1056 	XkbChangesPtr		/* changes */
1057 );
1058 
1059 extern void XkbFreeControls(
1060 	XkbDescPtr		/* xkb */,
1061 	unsigned int		/* which */,
1062 	Bool			/* freeMap */
1063 );
1064 
1065 extern void XkbFreeIndicatorMaps(
1066 	XkbDescPtr		/* xkb */
1067 );
1068 
1069 extern Bool XkbApplyVirtualModChanges(
1070 	XkbDescPtr		/* xkb */,
1071 	unsigned int		/* changed */,
1072 	XkbChangesPtr		/* changes */
1073 );
1074 
1075 extern Bool XkbUpdateActionVirtualMods(
1076 	XkbDescPtr		/* xkb */,
1077 	XkbAction *		/* act */,
1078 	unsigned int		/* changed */
1079 );
1080 
1081 extern void XkbUpdateKeyTypeVirtualMods(
1082 	XkbDescPtr		/* xkb */,
1083 	XkbKeyTypePtr		/* type */,
1084 	unsigned int		/* changed */,
1085 	XkbChangesPtr		/* changes */
1086 );
1087 
1088 extern void XkbSendNewKeyboardNotify(
1089 	DeviceIntPtr		/* kbd */,
1090 	xkbNewKeyboardNotify *	/* pNKN */
1091 );
1092 
1093 #ifdef XKBSRV_NEED_FILE_FUNCS
1094 
1095 #include <X11/extensions/XKMformat.h>
1096 #include <X11/extensions/XKBfile.h>
1097 #include <X11/extensions/XKBrules.h>
1098 
1099 #define	_XkbListKeymaps		0
1100 #define	_XkbListKeycodes	1
1101 #define	_XkbListTypes		2
1102 #define	_XkbListCompat		3
1103 #define	_XkbListSymbols		4
1104 #define	_XkbListGeometry	5
1105 #define	_XkbListNumComponents	6
1106 
1107 typedef struct _XkbSrvListInfo {
1108 	int		szPool;
1109 	int		nPool;
1110 	char *		pool;
1111 
1112 	int		maxRtrn;
1113 	int		nTotal;
1114 
1115 	char *		pattern[_XkbListNumComponents];
1116 	int		nFound[_XkbListNumComponents];
1117 } XkbSrvListInfoRec,*XkbSrvListInfoPtr;
1118 
1119 char *
1120 XkbGetRulesDflts(
1121 	XkbRF_VarDefsPtr	/* defs */
1122 );
1123 
1124 extern void	XkbSetRulesUsed(
1125 	XkbRF_VarDefsPtr	/* defs */
1126 );
1127 
1128 
1129 extern	Status	XkbDDXList(
1130 	DeviceIntPtr		/* dev */,
1131 	XkbSrvListInfoPtr	/* listing */,
1132 	ClientPtr		/* client */
1133 );
1134 
1135 extern	unsigned int XkbDDXLoadKeymapByNames(
1136 	DeviceIntPtr		/* keybd */,
1137 	XkbComponentNamesPtr	/* names */,
1138 	unsigned int		/* want */,
1139 	unsigned int		/* need */,
1140 	XkbFileInfoPtr		/* finfoRtrn */,
1141 	char *			/* keymapNameRtrn */,
1142 	int 			/* keymapNameRtrnLen */
1143 );
1144 
1145 extern	Bool XkbDDXNamesFromRules(
1146 	DeviceIntPtr		/* keybd */,
1147 	char *			/* rules */,
1148 	XkbRF_VarDefsPtr	/* defs */,
1149 	XkbComponentNamesPtr	/* names */
1150 );
1151 
1152 extern	FILE *XkbDDXOpenConfigFile(
1153 	char *	/* mapName */,
1154 	char *	/* fileNameRtrn */,
1155 	int	/* fileNameRtrnLen */
1156 );
1157 
1158 extern	Bool XkbDDXApplyConfig(
1159 	XPointer	/* cfg_in */,
1160 	XkbSrvInfoPtr	/* xkbi */
1161 );
1162 
1163 extern XPointer XkbDDXPreloadConfig(
1164 	char **			/* rulesFileRtrn */,
1165 	XkbRF_VarDefsPtr	/* defs */,
1166 	XkbComponentNamesPtr	/* names */,
1167 	DeviceIntPtr		/* dev */
1168 );
1169 
1170 extern	int _XkbStrCaseCmp(
1171 	char *			/* str1 */,
1172 	char *			/* str2 */
1173 );
1174 
1175 #endif /* XKBSRV_NEED_FILE_FUNCS */
1176 
1177 
1178 _XFUNCPROTOEND
1179 
1180 #define	XkbAtomGetString(d,s)	NameForAtom(s)
1181 
1182 #endif /* _XKBSRV_H_ */
1183 
1184 
1185