3 * Copyright (c) 1995, 1996 The XFree86 Project, Inc
6 /* THIS IS NOT AN X CONSORTIUM STANDARD */
8 #ifdef HAVE_XORG_CONFIG_H
9 #include <xorg-config.h>
15 #include <X11/Xproto.h>
17 #include "dixstruct.h"
18 #include "extnsionst.h"
19 #include "scrnintstr.h"
22 #define _XF86MISC_SERVER_
23 #undef _XF86MISC_SAVER_COMPAT_
24 #include <X11/extensions/xf86mscstr.h>
27 #include <X11/Xfuncproto.h>
28 #include "xf86miscproc.h"
31 #include <X11/Xtrans/Xtrans.h>
32 #include "../os/osdep.h"
33 #include <X11/Xauth.h>
36 #include <sys/socket.h>
43 static int miscErrorBase
;
44 static int MiscGeneration
= 0;
45 static int MiscClientPrivateIndex
;
47 /* This holds the client's version information */
51 } MiscPrivRec
, *MiscPrivPtr
;
53 #define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr)
55 static void XF86MiscResetProc(
56 ExtensionEntry
* /* extEntry */
60 ClientVersion(ClientPtr client
, int *major
, int *minor
)
64 pPriv
= MPRIV(client
);
66 if (major
) *major
= 0;
67 if (minor
) *minor
= 0;
71 if (major
) *major
= pPriv
->major
;
72 if (minor
) *minor
= pPriv
->minor
;
75 static DISPATCH_PROC(ProcXF86MiscDispatch
);
76 static DISPATCH_PROC(ProcXF86MiscQueryVersion
);
77 static DISPATCH_PROC(ProcXF86MiscGetKbdSettings
);
78 static DISPATCH_PROC(ProcXF86MiscGetMouseSettings
);
79 static DISPATCH_PROC(ProcXF86MiscSetKbdSettings
);
80 static DISPATCH_PROC(ProcXF86MiscSetMouseSettings
);
81 static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState
);
82 static DISPATCH_PROC(ProcXF86MiscSetClientVersion
);
83 static DISPATCH_PROC(ProcXF86MiscGetFilePaths
);
84 static DISPATCH_PROC(ProcXF86MiscPassMessage
);
85 #ifdef _XF86MISC_SAVER_COMPAT_
86 static DISPATCH_PROC(ProcXF86MiscGetSaver
);
87 static DISPATCH_PROC(ProcXF86MiscSetSaver
);
89 static DISPATCH_PROC(SProcXF86MiscDispatch
);
90 static DISPATCH_PROC(SProcXF86MiscQueryVersion
);
91 static DISPATCH_PROC(SProcXF86MiscGetKbdSettings
);
92 static DISPATCH_PROC(SProcXF86MiscGetMouseSettings
);
93 static DISPATCH_PROC(SProcXF86MiscSetKbdSettings
);
94 static DISPATCH_PROC(SProcXF86MiscSetMouseSettings
);
95 static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState
);
96 static DISPATCH_PROC(SProcXF86MiscSetClientVersion
);
97 static DISPATCH_PROC(SProcXF86MiscGetFilePaths
);
98 static DISPATCH_PROC(SProcXF86MiscPassMessage
);
99 #ifdef _XF86MISC_SAVER_COMPAT_
100 static DISPATCH_PROC(SProcXF86MiscGetSaver
);
101 static DISPATCH_PROC(SProcXF86MiscSetSaver
);
105 static unsigned char XF86MiscReqCode
= 0;
109 # define DEBUG_P(x) ErrorF(x"\n");
111 # define DEBUG_P(x) /**/
114 #define MISCERR(x) (miscErrorBase + x)
117 XFree86MiscExtensionInit(void)
119 ExtensionEntry
* extEntry
;
121 DEBUG_P("XFree86MiscExtensionInit");
123 if (!xf86GetModInDevEnabled())
127 * Allocate a client private index to hold the client's version
130 if (MiscGeneration
!= serverGeneration
) {
131 MiscClientPrivateIndex
= AllocateClientPrivateIndex();
133 * Allocate 0 length, and use the private to hold a pointer to our
136 if (!AllocateClientPrivate(MiscClientPrivateIndex
, 0)) {
137 ErrorF("XFree86MiscExtensionInit: "
138 "AllocateClientPrivate failed\n");
141 MiscGeneration
= serverGeneration
;
145 (extEntry
= AddExtension(XF86MISCNAME
,
146 XF86MiscNumberEvents
,
147 XF86MiscNumberErrors
,
148 ProcXF86MiscDispatch
,
149 SProcXF86MiscDispatch
,
151 StandardMinorOpcode
))) {
153 XF86MiscReqCode
= (unsigned char)extEntry
->base
;
155 miscErrorBase
= extEntry
->errorBase
;
161 XF86MiscResetProc (extEntry
)
162 ExtensionEntry
* extEntry
;
167 ProcXF86MiscQueryVersion(client
)
168 register ClientPtr client
;
170 xXF86MiscQueryVersionReply rep
;
173 DEBUG_P("XF86MiscQueryVersion");
175 REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq
);
178 rep
.sequenceNumber
= client
->sequence
;
179 rep
.majorVersion
= XF86MISC_MAJOR_VERSION
;
180 rep
.minorVersion
= XF86MISC_MINOR_VERSION
;
181 if (client
->swapped
) {
182 swaps(&rep
.sequenceNumber
, n
);
183 swapl(&rep
.length
, n
);
184 swaps(&rep
.majorVersion
, n
);
185 swaps(&rep
.minorVersion
, n
);
187 WriteToClient(client
, sizeof(xXF86MiscQueryVersionReply
), (char *)&rep
);
188 return (client
->noClientException
);
191 #ifdef _XF86MISC_SAVER_COMPAT_
192 /* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */
195 * This will go away, but remains for now for compatibility with older
199 ProcXF86MiscSetSaver(client
)
200 register ClientPtr client
;
202 REQUEST(xXF86MiscSetSaverReq
);
205 if (stuff
->screen
> screenInfo
.numScreens
)
208 vptr
= (ScrnInfoPtr
) screenInfo
.screens
[stuff
->screen
]->devPrivates
[xf86ScreenIndex
].ptr
;
210 REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq
);
212 if (stuff
->suspendTime
< 0)
214 if (stuff
->offTime
< 0)
217 return (client
->noClientException
);
221 * This will go away, but remains for now for compatibility with older
225 ProcXF86MiscGetSaver(client
)
226 register ClientPtr client
;
228 REQUEST(xXF86MiscGetSaverReq
);
229 xXF86MiscGetSaverReply rep
;
233 if (stuff
->screen
> screenInfo
.numScreens
)
236 vptr
= (ScrnInfoPtr
) screenInfo
.screens
[stuff
->screen
]->devPrivates
[xf86ScreenIndex
].ptr
;
238 REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq
);
241 rep
.sequenceNumber
= client
->sequence
;
245 if (client
->swapped
) {
246 swaps(&rep
.sequenceNumber
, n
);
247 swapl(&rep
.length
, n
);
248 swapl(&rep
.suspendTime
, n
);
249 swapl(&rep
.offTime
, n
);
251 WriteToClient(client
, SIZEOF(xXF86MiscGetSaverReply
), (char *)&rep
);
252 return (client
->noClientException
);
255 #endif /* _XF86MISC_SAVER_COMPAT_ */
258 ProcXF86MiscGetMouseSettings(client
)
259 register ClientPtr client
;
261 xXF86MiscGetMouseSettingsReply rep
;
266 DEBUG_P("XF86MiscGetMouseSettings");
268 REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq
);
270 rep
.sequenceNumber
= client
->sequence
;
272 if (!MiscExtGetMouseSettings(&mouse
, &devname
))
275 rep
.mousetype
= MiscExtGetMouseValue(mouse
, MISC_MSE_PROTO
);
276 rep
.baudrate
= MiscExtGetMouseValue(mouse
, MISC_MSE_BAUDRATE
);
277 rep
.samplerate
= MiscExtGetMouseValue(mouse
, MISC_MSE_SAMPLERATE
);
278 rep
.resolution
= MiscExtGetMouseValue(mouse
, MISC_MSE_RESOLUTION
);
279 rep
.buttons
= MiscExtGetMouseValue(mouse
, MISC_MSE_BUTTONS
);
280 rep
.emulate3buttons
= MiscExtGetMouseValue(mouse
, MISC_MSE_EM3BUTTONS
);
281 rep
.emulate3timeout
= MiscExtGetMouseValue(mouse
, MISC_MSE_EM3TIMEOUT
);
282 rep
.chordmiddle
= MiscExtGetMouseValue(mouse
, MISC_MSE_CHORDMIDDLE
);
283 rep
.flags
= MiscExtGetMouseValue(mouse
, MISC_MSE_FLAGS
);
284 rep
.devnamelen
= (devname
? strlen(devname
): 0);
285 rep
.length
= (sizeof(xXF86MiscGetMouseSettingsReply
) -
286 sizeof(xGenericReply
) + ((rep
.devnamelen
+3) & ~3)) >> 2;
288 if (client
->swapped
) {
289 swaps(&rep
.sequenceNumber
, n
);
290 swapl(&rep
.length
, n
);
291 swapl(&rep
.mousetype
, n
);
292 swapl(&rep
.baudrate
, n
);
293 swapl(&rep
.samplerate
, n
);
294 swapl(&rep
.resolution
, n
);
295 swapl(&rep
.buttons
, n
);
296 swapl(&rep
.emulate3buttons
, n
);
297 swapl(&rep
.emulate3timeout
, n
);
298 swapl(&rep
.chordmiddle
, n
);
299 swapl(&rep
.flags
, n
);
301 WriteToClient(client
, SIZEOF(xXF86MiscGetMouseSettingsReply
), (char *)&rep
);
302 MiscExtDestroyStruct(mouse
, MISC_POINTER
);
305 WriteToClient(client
, rep
.devnamelen
, devname
);
306 return (client
->noClientException
);
310 ProcXF86MiscGetKbdSettings(client
)
311 register ClientPtr client
;
313 xXF86MiscGetKbdSettingsReply rep
;
317 DEBUG_P("XF86MiscGetKbdSettings");
319 REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq
);
322 rep
.sequenceNumber
= client
->sequence
;
323 if (!MiscExtGetKbdSettings(&kbd
))
326 rep
.kbdtype
= MiscExtGetKbdValue(kbd
, MISC_KBD_TYPE
);
327 rep
.rate
= MiscExtGetKbdValue(kbd
, MISC_KBD_RATE
);
328 rep
.delay
= MiscExtGetKbdValue(kbd
, MISC_KBD_DELAY
);
329 rep
.servnumlock
= MiscExtGetKbdValue(kbd
, MISC_KBD_SERVNUMLOCK
);
330 if (client
->swapped
) {
331 swaps(&rep
.sequenceNumber
, n
);
332 swapl(&rep
.length
, n
);
333 swapl(&rep
.kbdtype
, n
);
335 swapl(&rep
.delay
, n
);
337 WriteToClient(client
, SIZEOF(xXF86MiscGetKbdSettingsReply
), (char *)&rep
);
338 return (client
->noClientException
);
342 ProcXF86MiscSetMouseSettings(client
)
343 register ClientPtr client
;
347 char *devname
= NULL
;
350 REQUEST(xXF86MiscSetMouseSettingsReq
);
352 DEBUG_P("XF86MiscSetMouseSettings");
354 REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq
);
356 ClientVersion(client
, &major
, &minor
);
358 if (xf86GetVerbosity() > 1) {
359 ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
360 (int)stuff
->mousetype
, (int)stuff
->baudrate
,
361 (int)stuff
->samplerate
, stuff
->chordmiddle
);
362 ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n",
363 stuff
->emulate3buttons
, (int)stuff
->emulate3timeout
,
364 (int)stuff
->resolution
, (unsigned long)stuff
->flags
);
367 if ((mouse
= MiscExtCreateStruct(MISC_POINTER
)) == (pointer
) 0)
370 MiscExtSetMouseValue(mouse
, MISC_MSE_PROTO
, stuff
->mousetype
);
371 MiscExtSetMouseValue(mouse
, MISC_MSE_BAUDRATE
, stuff
->baudrate
);
372 MiscExtSetMouseValue(mouse
, MISC_MSE_SAMPLERATE
, stuff
->samplerate
);
373 MiscExtSetMouseValue(mouse
, MISC_MSE_RESOLUTION
, stuff
->resolution
);
374 MiscExtSetMouseValue(mouse
, MISC_MSE_BUTTONS
, stuff
->buttons
);
375 MiscExtSetMouseValue(mouse
, MISC_MSE_EM3BUTTONS
, stuff
->emulate3buttons
);
376 MiscExtSetMouseValue(mouse
, MISC_MSE_EM3TIMEOUT
, stuff
->emulate3timeout
);
377 MiscExtSetMouseValue(mouse
, MISC_MSE_CHORDMIDDLE
, stuff
->chordmiddle
);
378 MiscExtSetMouseValue(mouse
, MISC_MSE_FLAGS
, stuff
->flags
);
380 if ((major
> 0 || minor
> 5) && stuff
->devnamelen
) {
381 int size
= sizeof(xXF86MiscSetMouseSettingsReq
) + stuff
->devnamelen
;
382 size
= (size
+ 3) >> 2;
383 if (client
->req_len
< size
)
385 if (stuff
->devnamelen
) {
386 if (!(devname
= xalloc(stuff
->devnamelen
)))
388 strncpy(devname
,(char*)(&stuff
[1]),stuff
->devnamelen
);
389 if (xf86GetVerbosity() > 1)
390 ErrorF("SetMouseSettings - device: %s\n",devname
);
391 MiscExtSetMouseDevice(mouse
, devname
);
395 ret
= MiscExtApply(mouse
, MISC_POINTER
);
401 case MISC_RET_SUCCESS
: break;
402 case MISC_RET_BADVAL
: return BadValue
;
403 case MISC_RET_BADMSEPROTO
: return MISCERR(XF86MiscBadMouseProtocol
);
404 case MISC_RET_BADBAUDRATE
: return MISCERR(XF86MiscBadMouseBaudRate
);
405 case MISC_RET_BADFLAGS
: return MISCERR(XF86MiscBadMouseFlags
);
406 case MISC_RET_BADCOMBO
: return MISCERR(XF86MiscBadMouseCombo
);
407 case MISC_RET_NOMODULE
: return MISCERR(XF86MiscNoModule
);
409 ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret
);
410 return BadImplementation
;
413 if (xf86GetVerbosity() > 1)
414 ErrorF("SetMouseSettings - Succeeded\n");
415 return (client
->noClientException
);
419 ProcXF86MiscSetKbdSettings(client
)
420 register ClientPtr client
;
424 REQUEST(xXF86MiscSetKbdSettingsReq
);
426 DEBUG_P("XF86MiscSetKbdSettings");
428 REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq
);
430 if (xf86GetVerbosity() > 1)
431 ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
432 (int)stuff
->kbdtype
, (int)stuff
->rate
,
433 (int)stuff
->delay
, stuff
->servnumlock
);
435 if ((kbd
= MiscExtCreateStruct(MISC_KEYBOARD
)) == (pointer
) 0)
438 MiscExtSetKbdValue(kbd
, MISC_KBD_TYPE
, stuff
->kbdtype
);
439 MiscExtSetKbdValue(kbd
, MISC_KBD_RATE
, stuff
->rate
);
440 MiscExtSetKbdValue(kbd
, MISC_KBD_DELAY
, stuff
->delay
);
441 MiscExtSetKbdValue(kbd
, MISC_KBD_SERVNUMLOCK
, stuff
->servnumlock
);
443 switch ((ret
= MiscExtApply(kbd
, MISC_KEYBOARD
))) {
444 case MISC_RET_SUCCESS
: break;
445 case MISC_RET_BADVAL
: return BadValue
;
446 case MISC_RET_BADKBDTYPE
: return MISCERR(XF86MiscBadKbdType
);
448 ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret
);
449 return BadImplementation
;
452 if (xf86GetVerbosity() > 1)
453 ErrorF("SetKbdSettings - Succeeded\n");
454 return (client
->noClientException
);
458 ProcXF86MiscSetGrabKeysState(client
)
459 register ClientPtr client
;
462 xXF86MiscSetGrabKeysStateReply rep
;
463 REQUEST(xXF86MiscSetGrabKeysStateReq
);
465 DEBUG_P("XF86MiscSetGrabKeysState");
467 REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq
);
469 if ((status
= MiscExtSetGrabKeysState(client
, stuff
->enable
)) == 0) {
470 if (xf86GetVerbosity() > 1)
471 ErrorF("SetGrabKeysState - %s\n",
472 stuff
->enable
? "enabled" : "disabled");
477 rep
.sequenceNumber
= client
->sequence
;
479 if (client
->swapped
) {
480 swaps(&rep
.sequenceNumber
, n
);
481 swapl(&rep
.length
, n
);
482 swapl(&rep
.status
, n
);
484 WriteToClient(client
, SIZEOF(xXF86MiscSetGrabKeysStateReply
), (char *)&rep
);
486 return (client
->noClientException
);
490 ProcXF86MiscSetClientVersion(ClientPtr client
)
492 REQUEST(xXF86MiscSetClientVersionReq
);
496 DEBUG_P("XF86MiscSetClientVersion");
498 REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq
);
500 if ((pPriv
= MPRIV(client
)) == NULL
) {
501 pPriv
= xalloc(sizeof(MiscPrivRec
));
504 MPRIV(client
) = pPriv
;
506 if (xf86GetVerbosity() > 1)
507 ErrorF("SetClientVersion: %i %i\n",stuff
->major
,stuff
->minor
);
508 pPriv
->major
= stuff
->major
;
509 pPriv
->minor
= stuff
->minor
;
511 return (client
->noClientException
);
515 ProcXF86MiscGetFilePaths(client
)
516 register ClientPtr client
;
518 xXF86MiscGetFilePathsReply rep
;
519 const char *configfile
;
520 const char *modulepath
;
524 DEBUG_P("XF86MiscGetFilePaths");
526 REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq
);
528 rep
.sequenceNumber
= client
->sequence
;
530 if (!MiscExtGetFilePaths(&configfile
, &modulepath
, &logfile
))
533 rep
.configlen
= (configfile
? strlen(configfile
): 0);
534 rep
.modulelen
= (modulepath
? strlen(modulepath
): 0);
535 rep
.loglen
= (logfile
? strlen(logfile
): 0);
536 rep
.length
= (SIZEOF(xXF86MiscGetFilePathsReply
) - SIZEOF(xGenericReply
) +
537 ((rep
.configlen
+ 3) & ~3) +
538 ((rep
.modulelen
+ 3) & ~3) +
539 ((rep
.loglen
+ 3) & ~3) ) >> 2;
541 if (client
->swapped
) {
542 swaps(&rep
.sequenceNumber
, n
);
543 swapl(&rep
.length
, n
);
544 swaps(&rep
.configlen
, n
);
545 swaps(&rep
.modulelen
, n
);
546 swaps(&rep
.loglen
, n
);
548 WriteToClient(client
, SIZEOF(xXF86MiscGetFilePathsReply
), (char *)&rep
);
551 WriteToClient(client
, rep
.configlen
, (char *)configfile
);
553 WriteToClient(client
, rep
.modulelen
, (char *)modulepath
);
555 WriteToClient(client
, rep
.loglen
, (char *)logfile
);
557 return (client
->noClientException
);
561 ProcXF86MiscPassMessage(client
)
562 register ClientPtr client
;
564 xXF86MiscPassMessageReply rep
;
565 char *msgtype
, *msgval
, *retstr
;
569 REQUEST(xXF86MiscPassMessageReq
);
571 DEBUG_P("XF86MiscPassMessage");
573 REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq
);
574 size
= (sizeof(xXF86MiscPassMessageReq
) + 3) >> 2;
575 size
+= (stuff
->typelen
+ 3) >> 2;
576 size
+= (stuff
->vallen
+ 3) >> 2;
577 if (client
->req_len
< size
)
579 if (stuff
->typelen
) {
580 if (!(msgtype
= xalloc(stuff
->typelen
)))
582 strncpy(msgtype
,(char*)(&stuff
[1]),stuff
->typelen
);
583 } else return BadValue
;
585 if (!(msgval
= xalloc(stuff
->vallen
))) {
589 strncpy(msgval
,(char*)((char*)&stuff
[1] + ((stuff
->typelen
+ 3) & ~3)),
596 if ((retval
= MiscExtPassMessage(stuff
->screen
,msgtype
,msgval
,&retstr
)) != 0) {
603 rep
.sequenceNumber
= client
->sequence
;
604 rep
.mesglen
= (retstr
? strlen(retstr
): 0);
605 rep
.length
= (SIZEOF(xXF86MiscPassMessageReply
) - SIZEOF(xGenericReply
) +
606 ((rep
.mesglen
+ 3) & ~3)) >> 2;
609 if (client
->swapped
) {
610 swaps(&rep
.sequenceNumber
, n
);
611 swapl(&rep
.length
, n
);
612 swaps(&rep
.mesglen
, n
);
614 WriteToClient(client
, SIZEOF(xXF86MiscPassMessageReply
), (char *)&rep
);
617 WriteToClient(client
, rep
.mesglen
, (char *)retstr
);
622 return (client
->noClientException
);
626 ProcXF86MiscDispatch (client
)
627 register ClientPtr client
;
632 case X_XF86MiscQueryVersion
:
633 return ProcXF86MiscQueryVersion(client
);
634 #ifdef _XF86MISC_SAVER_COMPAT_
635 case X_XF86MiscGetSaver
:
636 return ProcXF86MiscGetSaver(client
);
637 case X_XF86MiscSetSaver
:
638 return ProcXF86MiscSetSaver(client
);
640 case X_XF86MiscGetMouseSettings
:
641 return ProcXF86MiscGetMouseSettings(client
);
642 case X_XF86MiscGetKbdSettings
:
643 return ProcXF86MiscGetKbdSettings(client
);
644 case X_XF86MiscSetClientVersion
:
645 return ProcXF86MiscSetClientVersion(client
);
646 case X_XF86MiscGetFilePaths
:
647 return ProcXF86MiscGetFilePaths(client
);
648 case X_XF86MiscPassMessage
:
649 return ProcXF86MiscPassMessage(client
);
651 if (!xf86GetModInDevEnabled())
652 return miscErrorBase
+ XF86MiscModInDevDisabled
;
653 if (xf86GetModInDevAllowNonLocal() || LocalClient (client
)) {
654 switch (stuff
->data
) {
655 case X_XF86MiscSetMouseSettings
:
656 return ProcXF86MiscSetMouseSettings(client
);
657 case X_XF86MiscSetKbdSettings
:
658 return ProcXF86MiscSetKbdSettings(client
);
659 case X_XF86MiscSetGrabKeysState
:
660 return ProcXF86MiscSetGrabKeysState(client
);
665 return miscErrorBase
+ XF86MiscModInDevClientNotLocal
;
670 SProcXF86MiscQueryVersion(client
)
671 register ClientPtr client
;
674 REQUEST(xXF86MiscQueryVersionReq
);
675 swaps(&stuff
->length
, n
);
676 return ProcXF86MiscQueryVersion(client
);
679 #ifdef _XF86MISC_SAVER_COMPAT_
681 SProcXF86MiscGetSaver(client
)
685 REQUEST(xXF86MiscGetSaverReq
);
686 swaps(&stuff
->length
, n
);
687 REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq
);
688 swaps(&stuff
->screen
, n
);
689 return ProcXF86MiscGetSaver(client
);
693 SProcXF86MiscSetSaver(client
)
697 REQUEST(xXF86MiscSetSaverReq
);
698 swaps(&stuff
->length
, n
);
699 REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq
);
700 swaps(&stuff
->screen
, n
);
701 swapl(&stuff
->suspendTime
, n
);
702 swapl(&stuff
->offTime
, n
);
703 return ProcXF86MiscSetSaver(client
);
705 #endif /* _XF86MISC_SAVER_COMPAT_ */
708 SProcXF86MiscGetMouseSettings(client
)
712 REQUEST(xXF86MiscGetMouseSettingsReq
);
713 swaps(&stuff
->length
, n
);
714 REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq
);
715 return ProcXF86MiscGetMouseSettings(client
);
719 SProcXF86MiscGetKbdSettings(client
)
723 REQUEST(xXF86MiscGetKbdSettingsReq
);
724 swaps(&stuff
->length
, n
);
725 REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq
);
726 return ProcXF86MiscGetKbdSettings(client
);
730 SProcXF86MiscSetMouseSettings(client
)
734 REQUEST(xXF86MiscSetMouseSettingsReq
);
735 swaps(&stuff
->length
, n
);
736 REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq
);
737 swapl(&stuff
->mousetype
, n
);
738 swapl(&stuff
->baudrate
, n
);
739 swapl(&stuff
->samplerate
, n
);
740 swapl(&stuff
->resolution
, n
);
741 swapl(&stuff
->buttons
, n
);
742 swapl(&stuff
->emulate3timeout
, n
);
743 swapl(&stuff
->flags
, n
);
744 return ProcXF86MiscSetMouseSettings(client
);
748 SProcXF86MiscSetKbdSettings(client
)
752 REQUEST(xXF86MiscSetKbdSettingsReq
);
753 swaps(&stuff
->length
, n
);
754 REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq
);
755 swapl(&stuff
->kbdtype
, n
);
756 swapl(&stuff
->rate
, n
);
757 swapl(&stuff
->delay
, n
);
758 return ProcXF86MiscSetKbdSettings(client
);
762 SProcXF86MiscSetGrabKeysState(client
)
766 REQUEST(xXF86MiscSetGrabKeysStateReq
);
767 swaps(&stuff
->length
, n
);
768 REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq
);
769 swaps(&stuff
->enable
, n
);
770 return ProcXF86MiscSetGrabKeysState(client
);
774 SProcXF86MiscSetClientVersion(ClientPtr client
)
777 REQUEST(xXF86MiscSetClientVersionReq
);
778 swaps(&stuff
->length
, n
);
779 REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq
);
780 swaps(&stuff
->major
, n
);
781 swaps(&stuff
->minor
, n
);
782 return ProcXF86MiscSetClientVersion(client
);
786 SProcXF86MiscGetFilePaths(client
)
790 REQUEST(xXF86MiscGetFilePathsReq
);
791 swaps(&stuff
->length
, n
);
792 REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq
);
793 return ProcXF86MiscGetFilePaths(client
);
797 SProcXF86MiscPassMessage(client
)
801 REQUEST(xXF86MiscPassMessageReq
);
802 swaps(&stuff
->length
, n
);
803 REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq
);
804 return ProcXF86MiscPassMessage(client
);
808 SProcXF86MiscDispatch (client
)
809 register ClientPtr client
;
814 case X_XF86MiscQueryVersion
:
815 return SProcXF86MiscQueryVersion(client
);
816 #ifdef _XF86MISC_SAVER_COMPAT_
817 case X_XF86MiscGetSaver
:
818 return SProcXF86MiscGetSaver(client
);
819 case X_XF86MiscSetSaver
:
820 return SProcXF86MiscSetSaver(client
);
822 case X_XF86MiscGetMouseSettings
:
823 return SProcXF86MiscGetMouseSettings(client
);
824 case X_XF86MiscGetKbdSettings
:
825 return SProcXF86MiscGetKbdSettings(client
);
826 case X_XF86MiscSetClientVersion
:
827 return SProcXF86MiscSetClientVersion(client
);
828 case X_XF86MiscGetFilePaths
:
829 return SProcXF86MiscGetFilePaths(client
);
830 case X_XF86MiscPassMessage
:
831 return SProcXF86MiscPassMessage(client
);
833 if (!xf86GetModInDevEnabled())
834 return miscErrorBase
+ XF86MiscModInDevDisabled
;
835 if (xf86GetModInDevAllowNonLocal() || LocalClient (client
)) {
836 switch (stuff
->data
) {
837 case X_XF86MiscSetMouseSettings
:
838 return SProcXF86MiscSetMouseSettings(client
);
839 case X_XF86MiscSetKbdSettings
:
840 return SProcXF86MiscSetKbdSettings(client
);
841 case X_XF86MiscSetGrabKeysState
:
842 return SProcXF86MiscSetGrabKeysState(client
);
847 return miscErrorBase
+ XF86MiscModInDevClientNotLocal
;