This may be a quick and dirty fix to the problems we've been having with the update code. However this requires something from DisplayDriver. I'll write about this in a moment on app_server list.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12165 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-03-30 20:06:50 +00:00
parent c900253170
commit f694c0e30e
6 changed files with 48 additions and 16 deletions

View File

@ -262,6 +262,7 @@ void Desktop::AddWinBorder(WinBorder *winBorder)
if (fWinBorderList.HasItem(winBorder))
{
Unlock();
ActiveRootLayer()->Unlock();
debugger("AddWinBorder: WinBorder already in Desktop list\n");
return;
}
@ -356,6 +357,7 @@ void Desktop::RemoveWinBorder(WinBorder *winBorder)
else
{
Unlock();
ActiveRootLayer()->Unlock();
debugger("RemoveWinBorder: WinBorder not found in Desktop list\n");
return;
}

View File

@ -589,7 +589,12 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
{
// server drawings are immediate.
// No IPC is needed so this is done in place.
if (fClassID == AS_WINBORDER_CLASS)
{
WinBorder *wb = (WinBorder*)this;
wb->zUpdateReg.Include(&reg);
}
fUpdateReg = fVisible;
if (fFlags & B_FULL_UPDATE_ON_RESIZE
&& fFrameAction == B_LAYER_ACTION_RESIZE)
@ -625,16 +630,7 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
common.IntersectWith(&reg);
if (common.CountRects() > 0)
{
// lock/unlock if we are a winborder
if (lay->fClassID == AS_WINBORDER_CLASS)
lay->Window()->Lock();
lay->RequestDraw(reg, NULL);
if (lay->fClassID == AS_WINBORDER_CLASS)
lay->Window()->Unlock();
}
}
}
}
@ -659,15 +655,26 @@ void Layer::UpdateStart()
{
// During updates we only want to draw what's in the update region
fInUpdate = true;
if (fClassID == AS_WINBORDER_CLASS)
{
WinBorder *wb = (WinBorder*)this;
wb->yUpdateReg = wb->zUpdateReg;
wb->zUpdateReg.MakeEmpty();
}
fClipReg = &fUpdateReg;
}
void Layer::UpdateEnd()
{
// The usual case. Drawing is permitted in the whole visible area.
fInUpdate = false;
fClipReg = &fVisible;
fUpdateReg.MakeEmpty();
if (fClassID == AS_WINBORDER_CLASS)
{
WinBorder *wb = (WinBorder*)this;
wb->yUpdateReg.MakeEmpty();
}
fInUpdate = false;
}
/*!

View File

@ -120,7 +120,8 @@ public:
void GoRedraw(const Layer *layer, const BRegion &region);
// Debug methods
void PrintToStream(void);
void PrintToStream(void);
thread_id LockingThread() { return fAllRegionsLock.LockingThread(); }
BRegion fRedrawReg;
BList fCopyRegList;

View File

@ -1408,7 +1408,9 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
case AS_BEGIN_UPDATE:
{
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n",fTitle.String()));
fWinBorder->GetRootLayer()->Lock();
cl->UpdateStart();
fWinBorder->GetRootLayer()->Unlock();
break;
}
case AS_END_UPDATE:
@ -1636,10 +1638,23 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
STRACE(("ServerWindow %s: Message Zoom unimplemented\n",fTitle.String()));
break;
}
default:
{
DispatchGraphicsMessage(code, link);
}
}
}
// -------------------- Graphics messages ----------------------------------
void ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
{
fWinBorder->GetRootLayer()->Lock();
BRegion rreg(cl->fVisible);
rreg.Include(&fWinBorder->zUpdateReg);
desktop->GetDisplayDriver()->ConstrainClippingRegion(&rreg);
switch (code)
{
case AS_LAYER_SET_HIGH_COLOR:
{
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
@ -2222,6 +2237,9 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
break;
}
}
desktop->GetDisplayDriver()->ConstrainClippingRegion(NULL);
fWinBorder->GetRootLayer()->Unlock();
}
//------------------------------------------------------------------------------
/*!

View File

@ -131,6 +131,7 @@ private:
// message handle methods.
void DispatchMessage(int32 code, LinkMsgReader &link);
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
static int32 MonitorWin(void *data);

View File

@ -112,6 +112,9 @@ protected:
Decorator *fDecorator;
Layer *fTopLayer;
BRegion zUpdateReg;
BRegion yUpdateReg;
int32 fMouseButtons;
int32 fKeyModifiers;
BPoint fLastMousePosition;