Ticket #12628: Patch-12628.patch

File Patch-12628.patch, 1.5 KB (added by looncraz, 3 years ago)

Sets BBox low color properly for legacy applications.

  • src/kits/interface/Box.cpp

    From fc6bd9b7ace2d74675165043bcf4ee3fb5aee7e6 Mon Sep 17 00:00:00 2001
    From: looncraz <looncraz@looncraz.net>
    Date: Mon, 11 Jul 2016 02:47:23 +0000
    Subject: [PATCH] Correct BBox low color for drawing label.
    
    Includes some simplification for existing code.
    
    Fixes ticket# 12628 - which was mostly exhibited in FilWip and a few other legacy
    applications which used the default low color and a custom background color.
    ---
     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 481cba0..7efdbb4 100644
    a b BBox::AttachedToWindow()  
    273273{
    274274    AdoptParentColors();
    275275
    276     if (ViewColor() == B_TRANSPARENT_COLOR) {
    277         SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
    278         SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
    279         SetHighUIColor(B_PANEL_TEXT_COLOR);
    280     }
     276    // Force low color to match view color for proper label drawing.
     277    float viewTint = B_NO_TINT;
     278    float lowTint = B_NO_TINT;
     279
     280    if (LowUIColor(&lowTint) != ViewUIColor(&viewTint) || viewTint != lowTint)
     281        SetLowUIColor(ViewUIColor(), viewTint);
     282    else if (LowColor() != ViewColor())
     283        SetLowColor(ViewColor());
     284
     285    if (ViewColor() == B_TRANSPARENT_COLOR)
     286        AdoptSystemColors();
    281287
    282288    // The box could have been resized in the mean time
    283289    fBounds = Bounds();
    BBox::_InitObject(BMessage* archive)  
    659665            fLabelView = ChildAt(0);
    660666    }
    661667
    662     SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
     668    AdoptSystemColors();
    663669}
    664670
    665671