From b93f9f1371e7ff2cdc8dea83403fbc792d9f33e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 15 Dec 2006 23:05:35 +0000 Subject: [PATCH] * now the Decorator uses the DrawingEngine instance of the WindowLayer, so that we can draw the window borders using parallel access too. Seems to improve things even further, using the app_server environment with direct accelerant access on R5 looks pretty decent now, but of cause still far from perfect. The global font lock could actually be the problem now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19528 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/DecorManager.cpp | 23 +++++++++++--------- src/servers/app/DecorManager.h | 8 ++++--- src/servers/app/WindowLayer.cpp | 36 ++++++++++++++++++-------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/servers/app/DecorManager.cpp b/src/servers/app/DecorManager.cpp index 623a9fe8ae..9b8e1dd4a1 100644 --- a/src/servers/app/DecorManager.cpp +++ b/src/servers/app/DecorManager.cpp @@ -37,13 +37,14 @@ class DecorInfo { image_id ID() const { return fID; } const char* Name() const { return fName.String(); } - Decorator* Instantiate(Desktop* desktop, BRect rect, const char* title, + Decorator* Instantiate(Desktop* desktop, DrawingEngine* engine, + BRect rect, const char* title, window_look look, uint32 flags); private: image_id fID; BString fName; - create_decorator *fAllocator; + create_decorator* fAllocator; }; @@ -71,8 +72,8 @@ DecorInfo::~DecorInfo() Decorator * -DecorInfo::Instantiate(Desktop* desktop, BRect rect, const char *title, - window_look look, uint32 flags) +DecorInfo::Instantiate(Desktop* desktop, DrawingEngine* engine, BRect rect, + const char *title, window_look look, uint32 flags) { if (!desktop->LockSingleWindow()) return NULL; @@ -92,7 +93,7 @@ DecorInfo::Instantiate(Desktop* desktop, BRect rect, const char *title, desktop->UnlockSingleWindow(); - decorator->SetDrawingEngine(desktop->GetDrawingEngine()); + decorator->SetDrawingEngine(engine); decorator->SetTitle(title); return decorator; @@ -192,10 +193,11 @@ DecorManager::RescanDecorators() Decorator * -DecorManager::AllocateDecorator(Desktop* desktop, BRect rect, const char *title, - window_look look, uint32 flags) +DecorManager::AllocateDecorator(Desktop* desktop, DrawingEngine* engine, + BRect rect, const char* title, window_look look, uint32 flags) { - // Create a new instance of the current decorator. Ownership is that of the caller + // Create a new instance of the current decorator. + // Ownership is that of the caller if (!fCurrentDecor) { // We should *never* be here. If we do, it's a bug. @@ -203,7 +205,8 @@ DecorManager::AllocateDecorator(Desktop* desktop, BRect rect, const char *title, return NULL; } - return fCurrentDecor->Instantiate(desktop, rect, title, look, flags); + return fCurrentDecor->Instantiate(desktop, engine, rect, title, + look, flags); } @@ -224,7 +227,7 @@ DecorManager::GetDecorator() const bool DecorManager::SetDecorator(int32 index) { - DecorInfo *newDecInfo = (DecorInfo*)fDecorList.ItemAt(index); + DecorInfo* newDecInfo = (DecorInfo*)fDecorList.ItemAt(index); if (newDecInfo) { fCurrentDecor = newDecInfo; diff --git a/src/servers/app/DecorManager.h b/src/servers/app/DecorManager.h index c84a7f2bb2..064a55da9c 100644 --- a/src/servers/app/DecorManager.h +++ b/src/servers/app/DecorManager.h @@ -17,7 +17,7 @@ class DecorInfo; class Desktop; - +class DrawingEngine; class DecorManager : public BLocker { public: @@ -26,8 +26,10 @@ class DecorManager : public BLocker { void RescanDecorators(); - Decorator* AllocateDecorator(Desktop* desktop, BRect rect, - const char *title, window_look look, + Decorator* AllocateDecorator(Desktop* desktop, + DrawingEngine* engine, + BRect rect, + const char* title, window_look look, uint32 flags); int32 CountDecorators() const; diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index d7da0ac2fe..816d9e5d1d 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -137,22 +137,26 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name, SetFlags(flags, NULL); if (fLook != B_NO_BORDER_WINDOW_LOOK) { - fDecorator = gDecorManager.AllocateDecorator(fDesktop, frame, name, fLook, fFlags); - if (fDecorator) - fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); + fDecorator = gDecorManager.AllocateDecorator(fDesktop, fDrawingEngine, + frame, name, fLook, fFlags); + if (fDecorator) { + fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, + &fMaxWidth, &fMaxHeight); + } } // do we need to change our size to let the decorator fit? // _ResizeBy() will adapt the frame for validity before resizing if (feel == kDesktopWindowFeel) { // the desktop window spans over the whole screen - // ToDo: this functionality should be moved somewhere else (so that it - // is always used when the workspace is changed) + // ToDo: this functionality should be moved somewhere else + // (so that it is always used when the workspace is changed) uint16 width, height; uint32 colorSpace; float frequency; if (fDesktop->ScreenAt(0)) { - fDesktop->ScreenAt(0)->GetMode(width, height, colorSpace, frequency); + fDesktop->ScreenAt(0)->GetMode(width, height, + colorSpace, frequency); // TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods! // Also, there is no TopLayer()! fFrame.OffsetTo(B_ORIGIN); @@ -797,7 +801,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken) visibleBorder->IntersectWith(&VisibleRegion()); DrawingEngine* engine = fDecorator->GetDrawingEngine(); - engine->LockExclusiveAccess(); + engine->LockParallelAccess(); engine->ConstrainClippingRegion(visibleBorder); if (fIsZooming) { @@ -808,7 +812,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken) fDecorator->SetMinimize(true); } - engine->UnlockExclusiveAccess(); + engine->UnlockParallelAccess(); fRegionPool.Recycle(visibleBorder); @@ -874,7 +878,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken) visibleBorder->IntersectWith(&VisibleRegion()); DrawingEngine* engine = fDecorator->GetDrawingEngine(); - engine->LockExclusiveAccess(); + engine->LockParallelAccess(); engine->ConstrainClippingRegion(visibleBorder); if (fIsZooming) { @@ -902,7 +906,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken) } } - engine->UnlockExclusiveAccess(); + engine->UnlockParallelAccess(); fRegionPool.Recycle(visibleBorder); } @@ -962,7 +966,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, visibleBorder->IntersectWith(&VisibleRegion()); DrawingEngine* engine = fDecorator->GetDrawingEngine(); - engine->LockExclusiveAccess(); + engine->LockParallelAccess(); engine->ConstrainClippingRegion(visibleBorder); if (fIsZooming) { @@ -973,7 +977,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, fDecorator->SetMinimize(_ActionFor(message) == DEC_MINIMIZE); } - engine->UnlockExclusiveAccess(); + engine->UnlockParallelAccess(); fRegionPool.Recycle(visibleBorder); } @@ -1267,8 +1271,8 @@ WindowLayer::SetLook(window_look look, BRegion* updateRegion) { if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator - fDecorator = gDecorManager.AllocateDecorator(fDesktop, Frame(), - Title(), fLook, fFlags); + fDecorator = gDecorManager.AllocateDecorator(fDesktop, fDrawingEngine, + Frame(), Title(), fLook, fFlags); if (IsFocus()) fDecorator->SetFocus(true); } @@ -1775,11 +1779,11 @@ WindowLayer::_DrawBorder() dirtyBorderRegion->IntersectWith(&fDirtyRegion); DrawingEngine* engine = fDecorator->GetDrawingEngine(); - if (dirtyBorderRegion->CountRects() > 0 && engine->LockExclusiveAccess()) { + if (dirtyBorderRegion->CountRects() > 0 && engine->LockParallelAccess()) { engine->ConstrainClippingRegion(dirtyBorderRegion); fDecorator->Draw(dirtyBorderRegion->Frame()); - engine->UnlockExclusiveAccess(); + engine->UnlockParallelAccess(); } fRegionPool.Recycle(dirtyBorderRegion); }