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

📄 miexpose.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
	pe->u.expose.count = i;    }    DeliverEvents(pWin, pEvent, numRects, NullWindow);    DEALLOCATE_LOCAL(pEvent);}void miWindowExposures(pWin, prgn, other_exposed)    WindowPtr pWin;    register RegionPtr prgn, other_exposed;{    RegionPtr   exposures = prgn;    if (pWin->backStorage && prgn)	/*	 * in some cases, backing store will cause a different	 * region to be exposed than needs to be repainted	 * (like when a window is mapped).  RestoreAreas is	 * allowed to return a region other than prgn,	 * in which case this routine will free the resultant	 * region.  If exposures is null, then no events will	 * be sent to the client; if prgn is empty	 * no areas will be repainted.	 */	exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn);    if ((prgn && !REGION_NIL(prgn)) || 	(exposures && !REGION_NIL(exposures)) || other_exposed)    {	RegionRec   expRec;	int	    clientInterested;	/*	 * Restore from backing-store FIRST.	 */	clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask;	if (other_exposed)	{	    if (exposures)	    {		REGION_UNION(pWin->drawable.pScreen, other_exposed,						  exposures,					          other_exposed);		if (exposures != prgn)		    REGION_DESTROY(pWin->drawable.pScreen, exposures);	    }	    exposures = other_exposed;	}	if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT))	{	    /*	     * If we have LOTS of rectangles, we decide to take the extents	     * and force an exposure on that.  This should require much less	     * work overall, on both client and server.  This is cheating, but	     * isn't prohibited by the protocol ("spontaneous combustion" :-).	     */	    BoxRec box;	    box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures);	    if (exposures == prgn) {		exposures = &expRec;		REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1);		REGION_RESET( pWin->drawable.pScreen, prgn, &box);	    } else {		REGION_RESET( pWin->drawable.pScreen, exposures, &box);		REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures);	    }	    /* PaintWindowBackground doesn't clip, so we have to */	    REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList);	    /* need to clear out new areas of backing store, too */	    if (pWin->backStorage)		(void) (* pWin->drawable.pScreen->ClearBackingStore)(					     pWin,					     box.x1 - pWin->drawable.x,					     box.y1 - pWin->drawable.y,					     box.x2 - box.x1,					     box.y2 - box.y1,					     FALSE);	}	if (prgn && !REGION_NIL(prgn))	    (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND);	if (clientInterested && exposures && !REGION_NIL(exposures))	    miSendExposures(pWin, exposures,			    pWin->drawable.x, pWin->drawable.y);	if (exposures == &expRec)	{	    REGION_UNINIT( pWin->drawable.pScreen, exposures);	}	else if (exposures && exposures != prgn && exposures != other_exposed)	    REGION_DESTROY( pWin->drawable.pScreen, exposures);	if (prgn)	    REGION_EMPTY( pWin->drawable.pScreen, prgn);    }    else if (exposures && exposures != prgn)	REGION_DESTROY( pWin->drawable.pScreen, exposures);}/*    this code is highly unlikely.  it is not haile selassie.    there is some hair here.  we can't just use the window'sclip region as it is, because if we are painting the border,the border is not in the client area and so we will be excludedwhen we validate the GC, and if we are painting a parent-relativebackground, the area we want to paint is in some other window.since we trust the code calling us to tell us to paint only areasthat are really ours, we will temporarily give the window aclipList the size of the whole screen and an origin at (0,0).this more or less assumes that ddX code will do translationbased on the window's absolute position, and that ValidateGC willlook at clipList, and that no other fields from thewindow will be used.  it's not possible to just drawin the root because it may be a different depth.to get the tile to align correctly we set the GC's tile origin tobe the (x,y) of the window's upper left corner, after which weget the right bits when drawing into the root.because the clip_mask is being set to None, we may call DoChangeGC withfPointer set true, thus we no longer need to install the background orborder tile in the resource table.*/static RESTYPE ResType = 0;static int numGCs = 0;static GCPtr	screenContext[MAXSCREENS];/*ARGSUSED*/static inttossGC (value, id)pointer value;XID id;{    GCPtr pGC = (GCPtr)value;    screenContext[pGC->pScreen->myNum] = (GCPtr)NULL;    FreeGC (pGC, id);    numGCs--;    if (!numGCs)	ResType = 0;    return 0;}voidmiPaintWindow(pWin, prgn, what)register WindowPtr pWin;RegionPtr prgn;int what;{    int	status;    Bool usingScratchGC = FALSE;    WindowPtr pRoot;	#define FUNCTION	0#define FOREGROUND	1#define TILE		2#define FILLSTYLE	3#define ABSX		4#define ABSY		5#define CLIPMASK	6#define SUBWINDOW	7#define COUNT_BITS	8    ChangeGCVal gcval[7];    ChangeGCVal newValues [COUNT_BITS];    BITS32 gcmask, index, mask;    RegionRec prgnWin;    DDXPointRec oldCorner;    BoxRec box;    WindowPtr	pBgWin;    GCPtr pGC;    register int i;    register BoxPtr pbox;    register ScreenPtr pScreen = pWin->drawable.pScreen;    register xRectangle *prect;    int numRects;    gcmask = 0;    if (what == PW_BACKGROUND)    {	switch (pWin->backgroundState) {	case None:	    return;	case ParentRelative:	    (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what);	    return;	case BackgroundPixel:	    newValues[FOREGROUND].val = pWin->background.pixel;	    newValues[FILLSTYLE].val  = FillSolid;	    gcmask |= GCForeground | GCFillStyle;	    break;	case BackgroundPixmap:	    newValues[TILE].ptr = (pointer)pWin->background.pixmap;	    newValues[FILLSTYLE].val = FillTiled;	    gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;	    break;	}    }    else    {	if (pWin->borderIsPixel)	{	    newValues[FOREGROUND].val = pWin->border.pixel;	    newValues[FILLSTYLE].val  = FillSolid;	    gcmask |= GCForeground | GCFillStyle;	}	else	{	    newValues[TILE].ptr = (pointer)pWin->border.pixmap;	    newValues[FILLSTYLE].val = FillTiled;	    gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;	}    }    prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *					 sizeof(xRectangle));    if (!prect)	return;    newValues[FUNCTION].val = GXcopy;    gcmask |= GCFunction | GCClipMask;    i = pScreen->myNum;    pRoot = WindowTable[i];    pBgWin = pWin;    if (what == PW_BORDER)    {	while (pBgWin->backgroundState == ParentRelative)	    pBgWin = pBgWin->parent;    }    if ((pWin->drawable.depth != pRoot->drawable.depth) ||	(pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel))    {	usingScratchGC = TRUE;	pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);	if (!pGC)	{	    DEALLOCATE_LOCAL(prect);	    return;	}	/*	 * mash the clip list so we can paint the border by	 * mangling the window in place, pretending it	 * spans the entire screen	 */	if (what == PW_BORDER)	{	    prgnWin = pWin->clipList;	    oldCorner.x = pWin->drawable.x;	    oldCorner.y = pWin->drawable.y;	    pWin->drawable.x = pWin->drawable.y = 0;	    box.x1 = 0;	    box.y1 = 0;	    box.x2 = pScreen->width;	    box.y2 = pScreen->height;	    REGION_INIT(pScreen, &pWin->clipList, &box, 1);	    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;	    newValues[ABSX].val = pBgWin->drawable.x;	    newValues[ABSY].val = pBgWin->drawable.y;	}	else	{	    newValues[ABSX].val = 0;	    newValues[ABSY].val = 0;	}    } else {	/*	 * draw the background to the root window	 */	if (screenContext[i] == (GCPtr)NULL)	{	    if (!ResType && !(ResType = CreateNewResourceType(tossGC)))		return;	    screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0,					(XID *)NULL, &status);	    if (!screenContext[i])		return;	    numGCs++;	    if (!AddResource(FakeClientID(0), ResType,			     (pointer)screenContext[i]))	        return;	}	pGC = screenContext[i];	newValues[SUBWINDOW].val = IncludeInferiors;	newValues[ABSX].val = pBgWin->drawable.x;	newValues[ABSY].val = pBgWin->drawable.y;	gcmask |= GCSubwindowMode;	pWin = pRoot;    }        if (pWin->backStorage)	(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);    mask = gcmask;    gcmask = 0;    i = 0;    while (mask) {    	index = lowbit (mask);	mask &= ~index;	switch (index) {	case GCFunction:	    if (pGC->alu != newValues[FUNCTION].val) {		gcmask |= index;		gcval[i++].val = newValues[FUNCTION].val;	    }	    break;	case GCTileStipXOrigin:	    if ( pGC->patOrg.x != newValues[ABSX].val) {		gcmask |= index;		gcval[i++].val = newValues[ABSX].val;	    }	    break;	case GCTileStipYOrigin:	    if ( pGC->patOrg.y != newValues[ABSY].val) {		gcmask |= index;		gcval[i++].val = newValues[ABSY].val;	    }	    break;	case GCClipMask:	    if ( pGC->clientClipType != CT_NONE) {		gcmask |= index;		gcval[i++].val = CT_NONE;	    }	    break;	case GCSubwindowMode:	    if ( pGC->subWindowMode != newValues[SUBWINDOW].val) {		gcmask |= index;		gcval[i++].val = newValues[SUBWINDOW].val;	    }	    break;	case GCTile:	    if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) 	    {		gcmask |= index;		gcval[i++].ptr = newValues[TILE].ptr;	    }	    break;	case GCFillStyle:	    if ( pGC->fillStyle != newValues[FILLSTYLE].val) {		gcmask |= index;		gcval[i++].val = newValues[FILLSTYLE].val;	    }	    break;	case GCForeground:	    if ( pGC->fgPixel != newValues[FOREGROUND].val) {		gcmask |= index;		gcval[i++].val = newValues[FOREGROUND].val;	    }	    break;	}    }    if (gcmask)        dixChangeGC(NullClient, pGC, gcmask, NULL, gcval);    if (pWin->drawable.serialNumber != pGC->serialNumber)	ValidateGC((DrawablePtr)pWin, pGC);    numRects = REGION_NUM_RECTS(prgn);    pbox = REGION_RECTS(prgn);    for (i= numRects; --i >= 0; pbox++, prect++)    {	prect->x = pbox->x1 - pWin->drawable.x;	prect->y = pbox->y1 - pWin->drawable.y;	prect->width = pbox->x2 - pbox->x1;	prect->height = pbox->y2 - pbox->y1;    }    prect -= numRects;    (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);    DEALLOCATE_LOCAL(prect);    if (pWin->backStorage)	(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);    if (usingScratchGC)    {	if (what == PW_BORDER)	{	    REGION_UNINIT(pScreen, &pWin->clipList);	    pWin->clipList = prgnWin;	    pWin->drawable.x = oldCorner.x;	    pWin->drawable.y = oldCorner.y;	    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;	}	FreeScratchGC(pGC);    }}/* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC.  Useful when we have a scratch drawable and need to initialize  * it. */miClearDrawable(pDraw, pGC)    DrawablePtr	pDraw;    GCPtr	pGC;{    XID fg = pGC->fgPixel;    XID bg = pGC->bgPixel;    xRectangle rect;    rect.x = 0;    rect.y = 0;    rect.width = pDraw->width;    rect.height = pDraw->height;    DoChangeGC(pGC, GCForeground, &bg, 0);    ValidateGC(pDraw, pGC);    (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);    DoChangeGC(pGC, GCForeground, &fg, 0);    ValidateGC(pDraw, pGC);}

⌨️ 快捷键说明

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