From 6309b004c6d59d1d926ea21befab805ab57f633d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 14 Jun 2008 20:51:20 +0000 Subject: [PATCH] When drawing the decorator buttons lock the DrawingEngine, enable copying to the front buffer, draw the bitmap, restore the copy to front buffer state and unlock. This fixes that the updated button state was not actually copyied to the front buffer (and therefore visible) when a window was inside an update (disabling front buffer copying). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25954 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/DefaultDecorator.cpp | 26 ++++++++++++++++++-------- src/servers/app/DefaultDecorator.h | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/DefaultDecorator.cpp index 863ed0daae..fc40b06505 100644 --- a/src/servers/app/DefaultDecorator.cpp +++ b/src/servers/app/DefaultDecorator.cpp @@ -996,10 +996,7 @@ DefaultDecorator::_DrawClose(BRect rect) fCloseBitmaps[index] = bitmap; } - if (bitmap == NULL) - return; - - fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + _DrawButtonBitmap(bitmap, rect); } @@ -1050,10 +1047,7 @@ DefaultDecorator::_DrawZoom(BRect rect) fZoomBitmaps[index] = bitmap; } - if (bitmap == NULL) - return; - - fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + _DrawButtonBitmap(bitmap, rect); } // _SetFocus @@ -1093,6 +1087,22 @@ DefaultDecorator::_SetColors() } +void +DefaultDecorator::_DrawButtonBitmap(ServerBitmap *bitmap, BRect rect) +{ + if (bitmap == NULL) + return; + + if (fDrawingEngine->LockParallelAccess()) { + bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); + fDrawingEngine->SetCopyToFrontEnabled(true); + fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled); + fDrawingEngine->UnlockParallelAccess(); + } +} + + /*! \brief Draws a framed rectangle with a gradient. \param down The rectangle should be drawn recessed or not diff --git a/src/servers/app/DefaultDecorator.h b/src/servers/app/DefaultDecorator.h index 07e0140862..d54488b911 100644 --- a/src/servers/app/DefaultDecorator.h +++ b/src/servers/app/DefaultDecorator.h @@ -68,6 +68,8 @@ class DefaultDecorator: public Decorator { virtual void _SetColors(); private: + void _DrawButtonBitmap(ServerBitmap *bitmap, + BRect rect); void _DrawBlendedRect(DrawingEngine *engine, BRect rect, bool down, bool focus); void _GetButtonSizeAndOffset(const BRect& tabRect,