* Don't let the app_server trigger a content draw if the kWindowScreenFlag is

set. This fixes the white background when starting ParticlesII.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32305 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-13 11:33:51 +00:00
parent 6ec9352156
commit 6dad3717d5
+55 -42
View File
@@ -231,7 +231,7 @@ Window::GetFullRegion(BRegion* region)
region->Include(fFrame); region->Include(fFrame);
} }
// GetBorderRegion
void void
Window::GetBorderRegion(BRegion* region) Window::GetBorderRegion(BRegion* region)
{ {
@@ -577,12 +577,15 @@ Window::GetEffectiveDrawingRegion(View* view, BRegion& region)
if (!fEffectiveDrawingRegionValid) { if (!fEffectiveDrawingRegionValid) {
fEffectiveDrawingRegion = VisibleContentRegion(); fEffectiveDrawingRegion = VisibleContentRegion();
if (fUpdateRequested && !fInUpdate) { if (fUpdateRequested && !fInUpdate) {
// we requested an update, but the client has not started it yet, // We requested an update, but the client has not started it yet,
// so it is only allowed to draw outside the pending update sessions region // so it is only allowed to draw outside the pending update sessions
fEffectiveDrawingRegion.Exclude(&(fPendingUpdateSession->DirtyRegion())); // region
fEffectiveDrawingRegion.Exclude(
&fPendingUpdateSession->DirtyRegion());
} else if (fInUpdate) { } else if (fInUpdate) {
// enforce the dirty region of the update session // enforce the dirty region of the update session
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion()); fEffectiveDrawingRegion.IntersectWith(
&fCurrentUpdateSession->DirtyRegion());
} else { } else {
// not in update, the view can draw everywhere // not in update, the view can draw everywhere
//printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), view->Name()); //printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), view->Name());
@@ -1503,6 +1506,18 @@ Window::SetFlags(uint32 flags, BRegion* updateRegion)
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
_ObeySizeLimits(); _ObeySizeLimits();
} }
// TODO: not sure if we want to do this
#if 0
if ((fOriginalFlags & kWindowScreenFlag) != (flags & kWindowScreenFlag)) {
// TODO: disabling needs to be nestable (or we might lose the previous
// update state)
if ((flags & kWindowScreenFlag) != 0)
DisableUpdateRequests();
else
EnableUpdateRequests();
}
#endif
} }
@@ -1824,8 +1839,7 @@ Window::IsFloatingFeel(window_feel feel)
} }
/*static*/ /*static*/ uint32
uint32
Window::ValidWindowFlags() Window::ValidWindowFlags()
{ {
return B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE return B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
@@ -1842,8 +1856,7 @@ Window::ValidWindowFlags()
} }
/*static*/ /*static*/ uint32
uint32
Window::ValidWindowFlags(window_feel feel) Window::ValidWindowFlags(window_feel feel)
{ {
uint32 flags = ValidWindowFlags(); uint32 flags = ValidWindowFlags();
@@ -1857,7 +1870,6 @@ Window::ValidWindowFlags(window_feel feel)
// #pragma mark - private // #pragma mark - private
// _ShiftPartOfRegion
void void
Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
int32 xOffset, int32 yOffset) int32 xOffset, int32 yOffset)
@@ -1881,30 +1893,32 @@ Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
void void
Window::_TriggerContentRedraw(BRegion& dirtyContentRegion) Window::_TriggerContentRedraw(BRegion& dirtyContentRegion)
{ {
if (IsVisible() && dirtyContentRegion.CountRects() > 0) { if (!IsVisible() || dirtyContentRegion.CountRects() == 0
// put this into the pending dirty region || (fFlags & kWindowScreenFlag) != 0)
// to eventually trigger a client redraw return;
bool wasExpose = fPendingUpdateSession->IsExpose();
BRegion* backgroundClearingRegion = &dirtyContentRegion;
_TransferToUpdateSession(&dirtyContentRegion); // put this into the pending dirty region
// to eventually trigger a client redraw
bool wasExpose = fPendingUpdateSession->IsExpose();
BRegion* backgroundClearingRegion = &dirtyContentRegion;
if (fPendingUpdateSession->IsExpose()) { _TransferToUpdateSession(&dirtyContentRegion);
if (!fContentRegionValid)
_UpdateContentRegion();
if (!wasExpose) { if (fPendingUpdateSession->IsExpose()) {
// there was suddenly added a dirty region if (!fContentRegionValid)
// caused by exposing content, we need to clear _UpdateContentRegion();
// the entire background
backgroundClearingRegion
= &(fPendingUpdateSession->DirtyRegion());
}
if (fDrawingEngine->LockParallelAccess()) { if (!wasExpose) {
bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); // there was suddenly added a dirty region
fDrawingEngine->SetCopyToFrontEnabled(true); // caused by exposing content, we need to clear
fDrawingEngine->SuspendAutoSync(); // the entire background
backgroundClearingRegion = &fPendingUpdateSession->DirtyRegion();
}
if (fDrawingEngine->LockParallelAccess()) {
bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled();
fDrawingEngine->SetCopyToFrontEnabled(true);
fDrawingEngine->SuspendAutoSync();
//sCurrentColor.red = rand() % 255; //sCurrentColor.red = rand() % 255;
//sCurrentColor.green = rand() % 255; //sCurrentColor.green = rand() % 255;
@@ -1915,13 +1929,12 @@ Window::_TriggerContentRedraw(BRegion& dirtyContentRegion)
//fDrawingEngine->FillRegion(*backgroundClearingRegion, sCurrentColor); //fDrawingEngine->FillRegion(*backgroundClearingRegion, sCurrentColor);
//snooze(10000); //snooze(10000);
fTopView->Draw(fDrawingEngine, backgroundClearingRegion, fTopView->Draw(fDrawingEngine, backgroundClearingRegion,
&fContentRegion, true); &fContentRegion, true);
fDrawingEngine->Sync(); fDrawingEngine->Sync();
fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled); fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled);
fDrawingEngine->UnlockParallelAccess(); fDrawingEngine->UnlockParallelAccess();
}
} }
} }
} }
@@ -1971,8 +1984,7 @@ fWindow->ResyncDrawState();
} }
/*! /*! pre: the clipping is readlocked (this function is
pre: the clipping is readlocked (this function is
only called from _TriggerContentRedraw()), which only called from _TriggerContentRedraw()), which
in turn is only called from MessageReceived() with in turn is only called from MessageReceived() with
the clipping lock held the clipping lock held
@@ -2001,7 +2013,7 @@ Window::_TransferToUpdateSession(BRegion* contentDirtyRegion)
} }
} }
// _SendUpdateMessage
void void
Window::_SendUpdateMessage() Window::_SendUpdateMessage()
{ {
@@ -2253,9 +2265,10 @@ Window::_ObeySizeLimits()
Window::UpdateSession::UpdateSession() Window::UpdateSession::UpdateSession()
: fDirtyRegion(), :
fInUse(false), fDirtyRegion(),
fCause(0) fInUse(false),
fCause(0)
{ {
} }