⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispatch.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 5 页
字号:
    register GC *pGC;    REQUEST(xSetClipRectanglesReq);    REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);    if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&	(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))    {	client->errorValue = stuff->ordering;        return BadValue;    }    SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess);		     nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);    if (nr & 4)	return(BadLength);    nr >>= 3;    result = SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,			  nr, (xRectangle *)&stuff[1], (int)stuff->ordering);    if (client->noClientException != Success)        return(client->noClientException);    else        return(result);}intProcFreeGC(client)    register ClientPtr client;{    register GC *pGC;    REQUEST(xResourceReq);    REQUEST_SIZE_MATCH(xResourceReq);    SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess);    FreeResource(stuff->id, RT_NONE);    return(client->noClientException);}intProcClearToBackground(client)    register ClientPtr client;{    REQUEST(xClearAreaReq);    register WindowPtr pWin;    REQUEST_SIZE_MATCH(xClearAreaReq);    pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,					   SecurityWriteAccess);    if (!pWin)        return(BadWindow);    if (pWin->drawable.class == InputOnly)    {	client->errorValue = stuff->window;	return (BadMatch);    }		        if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))    {	client->errorValue = stuff->exposures;        return(BadValue);    }    (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,			       stuff->width, stuff->height,			       (Bool)stuff->exposures);    return(client->noClientException);}intProcCopyArea(client)    register ClientPtr client;{    register DrawablePtr pDst;    register DrawablePtr pSrc;    register GC *pGC;    REQUEST(xCopyAreaReq);    RegionPtr pRgn;    REQUEST_SIZE_MATCH(xCopyAreaReq);    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);     if (stuff->dstDrawable != stuff->srcDrawable)    {	SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,				 SecurityReadAccess);	if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))	{	    client->errorValue = stuff->dstDrawable;	    return (BadMatch);	}    }    else        pSrc = pDst;    SET_DBE_SRCBUF(pSrc, stuff->srcDrawable);    pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY,				 stuff->width, stuff->height, 				 stuff->dstX, stuff->dstY);    if (pGC->graphicsExposures)    {	(*pDst->pScreen->SendGraphicsExpose) 		(client, pRgn, stuff->dstDrawable, X_CopyArea, 0);	if (pRgn)	    REGION_DESTROY(pDst->pScreen, pRgn);    }    return(client->noClientException);}intProcCopyPlane(client)    register ClientPtr client;{    register DrawablePtr psrcDraw, pdstDraw;    register GC *pGC;    REQUEST(xCopyPlaneReq);    RegionPtr pRgn;    REQUEST_SIZE_MATCH(xCopyPlaneReq);    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);    if (stuff->dstDrawable != stuff->srcDrawable)    {	SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,				 SecurityReadAccess);	if (pdstDraw->pScreen != psrcDraw->pScreen)	{	    client->errorValue = stuff->dstDrawable;	    return (BadMatch);	}    }    else        psrcDraw = pdstDraw;    SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable);    /* Check to see if stuff->bitPlane has exactly ONE good bit set */    if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||       (stuff->bitPlane > (1L << (psrcDraw->depth - 1))))    {       client->errorValue = stuff->bitPlane;       return(BadValue);    }    pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY,				 stuff->width, stuff->height, 				 stuff->dstX, stuff->dstY, stuff->bitPlane);    if (pGC->graphicsExposures)    {	(*pdstDraw->pScreen->SendGraphicsExpose) 		(client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);	if (pRgn)	    REGION_DESTROY(pdstDraw->pScreen, pRgn);    }    return(client->noClientException);}intProcPolyPoint(client)    register ClientPtr client;{    int npoint;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyPointReq);    REQUEST_AT_LEAST_SIZE(xPolyPointReq);    if ((stuff->coordMode != CoordModeOrigin) && 	(stuff->coordMode != CoordModePrevious))    {	client->errorValue = stuff->coordMode;        return BadValue;    }    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);     npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;    if (npoint)        (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,			  (xPoint *) &stuff[1]);    return (client->noClientException);}intProcPolyLine(client)    register ClientPtr client;{    int npoint;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyLineReq);    REQUEST_AT_LEAST_SIZE(xPolyLineReq);    if ((stuff->coordMode != CoordModeOrigin) && 	(stuff->coordMode != CoordModePrevious))    {	client->errorValue = stuff->coordMode;        return BadValue;    }    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;    if (npoint > 1)	(*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint, 			      (DDXPointPtr) &stuff[1]);    return(client->noClientException);}intProcPolySegment(client)    register ClientPtr client;{    int nsegs;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolySegmentReq);    REQUEST_AT_LEAST_SIZE(xPolySegmentReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);    if (nsegs & 4)	return(BadLength);    nsegs >>= 3;    if (nsegs)        (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);    return (client->noClientException);}intProcPolyRectangle (client)    register ClientPtr client;{    int nrects;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyRectangleReq);    REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);    if (nrects & 4)	return(BadLength);    nrects >>= 3;    if (nrects)        (*pGC->ops->PolyRectangle)(pDraw, pGC, 		    nrects, (xRectangle *) &stuff[1]);    return(client->noClientException);}intProcPolyArc(client)    register ClientPtr client;{    int		narcs;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyArcReq);    REQUEST_AT_LEAST_SIZE(xPolyArcReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    narcs = (client->req_len << 2) - sizeof(xPolyArcReq);    if (narcs % sizeof(xArc))	return(BadLength);    narcs /= sizeof(xArc);    if (narcs)        (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);    return (client->noClientException);}intProcFillPoly(client)    register ClientPtr client;{    int          things;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xFillPolyReq);    REQUEST_AT_LEAST_SIZE(xFillPolyReq);    if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&  	(stuff->shape != Convex))    {	client->errorValue = stuff->shape;        return BadValue;    }    if ((stuff->coordMode != CoordModeOrigin) && 	(stuff->coordMode != CoordModePrevious))    {	client->errorValue = stuff->coordMode;        return BadValue;    }    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;    if (things)        (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,			 stuff->coordMode, things,			 (DDXPointPtr) &stuff[1]);    return(client->noClientException);}intProcPolyFillRectangle(client)    register ClientPtr client;{    int             things;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyFillRectangleReq);    REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);    if (things & 4)	return(BadLength);    things >>= 3;    if (things)        (*pGC->ops->PolyFillRect) (pDraw, pGC, things,		      (xRectangle *) &stuff[1]);    return (client->noClientException);}intProcPolyFillArc(client)    register ClientPtr client;{    int		narcs;    register GC *pGC;    register DrawablePtr pDraw;    REQUEST(xPolyFillArcReq);    REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);    if (narcs % sizeof(xArc))	return(BadLength);    narcs /= sizeof(xArc);    if (narcs)        (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);    return (client->noClientException);}/* 64-bit server notes: the protocol restricts padding of images to * 8-, 16-, or 32-bits. We would like to have 64-bits for the server * to use internally. Removes need for internal alignment checking. * All of the PutImage functions could be changed individually, but * as currently written, they call other routines which require things * to be 64-bit padded on scanlines, so we changed things here. * If an image would be padded differently for 64- versus 32-, then * copy each scanline to a 64-bit padded scanline. * Also, we need to make sure that the image is aligned on a 64-bit * boundary, even if the scanlines are padded to our satisfaction. */intProcPutImage(client)    register ClientPtr client;{    register	GC *pGC;    register	DrawablePtr pDraw;    long	length; 	/* length of scanline server padded */    long 	lengthProto; 	/* length of scanline protocol padded */    char	*tmpImage;    REQUEST(xPutImageReq);    REQUEST_AT_LEAST_SIZE(xPutImageReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    if (stuff->format == XYBitmap)    {        if ((stuff->depth != 1) ||	    (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))            return BadMatch;        length 	    = BitmapBytePad(stuff->width + stuff->leftPad);#ifdef INTERNAL_VS_EXTERNAL_PADDING        lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);#endif    }    else if (stuff->format == XYPixmap)    {        if ((pDraw->depth != stuff->depth) || 	    (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))            return BadMatch;        length      = BitmapBytePad(stuff->width + stuff->leftPad);	length      *= stuff->depth;#ifdef INTERNAL_VS_EXTERNAL_PADDING        lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);	lengthProto *= stuff->depth;#endif    }    else if (stuff->format == ZPixmap)    {        if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))            return BadMatch;        length      = PixmapBytePad(stuff->width, stuff->depth);#ifdef INTERNAL_VS_EXTERNAL_PADDING        lengthProto = PixmapBytePadProto(stuff->width, stuff->depth);#endif    }    else    {	client->errorValue = stuff->format;        return BadValue;    }#ifdef INTERNAL_VS_EXTERNAL_PADDING    /* handle 64 bit case where protocol may pad to 32 and we want 64 */    if ( length != lengthProto ) {	register int 	i;	char 		* stuffptr, /* pointer into protocol data */			* tmpptr;   /* new location to copy to */        if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))            return (BadAlloc);    	bzero(tmpImage,length*stuff->height);    	if ( stuff->format == XYPixmap ) {	    int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad);	    int lineBytesProto = 		BitmapBytePadProto(stuff->width + stuff->leftPad);	    int depth = stuff->depth;	    stuffptr = (char *)&stuff[1];	    tmpptr = tmpImage;	    for ( i = 0; i < stuff->height*stuff->depth;	        stuffptr += lineBytesProto,tmpptr += lineBytes, i++) 	        memmove(tmpptr,stuffptr,lineBytesProto);	}	else {	    for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage;	        i < stuff->height;	        stuffptr += lengthProto,tmpptr += length, i++) 	        memmove(tmpptr,stuffptr,lengthProto);	}    }    /* handle 64-bit case where stuff is not 64-bit aligned */    else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) {        if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))            return (BadAlloc);	memmove(tmpImage,(char *)&stuff[1],length*stuff->height);    }    else	tmpImage = (char *)&stuff[1];#else    tmpImage = (char *)&stuff[1];    lengthProto = length;#endif /* INTERNAL_VS_EXTERNAL_PADDING */	    if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) + 	(sizeof(xPutImageReq) >> 2)) != client->req_len)	return BadLength;    (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,		  stuff->width, stuff->height, 		  stuff->leftPad, stuff->format, tmpImage);#ifdef INTERNAL_VS_EXTERNAL_PADDING    /* free up our temporary space if used */    if (tmpImage != (char *)&stuff[1])        DEALLOCATE_LOCAL(tmpImage);#endif /* INTERNAL_VS_EXTERNAL_PADDING */     return (client->noClientException);}intDoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)    register ClientPtr	client;    Drawable drawable;    int format;    int x, y, width, height;    Mask planemask;    xGetImageReply **im_return;{    register DrawablePtr pDraw;    int			nlines, linesPerBuf;    register int	linesDone;    long		widthBytesLine, length;#ifdef INTERNAL_VS_EXTERNAL_PADDING    long		widthBytesLineProto, lengthProto;#endif    Mask		plane;    char		*pBuf;    xGetImageReply	xgi;    RegionPtr pVisibleRegion = NULL;    if ((format != XYPixmap) && (format != ZPixmap))    {	client->errorValue = format;        return(BadValue);    }    SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess);    if(pDraw->type == DRAWABLE_WINDOW)    {      if( /* check for being viewable */	 !((WindowPtr) pDraw)->realized ||	  /* check for being on screen */         pDraw->x + x < 0 || 	 pDraw->x + x + width > pDraw->pScreen->width ||         pDraw->y + y < 0 ||         pDraw->y + y + height > pDraw->pScreen->height ||          /* check for being inside of border */         x < - wBorderWidth((WindowPtr)pDraw) ||

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -