Ticket #12868: Patch-12868.patch

File Patch-12868.patch, 1.8 KB (added by looncraz, 3 years ago)
  • src/kits/interface/StringView.cpp

    From 42ce7c7539a271881b786ce3342b467729a4a650 Mon Sep 17 00:00:00 2001
    From: looncraz <looncraz@looncraz.net>
    Date: Tue, 19 Jul 2016 15:47:13 +0000
    Subject: [PATCH] StringView 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 ticket# 12868
    ---
     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 29a6c93..6f39ebd 100644
    a b BStringView::Archive(BMessage* data, bool deep) const  
    128128void
    129129BStringView::AttachedToWindow()
    130130{
    131     if (HasDefaultColors()) {
    132         AdoptParentColors();
     131    if (HasDefaultColors())
    133132        SetHighUIColor(B_PANEL_TEXT_COLOR);
    134     }
    135133
    136     if (ViewColor() == B_TRANSPARENT_COLOR) {
    137         SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
    138         SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
    139         SetHighUIColor(B_PANEL_TEXT_COLOR);
     134    BView* parent = Parent();
     135
     136    if (parent != NULL) {
     137        float tint = B_NO_TINT;
     138        color_which which = parent->ViewUIColor(&tint);
     139
     140        if (which != B_NO_COLOR) {
     141            SetViewUIColor(which, tint);
     142            SetLowUIColor(which, tint);
     143        } else {
     144            SetViewColor(parent->ViewColor());
     145            SetLowColor(ViewColor());
     146        }
    140147    }
     148
     149    if (ViewColor() == B_TRANSPARENT_COLOR)
     150        AdoptSystemColors();
    141151}
    142152
    143153