From 37ba7e5389bce2deb834448303895edd1905a3e6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 26 Nov 2010 14:52:56 +0000 Subject: [PATCH] Flush the bitmap caches for the zoom and close button, when their hightlight changes. Fixes that the buttons were not drawn with the right color when the S&T tab highlight was active. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39648 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/DefaultDecorator.cpp | 24 +++++++++++++++++++++++- src/servers/app/DefaultDecorator.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/DefaultDecorator.cpp index c75dc503aa..2ca05d72f4 100644 --- a/src/servers/app/DefaultDecorator.cpp +++ b/src/servers/app/DefaultDecorator.cpp @@ -242,6 +242,29 @@ DefaultDecorator::RegionAt(BPoint where) const } +bool +DefaultDecorator::SetRegionHighlight(Region region, uint8 highlight, + BRegion* dirty) +{ + // Invalidate the bitmap caches for the close/zoom button, when the + // highlight changes. + switch (region) { + case REGION_CLOSE_BUTTON: + if (highlight != RegionHighlight(region)) + memset(&fCloseBitmaps, 0, sizeof(fCloseBitmaps)); + break; + case REGION_ZOOM_BUTTON: + if (highlight != RegionHighlight(region)) + memset(&fZoomBitmaps, 0, sizeof(fZoomBitmaps)); + break; + default: + break; + } + + return Decorator::SetRegionHighlight(region, highlight, dirty); +} + + void DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty) { @@ -1500,7 +1523,6 @@ DefaultDecorator::_GetBitmapForButton(Component item, bool down, int32 width, } - void DefaultDecorator::_GetComponentColors(Component component, ComponentColors _colors) diff --git a/src/servers/app/DefaultDecorator.h b/src/servers/app/DefaultDecorator.h index b371b7f740..329297cafd 100644 --- a/src/servers/app/DefaultDecorator.h +++ b/src/servers/app/DefaultDecorator.h @@ -40,6 +40,9 @@ public: virtual Region RegionAt(BPoint where) const; + virtual bool SetRegionHighlight(Region region, + uint8 highlight, BRegion* dirty); + virtual void ExtendDirtyRegion(Region region, BRegion& dirty);