From f694c0e30e986c3a4a19ce452dfc3c6c4941ac91 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Wed, 30 Mar 2005 20:06:50 +0000 Subject: [PATCH] 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 --- src/servers/app/Desktop.cpp | 2 ++ src/servers/app/Layer.cpp | 31 +++++++++++++++++++------------ src/servers/app/RootLayer.h | 3 ++- src/servers/app/ServerWindow.cpp | 24 +++++++++++++++++++++--- src/servers/app/ServerWindow.h | 1 + src/servers/app/WinBorder.h | 3 +++ 6 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index bf7ca88c76..aca84819c6 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -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; } diff --git a/src/servers/app/Layer.cpp b/src/servers/app/Layer.cpp index d0c3b1d133..aeea253d32 100644 --- a/src/servers/app/Layer.cpp +++ b/src/servers/app/Layer.cpp @@ -589,7 +589,12 @@ void Layer::RequestDraw(const BRegion ®, 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(®); + } + fUpdateReg = fVisible; if (fFlags & B_FULL_UPDATE_ON_RESIZE && fFrameAction == B_LAYER_ACTION_RESIZE) @@ -625,16 +630,7 @@ void Layer::RequestDraw(const BRegion ®, Layer *startFrom) common.IntersectWith(®); 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; } /*! diff --git a/src/servers/app/RootLayer.h b/src/servers/app/RootLayer.h index b41fa85087..fabbf7f9ab 100644 --- a/src/servers/app/RootLayer.h +++ b/src/servers/app/RootLayer.h @@ -120,7 +120,8 @@ public: void GoRedraw(const Layer *layer, const BRegion ®ion); // Debug methods - void PrintToStream(void); + void PrintToStream(void); + thread_id LockingThread() { return fAllRegionsLock.LockingThread(); } BRegion fRedrawReg; BList fCopyRegList; diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 69560f9313..fcc838a298 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -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(); } //------------------------------------------------------------------------------ /*! diff --git a/src/servers/app/ServerWindow.h b/src/servers/app/ServerWindow.h index 497fcb36fa..bb63a730d5 100644 --- a/src/servers/app/ServerWindow.h +++ b/src/servers/app/ServerWindow.h @@ -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); diff --git a/src/servers/app/WinBorder.h b/src/servers/app/WinBorder.h index 699239d10c..31e7ba6e3d 100644 --- a/src/servers/app/WinBorder.h +++ b/src/servers/app/WinBorder.h @@ -112,6 +112,9 @@ protected: Decorator *fDecorator; Layer *fTopLayer; + BRegion zUpdateReg; + BRegion yUpdateReg; + int32 fMouseButtons; int32 fKeyModifiers; BPoint fLastMousePosition;