From 3e08f2160607185a7b85ba93d58537a8086fcca7 Mon Sep 17 00:00:00 2001 From: looncraz Date: Sun, 17 Jan 2016 12:06:36 +0000 Subject: [PATCH] MenuField Low Color (for frame) BMenuField's frame is drawn from the LowColor() which is adopted from its parent. However, we should be adopting the parent's view color for our low color, otherwise we sometimes end up with a miscolored border (most often white). This was not noticed earlier as most views have matching view and low colors. Fixes ticket #12603 Signed-off-by: Augustin Cavalier --- src/kits/interface/MenuField.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 3318dad21c..62aa993415 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -428,7 +428,20 @@ void BMenuField::AttachedToWindow() { CALLED(); - AdoptParentColors(); + + // Our low color must match the parent's view color. + if (Parent() != NULL) { + AdoptParentColors(); + + float tint = B_NO_TINT; + color_which which = ViewUIColor(&tint); + + if (which == B_NO_COLOR) + SetLowColor(ViewColor()); + else + SetLowUIColor(which, tint); + } else + AdoptSystemColors(); } @@ -1065,7 +1078,7 @@ BMenuField::_DrawLabel(BRect updateRect) flags |= BControlLook::B_DISABLED; // save the current low color - const rgb_color lowColor = LowColor(); + PushState(); rgb_color textColor; MenuPrivate menuPrivate(fMenuBar); @@ -1082,7 +1095,7 @@ BMenuField::_DrawLabel(BRect updateRect) BAlignment(fAlign, B_ALIGN_MIDDLE), &textColor); // restore the previous low color - SetLowColor(lowColor); + PopState(); }