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:
@@ -602,8 +602,22 @@ Desktop::RedrawBackground()
|
|||||||
|
|
||||||
WindowLayer* window = _CurrentWindows().FirstWindow();
|
WindowLayer* window = _CurrentWindows().FirstWindow();
|
||||||
if (window->Feel() == kDesktopWindowFeel) {
|
if (window->Feel() == kDesktopWindowFeel) {
|
||||||
// TODO: this doesn't work correctly, yet
|
|
||||||
redraw = window->VisibleContentRegion();
|
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);
|
window->ProcessDirtyRegion(redraw);
|
||||||
} else {
|
} else {
|
||||||
redraw = BackgroundRegion();
|
redraw = BackgroundRegion();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
#include <View.h> // for resize modes
|
#include <View.h> // for resize modes
|
||||||
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ ViewLayer::ViewLayer(BRect frame, const char* name,
|
|||||||
fHidden(false),
|
fHidden(false),
|
||||||
fVisible(true),
|
fVisible(true),
|
||||||
fBackgroundDirty(true),
|
fBackgroundDirty(true),
|
||||||
|
fIsDesktopBackground(false),
|
||||||
|
|
||||||
fEventMask(0),
|
fEventMask(0),
|
||||||
fEventOptions(0),
|
fEventOptions(0),
|
||||||
@@ -130,6 +132,10 @@ ViewLayer::AttachedToWindow(WindowLayer* window)
|
|||||||
{
|
{
|
||||||
fWindow = 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
|
// insert view into local token space
|
||||||
if (fWindow != NULL)
|
if (fWindow != NULL)
|
||||||
fWindow->ServerWindow()->App()->ViewTokens().SetToken(fToken, B_HANDLER_TOKEN, this);
|
fWindow->ServerWindow()->App()->ViewTokens().SetToken(fToken, B_HANDLER_TOKEN, this);
|
||||||
@@ -906,22 +912,23 @@ void
|
|||||||
ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
||||||
BRegion* windowContentClipping, bool deep)
|
BRegion* windowContentClipping, bool deep)
|
||||||
{
|
{
|
||||||
if (!fVisible)
|
if (!fVisible) {
|
||||||
|
// child views cannot be visible either
|
||||||
return;
|
return;
|
||||||
// child views can not be visible either
|
}
|
||||||
|
|
||||||
if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) {
|
if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) {
|
||||||
// we can only draw within our own area
|
// we can only draw within our own area
|
||||||
BRegion redraw(ScreenClipping(windowContentClipping));
|
BRegion redraw(ScreenClipping(windowContentClipping));
|
||||||
// add the current clipping
|
// add the current clipping
|
||||||
redraw.IntersectWith(effectiveClipping);
|
redraw.IntersectWith(effectiveClipping);
|
||||||
|
|
||||||
if (fViewBitmap != NULL) {
|
if (fViewBitmap != NULL) {
|
||||||
// draw view bitmap
|
// draw view bitmap
|
||||||
// TODO: support other options!
|
// TODO: support other options!
|
||||||
BRect rect = fBitmapDestination;
|
BRect rect = fBitmapDestination;
|
||||||
ConvertToScreenForDrawing(&rect);
|
ConvertToScreenForDrawing(&rect);
|
||||||
|
|
||||||
// lock the drawing engine for as long as we need the clipping
|
// lock the drawing engine for as long as we need the clipping
|
||||||
// to be valid
|
// to be valid
|
||||||
if (drawingEngine->Lock()) {
|
if (drawingEngine->Lock()) {
|
||||||
@@ -934,10 +941,10 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
// would only waste time
|
// would only waste time
|
||||||
drawingEngine->Unlock();
|
drawingEngine->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw.Exclude(rect);
|
redraw.Exclude(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fViewColor.IsTransparentMagic()) {
|
if (!fViewColor.IsTransparentMagic()) {
|
||||||
// fill visible region with view color,
|
// fill visible region with view color,
|
||||||
// this version of FillRegion ignores any
|
// this version of FillRegion ignores any
|
||||||
|
|||||||
@@ -179,6 +179,9 @@ class ViewLayer {
|
|||||||
bool IsBackgroundDirty() const
|
bool IsBackgroundDirty() const
|
||||||
{ return fBackgroundDirty; }
|
{ return fBackgroundDirty; }
|
||||||
|
|
||||||
|
bool IsDesktopBackground() const
|
||||||
|
{ return fIsDesktopBackground; }
|
||||||
|
|
||||||
void AddTokensForLayersInRegion(BMessage* message,
|
void AddTokensForLayersInRegion(BMessage* message,
|
||||||
BRegion& region,
|
BRegion& region,
|
||||||
BRegion* windowContentClipping);
|
BRegion* windowContentClipping);
|
||||||
@@ -222,6 +225,7 @@ class ViewLayer {
|
|||||||
bool fHidden;
|
bool fHidden;
|
||||||
bool fVisible;
|
bool fVisible;
|
||||||
bool fBackgroundDirty;
|
bool fBackgroundDirty;
|
||||||
|
bool fIsDesktopBackground;
|
||||||
|
|
||||||
uint32 fEventMask;
|
uint32 fEventMask;
|
||||||
uint32 fEventOptions;
|
uint32 fEventOptions;
|
||||||
|
|||||||
Reference in New Issue
Block a user