diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index b4a5c62ab6..d1fb9c9746 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1761,11 +1761,12 @@ Window::_DrawBorder() if (dirtyBorderRegion->CountRects() > 0 && engine->LockParallelAccess()) { engine->ConstrainClippingRegion(dirtyBorderRegion); bool copyToFrontEnabled = engine->CopyToFrontEnabled(); - engine->SetCopyToFrontEnabled(true); + engine->SetCopyToFrontEnabled(false); decorator->Draw(dirtyBorderRegion->Frame()); engine->SetCopyToFrontEnabled(copyToFrontEnabled); + engine->CopyToFront(*dirtyBorderRegion); // TODO: remove this once the DrawState stuff is handled // more cleanly. The reason why this is needed is that diff --git a/src/servers/app/decorator/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp index 837a2f9e93..765b672a90 100644 --- a/src/servers/app/decorator/Decorator.cpp +++ b/src/servers/app/decorator/Decorator.cpp @@ -651,10 +651,10 @@ Decorator::DrawTab(int32 tabIndex) return; _DrawTab(tab, tab->tabRect); - _DrawZoom(tab, tab->zoomRect); - _DrawMinimize(tab, tab->minimizeRect); + _DrawZoom(tab, false, tab->zoomRect); + _DrawMinimize(tab, false, tab->minimizeRect); _DrawTitle(tab, tab->tabRect); - _DrawClose(tab, tab->closeRect); + _DrawClose(tab, false, tab->closeRect); } @@ -665,7 +665,7 @@ Decorator::DrawClose(int32 tab) Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); if (decoratorTab == NULL) return; - _DrawClose(decoratorTab, decoratorTab->closeRect); + _DrawClose(decoratorTab, true, decoratorTab->closeRect); } @@ -698,7 +698,7 @@ Decorator::DrawZoom(int32 tab) Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); if (decoratorTab == NULL) return; - _DrawZoom(decoratorTab, decoratorTab->zoomRect); + _DrawZoom(decoratorTab, true, decoratorTab->zoomRect); } @@ -779,7 +779,7 @@ Decorator::_DrawTab(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawClose(Decorator::Tab* tab, BRect rect) +Decorator::_DrawClose(Decorator::Tab* tab, bool direct, BRect rect) { } @@ -807,7 +807,7 @@ Decorator::_DrawTitle(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect) +Decorator::_DrawZoom(Decorator::Tab* tab, bool direct, BRect rect) { } @@ -820,7 +820,7 @@ Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawMinimize(Decorator::Tab* tab, BRect rect) +Decorator::_DrawMinimize(Decorator::Tab* tab, bool direct, BRect rect) { } diff --git a/src/servers/app/decorator/Decorator.h b/src/servers/app/decorator/Decorator.h index 66451ec334..4df65ada0d 100644 --- a/src/servers/app/decorator/Decorator.h +++ b/src/servers/app/decorator/Decorator.h @@ -173,10 +173,14 @@ protected: virtual void _DrawTabs(BRect rect); virtual void _DrawTab(Decorator::Tab* tab, BRect rect); - virtual void _DrawClose(Decorator::Tab* tab, BRect rect); virtual void _DrawTitle(Decorator::Tab* tab, BRect rect); - virtual void _DrawZoom(Decorator::Tab* tab, BRect rect); - virtual void _DrawMinimize(Decorator::Tab* tab, BRect rect); + //! direct means drawing without double buffering + virtual void _DrawClose(Decorator::Tab* tab, bool direct, + BRect rect); + virtual void _DrawZoom(Decorator::Tab* tab, bool direct, + BRect rect); + virtual void _DrawMinimize(Decorator::Tab* tab, bool direct, + BRect rect); virtual Decorator::Tab* _AllocateNewTab() = 0; diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index fe0fb01dad..41d49c36f5 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -952,7 +952,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) void -DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect) +DefaultDecorator::_DrawClose(Decorator::Tab* _tab, bool direct, BRect rect) { STRACE(("_DrawClose(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); @@ -967,7 +967,7 @@ DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect) tab->closeBitmaps[index] = bitmap; } - _DrawButtonBitmap(bitmap, rect); + _DrawButtonBitmap(bitmap, direct, rect); } @@ -1016,7 +1016,7 @@ DefaultDecorator::_DrawTitle(Decorator::Tab* _tab, BRect r) void -DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect) +DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, bool direct, BRect rect) { STRACE(("_DrawZoom(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); @@ -1032,7 +1032,7 @@ DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect) tab->zoomBitmaps[index] = bitmap; } - _DrawButtonBitmap(bitmap, rect); + _DrawButtonBitmap(bitmap, direct, rect); } @@ -1397,7 +1397,7 @@ DefaultDecorator::_AddTab(int32 index, BRegion* updateRegion) bool -DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion ) +DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion) { BRect oldTitle = fTitleBarRect; _DoLayout(); @@ -1475,9 +1475,9 @@ DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid) { // Draw the buttons if we're supposed to if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect)) - _DrawClose(tab, tab->closeRect); + _DrawClose(tab, false, tab->closeRect); if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect)) - _DrawZoom(tab, tab->zoomRect); + _DrawZoom(tab, false, tab->zoomRect); } @@ -1574,13 +1574,14 @@ DefaultDecorator::_UpdateFont(DesktopSettings& settings) void -DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect) +DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, bool direct, + BRect rect) { if (bitmap == NULL) return; bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); - fDrawingEngine->SetCopyToFrontEnabled(true); + fDrawingEngine->SetCopyToFrontEnabled(direct); drawing_mode oldMode; fDrawingEngine->SetDrawingMode(B_OP_OVER, oldMode); fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); diff --git a/src/servers/app/decorator/DefaultDecorator.h b/src/servers/app/decorator/DefaultDecorator.h index 8bf3b07007..2297374494 100644 --- a/src/servers/app/decorator/DefaultDecorator.h +++ b/src/servers/app/decorator/DefaultDecorator.h @@ -113,11 +113,14 @@ protected: virtual void _DrawFrame(BRect r); virtual void _DrawTab(Decorator::Tab* tab, BRect r); - virtual void _DrawClose(Decorator::Tab* tab, BRect r); + virtual void _DrawClose(Decorator::Tab* tab, bool direct, + BRect r); virtual void _DrawTitle(Decorator::Tab* tab, BRect r); - virtual void _DrawZoom(Decorator::Tab* tab, BRect r); + virtual void _DrawZoom(Decorator::Tab* tab, bool direct, + BRect r); - virtual void _SetTitle(Decorator::Tab* tab, const char* string, + virtual void _SetTitle(Decorator::Tab* tab, + const char* string, BRegion* updateRegion = NULL); virtual void _SetFocus(Decorator::Tab* tab); @@ -162,7 +165,7 @@ protected: private: void _UpdateFont(DesktopSettings& settings); void _DrawButtonBitmap(ServerBitmap* bitmap, - BRect rect); + bool direct, BRect rect); void _DrawBlendedRect(DrawingEngine *engine, BRect rect, bool down, const ComponentColors& colors);