From 04039d6f30393bb4eb9612cbb69cf355859cf696 Mon Sep 17 00:00:00 2001 From: looncraz Date: Tue, 19 Jul 2016 15:47:13 +0000 Subject: [PATCH] BStringView: Proper color inheritence. Legacy applications setting colors manually on BStringView would prevent the BStringView from inheriting theparent view color. Most legacy applications that did this also set the view color manually, so this went unnoticed except in Beezer's Preferences window. This fix introduces another, minor, issue for legacy applications that do the same thing - they will not receive the system default panel text color. In most instances, you don't want that happening anyway, so it's not much of an issue. Fixes #12868. Signed-off-by: Augustin Cavalier --- src/kits/interface/StringView.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/kits/interface/StringView.cpp b/src/kits/interface/StringView.cpp index 29a6c93f75..6f39ebd408 100644 --- a/src/kits/interface/StringView.cpp +++ b/src/kits/interface/StringView.cpp @@ -128,16 +128,26 @@ BStringView::Archive(BMessage* data, bool deep) const void BStringView::AttachedToWindow() { - if (HasDefaultColors()) { - AdoptParentColors(); + if (HasDefaultColors()) SetHighUIColor(B_PANEL_TEXT_COLOR); + + BView* parent = Parent(); + + if (parent != NULL) { + float tint = B_NO_TINT; + color_which which = parent->ViewUIColor(&tint); + + if (which != B_NO_COLOR) { + SetViewUIColor(which, tint); + SetLowUIColor(which, tint); + } else { + SetViewColor(parent->ViewColor()); + SetLowColor(ViewColor()); + } } - if (ViewColor() == B_TRANSPARENT_COLOR) { - SetViewUIColor(B_PANEL_BACKGROUND_COLOR); - SetLowUIColor(B_PANEL_BACKGROUND_COLOR); - SetHighUIColor(B_PANEL_TEXT_COLOR); - } + if (ViewColor() == B_TRANSPARENT_COLOR) + AdoptSystemColors(); }