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

📄 mbufbf.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 3 页
字号:
		pMBPriv->frameBuffer[number];	}	switch (ppMBWindow[i]->updateAction)	{	case MultibufferUpdateActionUndefined:	    break;	case MultibufferUpdateActionBackground:	    (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)		(pPrevMBBuffer, 0,0, 0,0, FALSE);	    break;	case MultibufferUpdateActionUntouched:	    break;	case MultibufferUpdateActionCopied:	    if (pPrevBuffer != pNewBuffer)	    {		(* pMBPriv->CopyBufferBits) (ppMBWindow[i],			ppMBBuffer[i]->number, pPrevMBBuffer->number);	    }	    break;	}    }}/* Updates the backBuffer region and paints the selectPlane. */static voidbufPostValidateTree(pParent, pChild, kind)    WindowPtr	pParent, pChild;    VTKind	kind;{    ScreenPtr pScreen;    mbufBufferPrivPtr pMBPriv;    if (pParent)	pScreen = pParent->drawable.pScreen;    else if (pChild)	pScreen = pChild->drawable.pScreen;    else	return; /* Hopeless */    pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);    if (pScreen->PostValidateTree)	(* pScreen->PostValidateTree)(pParent, pChild, kind);    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);    /* Does backBuffer need to change? */    if (pMBPriv->rgnChanged)    {	RegionRec exposed;	RegionPtr pSubtractRgn, pUnionRgn;	Bool overlap;	pMBPriv->rgnChanged = FALSE;	pSubtractRgn = &pMBPriv->subtractRgn;	pUnionRgn    = &pMBPriv->unionRgn;	REGION_VALIDATE(pScreen, pSubtractRgn, &overlap);#ifdef DEBUG	if (overlap)	    FatalError("bufPostValidateTree: subtractRgn overlaps");#endif	REGION_VALIDATE(pScreen, pUnionRgn, &overlap);#ifdef DEBUG	if (overlap)	    FatalError("bufPostValidateTree: unionRgn overlaps");#endif	/* Update backBuffer: subtract must come before union */	REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,			      pSubtractRgn);	REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,			      pUnionRgn);	/* Paint gained and lost backbuffer areas in select plane */	REGION_INIT(pScreen, &exposed, NullBox, 0);	REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn);	(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,				     &exposed, FRONT_BUFFER);	REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn);	(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,				    &exposed, BACK_BUFFER);		REGION_UNINIT(pScreen, &exposed);	REGION_EMPTY(pScreen, pSubtractRgn);	REGION_EMPTY(pScreen, pUnionRgn);    }}/* XXX - Knows region internals. */static BoolRegionsEqual(reg1, reg2)    RegionPtr reg1;    RegionPtr reg2;{    int i;    BoxPtr rects1, rects2;    if (reg1->extents.x1 != reg2->extents.x1) return FALSE;    if (reg1->extents.x2 != reg2->extents.x2) return FALSE;    if (reg1->extents.y1 != reg2->extents.y1) return FALSE;    if (reg1->extents.y2 != reg2->extents.y2) return FALSE;    if (REGION_NUM_RECTS(reg1) != REGION_NUM_RECTS(reg2)) return FALSE;        rects1 = REGION_RECTS(reg1);    rects2 = REGION_RECTS(reg2);    for (i = 0; i != REGION_NUM_RECTS(reg1); i++) {	if (rects1[i].x1 != rects2[i].x1) return FALSE;	if (rects1[i].x2 != rects2[i].x2) return FALSE;	if (rects1[i].y1 != rects2[i].y1) return FALSE;	if (rects1[i].y2 != rects2[i].y2) return FALSE;    }    return TRUE;}/* * If the window is multibuffered and displaying the backbuffer, * add the old clipList to the subtractRgn and add the new clipList * to the unionRgn. PostValidateTree will use subtractRgn and unionRgn * to update the backBuffer region and the selectPlane. * * Copy changes to the window structure into the buffers. * Send ClobberNotify events. */static voidbufClipNotify(pWin, dx,dy)    WindowPtr pWin;    int       dx,dy;{    ScreenPtr pScreen = pWin->drawable.pScreen;    mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    mbufWindowPtr	pMBWindow;    int i;    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);    if (pScreen->ClipNotify)	(* pScreen->ClipNotify)(pWin, dx,dy);    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);    if (pMBWindow = MB_WINDOW_PRIV(pWin))    {	RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr;	if (! RegionsEqual(pOldClipList, &pWin->clipList))	{	    if (pMBWindow->displayedMultibuffer == BACK_BUFFER)	    {		pMBPriv->rgnChanged = TRUE;		REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList);		REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList);	    }	    REGION_COPY(pScreen, pOldClipList,&pWin->clipList);	}	/* Update buffer x,y,w,h, and clipList */	for (i=0; i<pMBWindow->numMultibuffer; i++)	{	    mbufBufferPtr pMBBuffer = pMBWindow->buffers + i;	    if (pMBBuffer->clobber != pWin->visibility)	    {		pMBBuffer->clobber = pWin->visibility;		MultibufferClobber(pMBBuffer);	    }	    UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin);	}    }}/* * Updates buffer's background fields when the window's changes. * This is necessary because pScreen->PaintWindowBackground * is used to paint the buffer. * * XXBS - Backingstore state will have be tracked too if it is supported. */static BoolbufChangeWindowAttributes(pWin, mask)    WindowPtr pWin;    unsigned long mask;{    ScreenPtr pScreen = pWin->drawable.pScreen;    mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    mbufWindowPtr pMBWindow;    Bool ret;    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);    ret = (* pScreen->ChangeWindowAttributes)(pWin, mask);    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);    if (pMBWindow = MB_WINDOW_PRIV(pWin))    {	if (mask & (CWBackPixmap | CWBackPixel))	{	    BufferPtr pBuffer;	    int i;	    for (i=0; i<pMBWindow->displayedMultibuffer; i++)	    {		pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable;		pBuffer->backgroundState = pWin->backgroundState;		pBuffer->background = pWin->background;	    }	}    }    return ret;}/* * Send exposures and clear the background for a buffer whenever * its corresponding window is exposed, except when called by * ClearToBackground. */static void bufWindowExposures(pWin, prgn, other_exposed)    WindowPtr pWin;    register RegionPtr prgn, other_exposed;{    ScreenPtr pScreen = pWin->drawable.pScreen;    mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);    mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    RegionRec tmp_rgn;    int i;    Bool handleBuffers;    handleBuffers = (!pMBPriv->inClearToBackground) &&	(pWin->drawable.type == DRAWABLE_WINDOW) &&	pMBWindow && (prgn && !REGION_NIL(prgn));    /* miWindowExposures munges prgn and other_exposed. */    if (handleBuffers)    {	REGION_INIT(pScreen, &tmp_rgn, NullBox, 0);	REGION_COPY(pScreen, &tmp_rgn,prgn);    }    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);    (* pScreen->WindowExposures) (pWin, prgn, other_exposed);    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);    if (!handleBuffers)	return;    /*     * Send expose events to all clients. Paint the exposed region for all     * buffers except the displayed buffer since it is handled when the     * window is painted.     *     * XXBS - Will have to be re-written to handle BackingStore on buffers.     */    for (i=0; i<pMBWindow->numMultibuffer; i++)    {	mbufBufferPtr pMBBuffer;	BufferPtr pBuffer;	pMBBuffer = pMBWindow->buffers + i;	pBuffer = (BufferPtr) pMBBuffer->pDrawable;	if (i != pMBWindow->displayedMultibuffer)	    (* pScreen->PaintWindowBackground)(pBuffer,&tmp_rgn,PW_BACKGROUND);	if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask)	    MultibufferExpose(pMBBuffer, &tmp_rgn);    }    REGION_UNINIT(pScreen, &tmp_rgn);}/* * Set ``inClearToBackground'' so that WindowExposures does not attempt * to send expose events or clear the background on the buffers. */static voidbufClearToBackground(pWin, x,y,w,h, sendExpose)    WindowPtr pWin;    int x,y, w,h;    Bool sendExpose;{    ScreenPtr pScreen = pWin->drawable.pScreen;    mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    pMBPriv->inClearToBackground = TRUE;    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);    (* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose);    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);    pMBPriv->inClearToBackground = FALSE;}/* * Move bits in both buffers. It does this by calling pScreen->CopyWindow * twice, once with the root window's devPrivate[frameWindowPrivateIndex] * pointing to the frontbuffer pixmap and once with it pointed to the * backbuffer pixmap. It does this if there are *any* existing multibuffered * window... a possible optimization is to copy the backbuffer only if this * window or its inferiors are multibuffered. May be faster, maybe not. * * XXX - Only works if your CopyWindow checks the root window's devPrivate *       to see which buffer to draw into. Works for cfbPaintWindow. *//*ARGSUSED*/static void bufCopyWindow(pWin, ptOldOrg, prgnSrc)    WindowPtr pWin;    DDXPointRec ptOldOrg;    RegionPtr prgnSrc;{    ScreenPtr pScreen = pWin->drawable.pScreen;    mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);    WindowPtr pwinroot;    DevUnion save;    UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);    pwinroot = WindowTable[pScreen->myNum];    save = pwinroot->devPrivates[frameWindowPrivateIndex];    /*     * Copy front buffer     */    pwinroot->devPrivates[frameWindowPrivateIndex] =	pMBPriv->frameBuffer[FRONT_BUFFER];    (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);    /*     * Copy back buffer     */    /* CopyWindow translates prgnSrc... translate it back for 2nd call. */    REGION_TRANSLATE(pScreen, prgnSrc,				  ptOldOrg.x - pWin->drawable.x,				  ptOldOrg.y - pWin->drawable.y);    pwinroot->devPrivates[frameWindowPrivateIndex] =	pMBPriv->frameBuffer[BACK_BUFFER];    (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);    pwinroot->devPrivates[frameWindowPrivateIndex] = save;    REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);}

⌨️ 快捷键说明

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