From 8e2f6185f52268c81d9c92baa2354992f00bc34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 16 May 2006 19:12:01 +0000 Subject: [PATCH] Overlay was not correctly updated when moving the window - it was only updated if the overlay buffer changed. Found by Marcus. As a result, the overlay window looks much smoother when moving it around (and it even starts to move when you don't change the overlay bitmap at all...). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17484 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ViewLayer.cpp | 28 ++++++++++++++++++++++------ src/servers/app/ViewLayer.h | 2 ++ src/servers/app/WindowLayer.cpp | 8 ++++++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/servers/app/ViewLayer.cpp b/src/servers/app/ViewLayer.cpp index 17594d00b3..d13c72c817 100644 --- a/src/servers/app/ViewLayer.cpp +++ b/src/servers/app/ViewLayer.cpp @@ -515,6 +515,28 @@ ViewLayer::_UpdateOverlayView() const } +/*! + This method is called whenever the window is resized or moved - would + be nice to have a better solution for this, though. +*/ +void +ViewLayer::UpdateOverlay() +{ + if (!IsVisible()) + return; + + if (_Overlay() != NULL) { + _UpdateOverlayView(); + } else { + // recursively ask children of this view + + for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + child->UpdateOverlay(); + } + } +} + + void ViewLayer::ConvertToParent(BPoint* point) const { @@ -756,9 +778,6 @@ ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion) // the screen clipping InvalidateScreenClipping(true); } - - // overlay handling - _UpdateOverlayView(); } // ResizeBy @@ -822,9 +841,6 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) // TODO: when the implementation of Hide() and Show() is // complete, see if this should be avoided RebuildClipping(false); - - // overlay handling - _UpdateOverlayView(); } // ParentResized diff --git a/src/servers/app/ViewLayer.h b/src/servers/app/ViewLayer.h index 3e3a7080c6..daf99403fe 100644 --- a/src/servers/app/ViewLayer.h +++ b/src/servers/app/ViewLayer.h @@ -183,6 +183,8 @@ class ViewLayer { // according to the parents visibility void UpdateVisibleDeep(bool parentVisible); + void UpdateOverlay(); + void MarkBackgroundDirty(); bool IsBackgroundDirty() const { return fBackgroundDirty; } diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index a828387fff..f1dcfeba28 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -316,8 +316,10 @@ WindowLayer::MoveBy(int32 x, int32 y) if (fDecorator) fDecorator->MoveBy(x, y); - if (fTopLayer != NULL) + if (fTopLayer != NULL) { fTopLayer->MoveBy(x, y, NULL); + fTopLayer->UpdateOverlay(); + } // the desktop will take care of dirty regions @@ -373,8 +375,10 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) //} } - if (fTopLayer != NULL) + if (fTopLayer != NULL) { fTopLayer->ResizeBy(x, y, dirtyRegion); + fTopLayer->UpdateOverlay(); + } //if (dirtyRegion) //fDrawingEngine->FillRegion(*dirtyRegion, RGBColor(0, 255, 255, 255));