diff options
Diffstat (limited to 'hw/xfree86/dixmods/extmod/xf86misc.c')
-rw-r--r-- | hw/xfree86/dixmods/extmod/xf86misc.c | 93 |
1 files changed, 82 insertions, 11 deletions
diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c index bc8e94b45..620761742 100644 --- a/hw/xfree86/dixmods/extmod/xf86misc.c +++ b/hw/xfree86/dixmods/extmod/xf86misc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.37 2002/11/20 04:04:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.41 2003/11/17 22:20:27 dawes Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc @@ -54,9 +54,7 @@ typedef struct { #define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr) static void XF86MiscResetProc( -#if NeedFunctionPrototypes ExtensionEntry* /* extEntry */ -#endif ); static void @@ -84,6 +82,7 @@ static DISPATCH_PROC(ProcXF86MiscSetMouseSettings); static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState); static DISPATCH_PROC(ProcXF86MiscSetClientVersion); static DISPATCH_PROC(ProcXF86MiscGetFilePaths); +static DISPATCH_PROC(ProcXF86MiscPassMessage); #ifdef _XF86MISC_SAVER_COMPAT_ static DISPATCH_PROC(ProcXF86MiscGetSaver); static DISPATCH_PROC(ProcXF86MiscSetSaver); @@ -97,12 +96,15 @@ static DISPATCH_PROC(SProcXF86MiscSetMouseSettings); static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState); static DISPATCH_PROC(SProcXF86MiscSetClientVersion); static DISPATCH_PROC(SProcXF86MiscGetFilePaths); +static DISPATCH_PROC(SProcXF86MiscPassMessage); #ifdef _XF86MISC_SAVER_COMPAT_ static DISPATCH_PROC(SProcXF86MiscGetSaver); static DISPATCH_PROC(SProcXF86MiscSetSaver); #endif +#if 0 static unsigned char XF86MiscReqCode = 0; +#endif #ifdef DEBUG # define DEBUG_P(x) ErrorF(x"\n"); @@ -148,7 +150,9 @@ XFree86MiscExtensionInit(void) SProcXF86MiscDispatch, XF86MiscResetProc, StandardMinorOpcode))) { +#if 0 XF86MiscReqCode = (unsigned char)extEntry->base; +#endif miscErrorBase = extEntry->errorBase; } } @@ -354,14 +358,13 @@ ProcXF86MiscSetMouseSettings(client) if (xf86GetVerbosity() > 1) { ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n", - stuff->mousetype, stuff->baudrate, - stuff->samplerate, stuff->chordmiddle); - ErrorF(" em3but: %d em3tim: %d res: %d flags: %d\n", - stuff->emulate3buttons, stuff->emulate3timeout, - stuff->resolution, stuff->flags); + (int)stuff->mousetype, (int)stuff->baudrate, + (int)stuff->samplerate, stuff->chordmiddle); + ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n", + stuff->emulate3buttons, (int)stuff->emulate3timeout, + (int)stuff->resolution, (unsigned long)stuff->flags); } - if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0) return BadAlloc; @@ -427,8 +430,8 @@ ProcXF86MiscSetKbdSettings(client) if (xf86GetVerbosity() > 1) ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n", - stuff->kbdtype, stuff->rate, - stuff->delay, stuff->servnumlock); + (int)stuff->kbdtype, (int)stuff->rate, + (int)stuff->delay, stuff->servnumlock); if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0) return BadAlloc; @@ -555,6 +558,59 @@ ProcXF86MiscGetFilePaths(client) } static int +ProcXF86MiscPassMessage(client) + register ClientPtr client; +{ + xXF86MiscPassMessageReply rep; + char *msgtype, *msgval, *retstr; + int retval, size; + register int n; + + REQUEST(xXF86MiscPassMessageReq); + + DEBUG_P("XF86MiscPassMessage"); + + REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq); + size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2; + size+= (stuff->typelen + 3) >> 2; + size+= (stuff->vallen + 3) >> 2; + if (client->req_len < size) + return BadLength; + if (stuff->typelen) { + if (!(msgtype = xalloc(stuff->typelen))) + return BadAlloc; + strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen); + } else return BadValue; + if (stuff->vallen) { + if (!(msgval = xalloc(stuff->vallen))) + return BadAlloc; + strncpy(msgval,(char*)(&stuff[1] + ((stuff->typelen + 3) & ~3)), + stuff->vallen); + } else return BadValue; + + if ((retval= MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) + return retval; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.mesglen = (retstr? strlen(retstr): 0); + rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) + + ((rep.mesglen + 3) & ~3)) >> 2; + + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swaps(&rep.mesglen, n); + } + WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep); + + if (rep.mesglen) + WriteToClient(client, rep.mesglen, (char *)retstr); + + return (client->noClientException); +} + +static int ProcXF86MiscDispatch (client) register ClientPtr client; { @@ -577,6 +633,8 @@ ProcXF86MiscDispatch (client) return ProcXF86MiscSetClientVersion(client); case X_XF86MiscGetFilePaths: return ProcXF86MiscGetFilePaths(client); + case X_XF86MiscPassMessage: + return ProcXF86MiscPassMessage(client); default: if (!xf86GetModInDevEnabled()) return miscErrorBase + XF86MiscModInDevDisabled; @@ -724,6 +782,17 @@ SProcXF86MiscGetFilePaths(client) } static int +SProcXF86MiscPassMessage(client) + ClientPtr client; +{ + register int n; + REQUEST(xXF86MiscPassMessageReq); + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq); + return ProcXF86MiscPassMessage(client); +} + +static int SProcXF86MiscDispatch (client) register ClientPtr client; { @@ -746,6 +815,8 @@ SProcXF86MiscDispatch (client) return SProcXF86MiscSetClientVersion(client); case X_XF86MiscGetFilePaths: return SProcXF86MiscGetFilePaths(client); + case X_XF86MiscPassMessage: + return SProcXF86MiscPassMessage(client); default: if (!xf86GetModInDevEnabled()) return miscErrorBase + XF86MiscModInDevDisabled; |