diff options
Diffstat (limited to 'xorg-server/mi/miwindow.c')
-rw-r--r-- | xorg-server/mi/miwindow.c | 326 |
1 files changed, 28 insertions, 298 deletions
diff --git a/xorg-server/mi/miwindow.c b/xorg-server/mi/miwindow.c index cb8400c0c..498c8a656 100644 --- a/xorg-server/mi/miwindow.c +++ b/xorg-server/mi/miwindow.c @@ -57,12 +57,10 @@ SOFTWARE. #include "pixmapstr.h" #include "mivalidate.h" -_X_EXPORT void -miClearToBackground(pWin, x, y, w, h, generateExposures) - WindowPtr pWin; - int x,y; - int w,h; - Bool generateExposures; +_X_EXPORT void +miClearToBackground(WindowPtr pWin, + int x, int y, int w, int h, + Bool generateExposures) { BoxRec box; RegionRec reg; @@ -124,213 +122,8 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) REGION_DESTROY(pScreen, pBSReg); } -/* - * For SaveUnders using backing-store. The idea is that when a window is mapped - * with saveUnder set TRUE, any windows it obscures will have its backing - * store turned on setting the DIXsaveUnder bit, - * The backing-store code must be written to allow for this - */ - -/*- - *----------------------------------------------------------------------- - * miCheckSubSaveUnder -- - * Check all the inferiors of a window for coverage by saveUnder - * windows. Called from ChangeSaveUnder and CheckSaveUnder. - * This code is very inefficient. - * - * Results: - * TRUE if any windows need to have backing-store removed. - * - * Side Effects: - * Windows may have backing-store turned on or off. - * - *----------------------------------------------------------------------- - */ -static Bool -miCheckSubSaveUnder( - WindowPtr pParent, /* Parent to check */ - WindowPtr pFirst, /* first reconfigured window */ - RegionPtr pRegion) /* Initial area obscured by saveUnder */ -{ - WindowPtr pChild; /* Current child */ - ScreenPtr pScreen; /* Screen to use */ - RegionRec SubRegion; /* Area of children obscured */ - Bool res = FALSE; /* result */ - Bool subInited=FALSE;/* SubRegion initialized */ - - pScreen = pParent->drawable.pScreen; - if ( (pChild = pParent->firstChild) ) - { - /* - * build region above first changed window - */ - - for (; pChild != pFirst; pChild = pChild->nextSib) - if (pChild->viewable && pChild->saveUnder) - REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize); - - /* - * check region below and including first changed window - */ - - for (; pChild; pChild = pChild->nextSib) - { - if (pChild->viewable) - { - /* - * don't save under nephew/niece windows; - * use a separate region - */ - - if (pChild->firstChild) - { - if (!subInited) - { - REGION_NULL(pScreen, &SubRegion); - subInited = TRUE; - } - REGION_COPY(pScreen, &SubRegion, pRegion); - res |= miCheckSubSaveUnder(pChild, pChild->firstChild, - &SubRegion); - } - else - { - res |= miCheckSubSaveUnder(pChild, pChild->firstChild, - pRegion); - } - - if (pChild->saveUnder) - REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize); - } - } - - if (subInited) - REGION_UNINIT(pScreen, &SubRegion); - } - - /* - * Check the state of this window. DIX save unders are - * enabled for viewable windows with some client expressing - * exposure interest and which intersect the save under region - */ - - if (pParent->viewable && - ((pParent->eventMask | wOtherEventMasks(pParent)) & ExposureMask) && - REGION_NOTEMPTY(pScreen, &pParent->borderSize) && - RECT_IN_REGION(pScreen, pRegion, REGION_EXTENTS(pScreen, - &pParent->borderSize)) != rgnOUT) - { - if (!pParent->DIXsaveUnder) - { - pParent->DIXsaveUnder = TRUE; - (*pScreen->ChangeWindowAttributes) (pParent, CWBackingStore); - } - } - else - { - if (pParent->DIXsaveUnder) - { - res = TRUE; - pParent->DIXsaveUnder = FALSE; - } - } - return res; -} - - -/*- - *----------------------------------------------------------------------- - * miChangeSaveUnder -- - * Change the save-under state of a tree of windows. Called when - * a window with saveUnder TRUE is mapped/unmapped/reconfigured. - * - * Results: - * TRUE if any windows need to have backing-store removed (which - * means that PostChangeSaveUnder needs to be called later to - * finish the job). - * - * Side Effects: - * Windows may have backing-store turned on or off. - * - *----------------------------------------------------------------------- - */ -Bool -miChangeSaveUnder(pWin, first) - WindowPtr pWin; - WindowPtr first; /* First window to check. - * Used when pWin was restacked */ -{ - RegionRec rgn; /* Area obscured by saveUnder windows */ - ScreenPtr pScreen; - Bool res; - - if (!deltaSaveUndersViewable && !numSaveUndersViewable) - return FALSE; - numSaveUndersViewable += deltaSaveUndersViewable; - deltaSaveUndersViewable = 0; - pScreen = pWin->drawable.pScreen; - REGION_NULL(pScreen, &rgn); - res = miCheckSubSaveUnder (pWin->parent, - pWin->saveUnder ? first : pWin->nextSib, - &rgn); - REGION_UNINIT(pScreen, &rgn); - return res; -} - -/*- - *----------------------------------------------------------------------- - * miPostChangeSaveUnder -- - * Actually turn backing-store off for those windows that no longer - * need to have it on. - * - * Results: - * None. - * - * Side Effects: - * Backing-store and SAVE_UNDER_CHANGE_BIT are turned off for those - * windows affected. - * - *----------------------------------------------------------------------- - */ -void -miPostChangeSaveUnder(pWin, pFirst) - WindowPtr pWin; - WindowPtr pFirst; -{ - WindowPtr pParent, pChild; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - - if (!(pParent = pWin->parent)) - return; - ChangeWindowAttributes = pParent->drawable.pScreen->ChangeWindowAttributes; - if (!pParent->DIXsaveUnder && - (pParent->backingStore == NotUseful) && pParent->backStorage) - (*ChangeWindowAttributes)(pParent, CWBackingStore); - if (!(pChild = pFirst)) - return; - while (1) - { - if (!pChild->DIXsaveUnder && - (pChild->backingStore == NotUseful) && pChild->backStorage) - (*ChangeWindowAttributes)(pChild, CWBackingStore); - if (pChild->firstChild) - { - pChild = pChild->firstChild; - continue; - } - while (!pChild->nextSib) - { - pChild = pChild->parent; - if (pChild == pParent) - return; - } - pChild = pChild->nextSib; - } -} - void -miMarkWindow(pWin) - WindowPtr pWin; +miMarkWindow(WindowPtr pWin) { ValidatePtr val; @@ -345,10 +138,7 @@ miMarkWindow(pWin) } Bool -miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) - WindowPtr pWin; - WindowPtr pFirst; - WindowPtr *ppLayerWin; +miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin) { BoxPtr box; WindowPtr pChild, pLast; @@ -433,9 +223,8 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) * regions, translate the regions, restore any backing store, * and then send any regions still exposed to the client *****/ -_X_EXPORT void -miHandleValidateExposures(pWin) - WindowPtr pWin; +void +miHandleValidateExposures(WindowPtr pWin) { WindowPtr pChild; ValidatePtr val; @@ -472,11 +261,7 @@ miHandleValidateExposures(pWin) } void -miMoveWindow(pWin, x, y, pNextSib, kind) - WindowPtr pWin; - int x,y; - WindowPtr pNextSib; - VTKind kind; +miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind) { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); @@ -486,9 +271,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind) Bool anyMarked = FALSE; ScreenPtr pScreen; WindowPtr windowToValidate; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; /* if this is a root window, can't be moved */ @@ -528,12 +310,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind) anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, (WindowPtr *)NULL); -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, windowToValidate); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) { @@ -543,10 +319,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind) /* XXX need to retile border if ParentRelative origin */ (*pScreen->HandleExposures)(pLayerWin->parent); } -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, windowToValidate); -#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, kind); } @@ -570,6 +342,15 @@ miRecomputeExposures ( if (pWin->valdata) { +#ifdef COMPOSITE + /* + * Redirected windows are not affected by parent window + * gravity manipulations, so don't recompute their + * exposed areas here. + */ + if (pWin->redirectDraw != RedirectDrawNone) + return WT_DONTWALKCHILDREN; +#endif pScreen = pWin->drawable.pScreen; /* * compute exposed regions of this window @@ -589,11 +370,10 @@ miRecomputeExposures ( } void -miSlideAndSizeWindow(pWin, x, y, w, h, pSib) - WindowPtr pWin; - int x,y; - unsigned int w, h; - WindowPtr pSib; +miSlideAndSizeWindow(WindowPtr pWin, + int x, int y, + unsigned int w, unsigned int h, + WindowPtr pSib) { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); @@ -619,9 +399,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) RegionPtr borderVisible = NullRegion; /* visible area of the border */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; /* if this is a root window, can't be resized */ @@ -734,12 +511,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) pWin->valdata->before.borderVisible = borderVisible; } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, VTOther); @@ -902,12 +673,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) REGION_DESTROY(pScreen, destClip); 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); @@ -917,13 +682,11 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) } WindowPtr -miGetLayerWindow(pWin) - WindowPtr pWin; +miGetLayerWindow(WindowPtr pWin) { return pWin->firstChild; } -#ifdef SHAPE /****** * * miSetShape @@ -931,16 +694,12 @@ miGetLayerWindow(pWin) * and send appropriate exposure events */ -_X_EXPORT void -miSetShape(pWin) - WindowPtr pWin; +void +miSetShape(WindowPtr pWin) { Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked = FALSE; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; if (WasViewable) @@ -972,12 +731,6 @@ miSetShape(pWin) 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); @@ -987,10 +740,6 @@ miSetShape(pWin) { 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); } @@ -998,23 +747,17 @@ miSetShape(pWin) WindowsRestructured (); CheckCursorConfinement(pWin); } -#endif /* Keeps the same inside(!) origin */ -_X_EXPORT void -miChangeBorderWidth(pWin, width) - WindowPtr pWin; - unsigned int width; +void +miChangeBorderWidth(WindowPtr pWin, unsigned int width) { int oldwidth; Bool anyMarked = FALSE; ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; oldwidth = wBorderWidth (pWin); @@ -1047,22 +790,12 @@ miChangeBorderWidth(pWin, width) 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); @@ -1072,10 +805,7 @@ miChangeBorderWidth(pWin, width) } void -miMarkUnrealizedWindow(pChild, pWin, fromConfigure) - WindowPtr pChild; - WindowPtr pWin; - Bool fromConfigure; +miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure) { if ((pChild != pWin) || fromConfigure) { |