📄 mivaltree.c
字号:
if ((pChild = pParent->firstChild) && pParent->mapped) { REGION_INIT(pScreen, &childUniverse, NullBox, 0); REGION_INIT(pScreen, &childUnion, NullBox, 0); if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } else { for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } REGION_VALIDATE( pScreen, &childUnion, &overlap); for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * If the child is viewable, we want to remove its extents * from the current universe, but we only re-clip it if * it's been marked. */ if (pChild->valdata) { /* * Figure out the new universe from the child's * perspective and recurse. */ REGION_INTERSECT( pScreen, &childUniverse, universe, &pChild->borderSize); miComputeClips (pChild, pScreen, &childUniverse, kind, exposed); } /* * Once the child has been processed, we remove its extents * from the current universe, thus denying its space to any * other sibling. */ if (overlap) REGION_SUBTRACT( pScreen, universe, universe, &pChild->borderSize); } } if (!overlap) REGION_SUBTRACT( pScreen, universe, universe, &childUnion); REGION_UNINIT( pScreen, &childUnion); REGION_UNINIT( pScreen, &childUniverse); } /* if any children */ /* * 'universe' now contains the new clipList for the parent window. * * To figure the exposure of the window we subtract the old clip from the * new, just as for the border. */ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, universe, &pParent->clipList); } /* * One last thing: backing storage. We have to try to save what parts of * the window are about to be obscured. We can just subtract the universe * from the old clipList and get the areas that were in the old but aren't * in the new and, hence, are about to be obscured. */ if (pParent->backStorage && !resized) { REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe); (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = pParent->clipList; pParent->clipList = *universe; *universe = tmp; }#ifdef NOTDEF REGION_COPY( pScreen, &pParent->clipList, universe);#endif pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pParent, dx, dy);}static voidmiTreeObscured(pParent) register WindowPtr pParent;{ register WindowPtr pChild; register int oldVis; pChild = pParent; while (1) { if (pChild->viewable) { oldVis = pChild->visibility; if (oldVis != (pChild->visibility = VisibilityFullyObscured) && ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) SendVisibilityNotify(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; }}/*- *----------------------------------------------------------------------- * miValidateTree -- * Recomputes the clip list for pParent and all its inferiors. * * Results: * Always returns 1. * * Side Effects: * The clipList, borderClip, exposed, and borderExposed regions for * each marked window are altered. * * Notes: * This routine assumes that all affected windows have been marked * (valdata created) and their winSize and borderSize regions * adjusted to correspond to their new positions. The borderClip and * clipList regions should not have been touched. * * The top-most level is treated differently from all lower levels * because pParent is unchanged. For the top level, we merge the * regions taken up by the marked children back into the clipList * for pParent, thus forming a region from which the marked children * can claim their areas. For lower levels, where the old clipList * and borderClip are invalid, we can't do this and have to do the * extra operations done in miComputeClips, but this is much faster * e.g. when only one child has moved... * *----------------------------------------------------------------------- *//*ARGSUSED*/intmiValidateTree (pParent, pChild, kind) WindowPtr pParent; /* Parent to validate */ WindowPtr pChild; /* First child of pParent that was * affected */ VTKind kind; /* What kind of configuration caused call */{ RegionRec totalClip; /* Total clipping region available to * the marked children. pParent's clipList * merged with the borderClips of all * the marked children. */ RegionRec childClip; /* The new borderClip for the current * child */ RegionRec childUnion; /* the space covered by borderSize for * all marked children */ RegionRec exposed; /* For intermediate calculations */ register ScreenPtr pScreen; register WindowPtr pWin; Bool overlap; int viewvals; Bool forward; pScreen = pParent->drawable.pScreen; if (pChild == NullWindow) pChild = pParent->firstChild; REGION_INIT(pScreen, &childClip, NullBox, 0); REGION_INIT(pScreen, &exposed, NullBox, 0); /* * compute the area of the parent window occupied * by the marked children + the parent itself. This * is the area which can be divied up among the marked * children in their new configuration. */ REGION_INIT(pScreen, &totalClip, NullBox, 0); viewvals = 0; if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { forward = TRUE; for (pWin = pChild; pWin; pWin = pWin->nextSib) { if (pWin->valdata) { REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); if (pWin->viewable) viewvals++; } } } else { forward = FALSE; pWin = pParent->lastChild; while (1) { if (pWin->valdata) { REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); if (pWin->viewable) viewvals++; } if (pWin == pChild) break; pWin = pWin->prevSib; } } REGION_VALIDATE( pScreen, &totalClip, &overlap); /* * Now go through the children of the root and figure their new * borderClips from the totalClip, passing that off to miComputeClips * to handle recursively. Once that's done, we remove the child * from the totalClip to clip any siblings below it. */ overlap = TRUE; if (kind != VTStack) { REGION_UNION( pScreen, &totalClip, &totalClip, &pParent->clipList); if (viewvals > 1) { /* * precompute childUnion to discover whether any of them * overlap. This seems redundant, but performance studies * have demonstrated that the cost of this loop is * lower than the cost of multiple Subtracts in the * loop below. */ REGION_INIT(pScreen, &childUnion, NullBox, 0); if (forward) { for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable) REGION_APPEND( pScreen, &childUnion, &pWin->borderSize); } else { pWin = pParent->lastChild; while (1) { if (pWin->valdata && pWin->viewable) REGION_APPEND( pScreen, &childUnion, &pWin->borderSize); if (pWin == pChild) break; pWin = pWin->prevSib; } } REGION_VALIDATE(pScreen, &childUnion, &overlap); if (overlap) REGION_UNINIT(pScreen, &childUnion); } } for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { if (pWin->viewable) { if (pWin->valdata) { REGION_INTERSECT( pScreen, &childClip, &totalClip, &pWin->borderSize); miComputeClips (pWin, pScreen, &childClip, kind, &exposed); if (overlap) { REGION_SUBTRACT( pScreen, &totalClip, &totalClip, &pWin->borderSize); } } else if (pWin->visibility == VisibilityNotViewable) { miTreeObscured(pWin); } } else { if (pWin->valdata) { REGION_EMPTY( pScreen, &pWin->clipList); if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); REGION_EMPTY( pScreen, &pWin->borderClip); pWin->valdata = (ValidatePtr)NULL; } } } REGION_UNINIT( pScreen, &childClip); if (!overlap) { REGION_SUBTRACT(pScreen, &totalClip, &totalClip, &childUnion); REGION_UNINIT(pScreen, &childUnion); } REGION_INIT( pScreen, &pParent->valdata->after.exposed, NullBox, 0); REGION_INIT( pScreen, &pParent->valdata->after.borderExposed, NullBox, 0); /* * each case below is responsible for updating the * clipList and serial number for the parent window */ switch (kind) { case VTStack: break; default: /* * totalClip contains the new clipList for the parent. Figure out * exposures and obscures as per miComputeClips and reset the parent's * clipList. */ REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, &totalClip, &pParent->clipList); /* fall through */ case VTMap: if (pParent->backStorage) { REGION_SUBTRACT( pScreen, &exposed, &pParent->clipList, &totalClip); (* pScreen->SaveDoomedAreas)(pParent, &exposed, 0, 0); } REGION_COPY( pScreen, &pParent->clipList, &totalClip); pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } REGION_UNINIT( pScreen, &totalClip); REGION_UNINIT( pScreen, &exposed); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, 0, 0); return (1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -