From 7cdea13cf9d765ef86793ebab86f6167ee179abf Mon Sep 17 00:00:00 2001 From: looncraz Date: Mon, 11 Jul 2016 02:47:23 +0000 Subject: [PATCH] BBox: Correct low color for drawing label. Includes some simplification for existing code. Fixes #12628, which was mostly exhibited in FilWip and a few other legacy applications which used the default low color and a custom background color. Signed-off-by: Augustin Cavalier --- src/kits/interface/Box.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp index 481cba0c3b..7efdbb45c9 100644 --- a/src/kits/interface/Box.cpp +++ b/src/kits/interface/Box.cpp @@ -273,11 +273,17 @@ BBox::AttachedToWindow() { AdoptParentColors(); - if (ViewColor() == B_TRANSPARENT_COLOR) { - SetViewUIColor(B_PANEL_BACKGROUND_COLOR); - SetLowUIColor(B_PANEL_BACKGROUND_COLOR); - SetHighUIColor(B_PANEL_TEXT_COLOR); - } + // Force low color to match view color for proper label drawing. + float viewTint = B_NO_TINT; + float lowTint = B_NO_TINT; + + if (LowUIColor(&lowTint) != ViewUIColor(&viewTint) || viewTint != lowTint) + SetLowUIColor(ViewUIColor(), viewTint); + else if (LowColor() != ViewColor()) + SetLowColor(ViewColor()); + + if (ViewColor() == B_TRANSPARENT_COLOR) + AdoptSystemColors(); // The box could have been resized in the mean time fBounds = Bounds(); @@ -659,7 +665,7 @@ BBox::_InitObject(BMessage* archive) fLabelView = ChildAt(0); } - SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + AdoptSystemColors(); }