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
This commit is contained in:
Axel Dörfler
2006-02-13 13:43:30 +00:00
parent 3dcbe9fc88
commit 966fbea627
3 changed files with 32 additions and 7 deletions
+15 -1
View File
@@ -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();
+13 -6
View File
@@ -25,6 +25,7 @@
#include <Message.h>
#include <PortLink.h>
#include <View.h> // for resize modes
#include <WindowPrivate.h>
#include <stdio.h>
@@ -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
+4
View File
@@ -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;