From b53a9cf25c8c7a108ed361a8f695764b9651d6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 17 Aug 2009 16:54:57 +0000 Subject: [PATCH] * When a window changed its look/title/... we need to make sure the dirty region we got in _RebuildAndRedrawAfterWindowChange() does not contain hidden parts. * This eliminates the updates as seen in the WindowInvalidation test app, as well as it fixes bug #4257. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32471 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 0fd51c3d3f..5993174cdb 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -2836,15 +2836,34 @@ Desktop::_SetBackground(BRegion& background) //! The all window lock must be held when calling this function. void -Desktop::_RebuildAndRedrawAfterWindowChange(Window* window, BRegion& dirty) +Desktop::_RebuildAndRedrawAfterWindowChange(Window* changedWindow, + BRegion& dirty) { - if (!window->IsVisible() || dirty.CountRects() == 0) + if (!changedWindow->IsVisible() || dirty.CountRects() == 0) return; - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); + // The following loop is pretty much a copy of + // _RebuildClippingForAllWindows(), but will also + // take care about restricting our dirty region. + + // figure out what the entire screen area is + BRegion stillAvailableOnScreen(fScreenRegion); + + // set clipping of each window + for (Window* window = _CurrentWindows().LastWindow(); window != NULL; + window = window->PreviousWindow(fCurrentWorkspace)) { + if (!window->IsHidden()) { + if (window == changedWindow) + dirty.IntersectWith(&stillAvailableOnScreen); + + window->SetClipping(&stillAvailableOnScreen); + // that windows region is not available on screen anymore + stillAvailableOnScreen.Exclude(&window->VisibleRegion()); + } + } + _SetBackground(stillAvailableOnScreen); - _WindowChanged(window); + _WindowChanged(changedWindow); _TriggerWindowRedrawing(dirty); }