From 966fbea627da9dee220f80515e7baf8d0957a92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 13 Feb 2006 13:43:30 +0000 Subject: [PATCH] A work-around for the Tracker desktop redraw problem of the previous change. Should probably be cleaned up a little. This fixes bug #146. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16377 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 16 +++++++++++++++- src/servers/app/ViewLayer.cpp | 19 +++++++++++++------ src/servers/app/ViewLayer.h | 4 ++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index f4a2b05cc0..866b580fa1 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -602,8 +602,22 @@ Desktop::RedrawBackground() WindowLayer* window = _CurrentWindows().FirstWindow(); if (window->Feel() == kDesktopWindowFeel) { - // TODO: this doesn't work correctly, yet redraw = window->VisibleContentRegion(); + + // look for desktop background view, and update its background color + // TODO: is there a better way to do this? + ViewLayer* view = window->TopLayer(); + if (view != NULL) + view = view->FirstChild(); + + while (view) { + if (view->IsDesktopBackground()) { + view->SetViewColor(fWorkspaces[fCurrentWorkspace].Color()); + break; + } + view = view->NextSibling(); + } + window->ProcessDirtyRegion(redraw); } else { redraw = BackgroundRegion(); diff --git a/src/servers/app/ViewLayer.cpp b/src/servers/app/ViewLayer.cpp index beb445409f..3fee90e962 100644 --- a/src/servers/app/ViewLayer.cpp +++ b/src/servers/app/ViewLayer.cpp @@ -25,6 +25,7 @@ #include #include #include // for resize modes +#include #include @@ -52,6 +53,7 @@ ViewLayer::ViewLayer(BRect frame, const char* name, fHidden(false), fVisible(true), fBackgroundDirty(true), + fIsDesktopBackground(false), fEventMask(0), fEventOptions(0), @@ -130,6 +132,10 @@ ViewLayer::AttachedToWindow(WindowLayer* window) { fWindow = window; + // an ugly hack to detect the desktop background + if (window->Feel() == kDesktopWindowFeel && Parent() == TopLayer()) + fIsDesktopBackground = true; + // insert view into local token space if (fWindow != NULL) fWindow->ServerWindow()->App()->ViewTokens().SetToken(fToken, B_HANDLER_TOKEN, this); @@ -906,22 +912,23 @@ void ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, BRegion* windowContentClipping, bool deep) { - if (!fVisible) + if (!fVisible) { + // child views cannot be visible either return; - // child views can not be visible either + } if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) { // we can only draw within our own area BRegion redraw(ScreenClipping(windowContentClipping)); // add the current clipping redraw.IntersectWith(effectiveClipping); - + if (fViewBitmap != NULL) { // draw view bitmap // TODO: support other options! BRect rect = fBitmapDestination; ConvertToScreenForDrawing(&rect); - + // lock the drawing engine for as long as we need the clipping // to be valid if (drawingEngine->Lock()) { @@ -934,10 +941,10 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, // would only waste time drawingEngine->Unlock(); } - + redraw.Exclude(rect); } - + if (!fViewColor.IsTransparentMagic()) { // fill visible region with view color, // this version of FillRegion ignores any diff --git a/src/servers/app/ViewLayer.h b/src/servers/app/ViewLayer.h index c5e685fce7..082da94d22 100644 --- a/src/servers/app/ViewLayer.h +++ b/src/servers/app/ViewLayer.h @@ -179,6 +179,9 @@ class ViewLayer { bool IsBackgroundDirty() const { return fBackgroundDirty; } + bool IsDesktopBackground() const + { return fIsDesktopBackground; } + void AddTokensForLayersInRegion(BMessage* message, BRegion& region, BRegion* windowContentClipping); @@ -222,6 +225,7 @@ class ViewLayer { bool fHidden; bool fVisible; bool fBackgroundDirty; + bool fIsDesktopBackground; uint32 fEventMask; uint32 fEventOptions;