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

📄 dispatch.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 5 页
字号:
         x + width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||         y < -wBorderWidth((WindowPtr)pDraw) ||         y + height > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height        )	    return(BadMatch);	xgi.visual = wVisual (((WindowPtr) pDraw));    }    else    {      if(x < 0 ||         x+width > (int)pDraw->width ||         y < 0 ||         y+height > (int)pDraw->height        )	    return(BadMatch);	xgi.visual = None;    }    SET_DBE_SRCBUF(pDraw, drawable);    xgi.type = X_Reply;    xgi.sequenceNumber = client->sequence;    xgi.depth = pDraw->depth;    if(format == ZPixmap)    {	widthBytesLine = PixmapBytePad(width, pDraw->depth);	length = widthBytesLine * height;#ifdef INTERNAL_VS_EXTERNAL_PADDING	widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth);	lengthProto 	    = widthBytesLineProto * height;#endif    }    else     {	widthBytesLine = BitmapBytePad(width);	plane = ((Mask)1) << (pDraw->depth - 1);	/* only planes asked for */	length = widthBytesLine * height *		 Ones(planemask & (plane | (plane - 1)));#ifdef INTERNAL_VS_EXTERNAL_PADDING	widthBytesLineProto = BitmapBytePadProto(width);	lengthProto = widthBytesLineProto * height *		 Ones(planemask & (plane | (plane - 1)));#endif    }#ifdef INTERNAL_VS_EXTERNAL_PADDING    xgi.length = lengthProto;#else    xgi.length = length;#endif    if (im_return) {	pBuf = (char *)xalloc(sz_xGetImageReply + length);	if (!pBuf)	    return (BadAlloc);	if (widthBytesLine == 0)	    linesPerBuf = 0;	else	    linesPerBuf = height;	*im_return = (xGetImageReply *)pBuf;	*(xGetImageReply *)pBuf = xgi;	pBuf += sz_xGetImageReply;    } else {	xgi.length = (xgi.length + 3) >> 2;	if (widthBytesLine == 0 || height == 0)	    linesPerBuf = 0;	else if (widthBytesLine >= IMAGE_BUFSIZE)	    linesPerBuf = 1;	else	{	    linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;	    if (linesPerBuf > height)		linesPerBuf = height;	}	length = linesPerBuf * widthBytesLine;	if (linesPerBuf < height)	{	    /* we have to make sure intermediate buffers don't need padding */	    while ((linesPerBuf > 1) &&		   (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)))	    {		linesPerBuf--;		length -= widthBytesLine;	    }	    while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))	    {		linesPerBuf++;		length += widthBytesLine;	    }	}	if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))	    return (BadAlloc);	WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);    }#ifdef XCSECURITY    if (client->trustLevel != XSecurityClientTrusted &&	pDraw->type == DRAWABLE_WINDOW)    {	pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);	if (pVisibleRegion)	{	    REGION_TRANSLATE(pScreen, pVisibleRegion, -pDraw->x, -pDraw->y);	}    }#endif    if (linesPerBuf == 0)    {	/* nothing to do */    }    else if (format == ZPixmap)    {        linesDone = 0;        while (height - linesDone > 0)        {	    nlines = min(linesPerBuf, height - linesDone);	    (*pDraw->pScreen->GetImage) (pDraw,	                                 x,				         y + linesDone,				         width, 				         nlines,				         format,				         planemask,				         (pointer) pBuf);#ifdef XCSECURITY	    if (pVisibleRegion)		SecurityCensorImage(client, pVisibleRegion, widthBytesLine,			pDraw, x, y + linesDone, width, 			nlines, format, pBuf);#endif#ifdef INTERNAL_VS_EXTERNAL_PADDING	    /* for 64-bit server, convert image to pad to 32 bits */	    if ( widthBytesLine != widthBytesLineProto ) {		register char * bufPtr, * protoPtr;		register int i;		for (i = 1,		     bufPtr = pBuf + widthBytesLine,		     protoPtr = pBuf + widthBytesLineProto;		     i < nlines;		     bufPtr += widthBytesLine,		     protoPtr += widthBytesLineProto, 		     i++)		    memmove(protoPtr, bufPtr, widthBytesLineProto);	    }#endif	    /* Note that this is NOT a call to WriteSwappedDataToClient,               as we do NOT byte swap */	    if (!im_return)/* Don't split me, gcc pukes when you do */#ifdef INTERNAL_VS_EXTERNAL_PADDING		(void)WriteToClient(client,				    (int)(nlines * widthBytesLineProto),				    pBuf);#else		(void)WriteToClient(client,				    (int)(nlines * widthBytesLine),				    pBuf);#endif	    linesDone += nlines;        }    }    else /* XYPixmap */    {        for (; plane; plane >>= 1)	{	    if (planemask & plane)	    {	        linesDone = 0;	        while (height - linesDone > 0)	        {		    nlines = min(linesPerBuf, height - linesDone);	            (*pDraw->pScreen->GetImage) (pDraw,	                                         x,				                 y + linesDone,				                 width, 				                 nlines,				                 format,				                 plane,				                 (pointer)pBuf);#ifdef XCSECURITY		    if (pVisibleRegion)			SecurityCensorImage(client, pVisibleRegion,				widthBytesLine,				pDraw, x, y + linesDone, width, 				nlines, format, pBuf);#endif#ifdef INTERNAL_VS_EXTERNAL_PADDING	    	    /* for 64-bit server, convert image to pad to 32 bits */	    	    if ( widthBytesLine != widthBytesLineProto ) {			register char * bufPtr, * protoPtr;			register int i;			for (i = 1,			     bufPtr = pBuf + widthBytesLine,			     protoPtr = pBuf + widthBytesLineProto;			     i < nlines;			     bufPtr += widthBytesLine,			     protoPtr += widthBytesLineProto,			     i++)		    	    memmove(protoPtr, bufPtr, widthBytesLineProto);	    	    }#endif		    /* Note: NOT a call to WriteSwappedDataToClient,		       as we do NOT byte swap */		    if (im_return) {#ifdef INTERNAL_VS_EXTERNAL_PADDING			pBuf += nlines * widthBytesLineProto;#else			pBuf += nlines * widthBytesLine;#endif		    } else/* Don't split me, gcc pukes when you do */#ifdef INTERNAL_VS_EXTERNAL_PADDING			(void)WriteToClient(client,					(int)(nlines * widthBytesLineProto),					pBuf);#else			(void)WriteToClient(client,					(int)(nlines * widthBytesLine),					pBuf);#endif		    linesDone += nlines;		}            }	}    }#ifdef XCSECURITY    if (pVisibleRegion)	REGION_DESTROY(pScreen, pVisibleRegion);#endif    if (!im_return)	DEALLOCATE_LOCAL(pBuf);    return (client->noClientException);}intProcGetImage(client)    register ClientPtr	client;{    REQUEST(xGetImageReq);    REQUEST_SIZE_MATCH(xGetImageReq);    return DoGetImage(client, stuff->format, stuff->drawable,		      stuff->x, stuff->y,		      (int)stuff->width, (int)stuff->height,		      stuff->planeMask, (xGetImageReply **)NULL);}intProcPolyText(client)    register ClientPtr client;{    int	err;    REQUEST(xPolyTextReq);    DrawablePtr pDraw;    GC *pGC;    REQUEST_AT_LEAST_SIZE(xPolyTextReq);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    err = PolyText(client,		   pDraw,		   pGC,		   (unsigned char *)&stuff[1],		   ((unsigned char *) stuff) + (client->req_len << 2),		   stuff->x,		   stuff->y,		   stuff->reqType,		   stuff->drawable);    if (err == Success)    {	return(client->noClientException);    }    else	return err;}intProcImageText8(client)    register ClientPtr client;{    int	err;    register DrawablePtr pDraw;    register GC *pGC;    REQUEST(xImageTextReq);    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    err = ImageText(client,		    pDraw,		    pGC,		    stuff->nChars,		    (unsigned char *)&stuff[1],		    stuff->x,		    stuff->y,		    stuff->reqType,		    stuff->drawable);    if (err == Success)    {	return(client->noClientException);    }    else	return err;}intProcImageText16(client)    register ClientPtr client;{    int	err;    register DrawablePtr pDraw;    register GC *pGC;    REQUEST(xImageTextReq);    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);    err = ImageText(client,		    pDraw,		    pGC,		    stuff->nChars,		    (unsigned char *)&stuff[1],		    stuff->x,		    stuff->y,		    stuff->reqType,		    stuff->drawable);    if (err == Success)    {	return(client->noClientException);    }    else	return err;}intProcCreateColormap(client)    register ClientPtr client;{    VisualPtr	pVisual;    ColormapPtr	pmap;    Colormap	mid;    register WindowPtr   pWin;    ScreenPtr pScreen;    REQUEST(xCreateColormapReq);    int i, result;    REQUEST_SIZE_MATCH(xCreateColormapReq);    if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll))    {	client->errorValue = stuff->alloc;        return(BadValue);    }    mid = stuff->mid;    LEGAL_NEW_RESOURCE(mid, client);    pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,					   SecurityReadAccess);    if (!pWin)        return(BadWindow);    pScreen = pWin->drawable.pScreen;    for (i = 0, pVisual = pScreen->visuals;	 i < pScreen->numVisuals;	 i++, pVisual++)    {	if (pVisual->vid != stuff->visual)	    continue;	result =  CreateColormap(mid, pScreen, pVisual, &pmap,				 (int)stuff->alloc, client->index);	if (client->noClientException != Success)	    return(client->noClientException);	else	    return(result);    }    client->errorValue = stuff->visual;    return(BadValue);}intProcFreeColormap(client)    register ClientPtr client;{    ColormapPtr pmap;    REQUEST(xResourceReq);    REQUEST_SIZE_MATCH(xResourceReq);    pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP,						SecurityDestroyAccess);    if (pmap)     {	/* Freeing a default colormap is a no-op */	if (!(pmap->flags & IsDefault))	    FreeResource(stuff->id, RT_NONE);	return (client->noClientException);    }    else     {	client->errorValue = stuff->id;	return (BadColor);    }}intProcCopyColormapAndFree(client)    register ClientPtr client;{    Colormap	mid;    ColormapPtr	pSrcMap;    REQUEST(xCopyColormapAndFreeReq);    int result;    REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);    mid = stuff->mid;    LEGAL_NEW_RESOURCE(mid, client);    if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client,	stuff->srcCmap,		RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) )    {	result = CopyColormapAndFree(mid, pSrcMap, client->index);	if (client->noClientException != Success)            return(client->noClientException);	else            return(result);    }    else    {	client->errorValue = stuff->srcCmap;	return(BadColor);    }}intProcInstallColormap(client)    register ClientPtr client;{    ColormapPtr pcmp;    REQUEST(xResourceReq);    REQUEST_SIZE_MATCH(xResourceReq);    pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,					    RT_COLORMAP, SecurityReadAccess);    if (pcmp)    {        (*(pcmp->pScreen->InstallColormap)) (pcmp);        return (client->noClientException);            }    else    {        client->errorValue = stuff->id;        return (BadColor);    }}intProcUninstallColormap(client)    register ClientPtr client;{    ColormapPtr pcmp;    REQUEST(xResourceReq);    REQUEST_SIZE_MATCH(xResourceReq);    pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,					RT_COLORMAP, SecurityReadAccess);    if (pcmp)    {	if(pcmp->mid != pcmp->pScreen->defColormap)            (*(pcmp->pScreen->UninstallColormap)) (pcmp);        return (client->noClientException);            }    else    {        client->errorValue = stuff->id;        return (BadColor);    }}intProcListInstalledColormaps(client)    register ClientPtr client;{    xListInstalledColormapsReply *preply;     int nummaps

⌨️ 快捷键说明

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