📄 miwindow.c
字号:
{ bsExposed = (*pScreen->TranslateBackingStore) (pWin, nx - x, ny - y, pRegion, oldx, oldy); } } if (WasViewable) { /* avoid the border */ if (HasBorder (pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy); offx += dx; offy += dy; } REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip) { /* * clip to new clipList */ REGION_COPY(pScreen, pRegion, oldWinClip); REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy); REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip, gravitate[g]); } REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip); REGION_DESTROY(pScreen, oldWinClip); } } /* * move the bits on the screen */ destClip = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], oldRegion); /* clip to not overwrite already copied areas */ if (destClip) { REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y); REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip); REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y) (*pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, gravitate[g]); /* remove any overwritten bits from the remaining useful bits */ REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; REGION_INTERSECT(pScreen, pRegion, &pChild->borderClip, gravitate[g]); TraverseTree (pChild, miRecomputeExposures, (pointer)pRegion); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if (!destClip) destClip = gravitate[g]; else { REGION_UNION(pScreen, destClip, destClip, gravitate[g]); REGION_DESTROY(pScreen, gravitate[g]); } } REGION_DESTROY(pScreen, oldRegion); REGION_DESTROY(pScreen, pRegion); if (destClip) REGION_DESTROY(pScreen, destClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) REGION_EMPTY(pScreen, valExposed); REGION_DESTROY(pScreen, bsExposed); } if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent);#ifdef DO_SAVE_UNDERS if (dosave) { (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange); }#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, VTOther); } else if (bsExposed) { (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); REGION_DESTROY(pScreen, bsExposed); } if (pWin->realized) WindowsRestructured ();}WindowPtrmiGetLayerWindow(pWin) WindowPtr pWin;{ return pWin->firstChild;}#ifdef SHAPE/****** * * miSetShape * The border/window shape has changed. Recompute winSize/borderSize * and send appropriate exposure events */voidmiSetShape(pWin) register WindowPtr pWin;{ Bool WasViewable = (Bool)(pWin->viewable); register ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked; WindowPtr pParent = pWin->parent; RegionPtr pOldClip, bsExposed;#ifdef DO_SAVE_UNDERS Bool dosave = FALSE;#endif WindowPtr pLayerWin; if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); if (pWin->valdata) { if (HasBorder (pWin)) { RegionPtr borderVisible; borderVisible = REGION_CREATE(pScreen, NullBox, 1); REGION_SUBTRACT(pScreen, borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } pWin->valdata->before.resized = TRUE; } } SetWinSize (pWin); SetBorderSize (pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { if (pWin->backStorage) { pOldClip = REGION_CREATE(pScreen, NullBox, 1); REGION_COPY(pScreen, pOldClip, &pWin->clipList); } anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL);#ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); }#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pOldClip = &pWin->clipList; /* a convenient empty region */ bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); if (WasViewable) REGION_DESTROY(pScreen, pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) REGION_EMPTY(pScreen, valExposed); REGION_DESTROY(pScreen, bsExposed); } } if (WasViewable) { if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent);#ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->realized) WindowsRestructured (); CheckCursorConfinement(pWin);}#endif/* Keeps the same inside(!) origin */voidmiChangeBorderWidth(pWin, width) register WindowPtr pWin; unsigned int width;{ WindowPtr pParent; int oldwidth; Bool anyMarked; register ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder;#ifdef DO_SAVE_UNDERS Bool dosave = FALSE;#endif WindowPtr pLayerWin; oldwidth = wBorderWidth (pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; pParent = pWin->parent; if (WasViewable && width < oldwidth) anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); pWin->borderWidth = width; SetBorderSize (pWin); if (WasViewable) { if (width > oldwidth) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); /* * save the old border visible region to correctly compute * borderExposed. */ if (pWin->valdata && HadBorder) { RegionPtr borderVisible; borderVisible = REGION_CREATE(pScreen, NULL, 1); REGION_SUBTRACT(pScreen, borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } }#ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); }#endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther); (*pScreen->HandleExposures)(pLayerWin->parent); }#ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib);#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTOther); } if (pWin->realized) WindowsRestructured ();}voidmiMarkUnrealizedWindow(pChild, pWin, fromConfigure) WindowPtr pChild; WindowPtr pWin; Bool fromConfigure;{ if ((pChild != pWin) || fromConfigure) { REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0); REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -