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 <[email protected]>
This commit is contained in:
looncraz
2016-07-19 20:28:38 -04:00
committed by Augustin Cavalier
parent dcdb22ed4e
commit 04039d6f30
+17 -7
View File
@@ -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();
}