[haiku-commits] haiku: hrev49993 - src/kits/interface

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 7 Jan 2016 03:57:32 +0100 (CET)

hrev49993 adds 1 changeset to branch 'master'
old head: 8487f27d5b4793613c31866db36cf40d5d14bca2
new head: c9bd4d84b9992c986063f5cfebf92787324e0276
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=c9bd4d84b999+%5E8487f27d5b47

----------------------------------------------------------------------------

c9bd4d84b999: Interface Kit: Correct button colors.
  
  What appeared to be multiple issues was just one issue: BButton was drawing 
the
  control background color for its border, whereas the previous system drew the
  control low color, which was the parent's view color.
  
  Neither is correct, no border should be drawn at all.
  
  This made it appear that the default button was larger than it was and also
  made it appear that some apps had a "white" border around the buttons.
  
  In addition, BButton can now use the default BControl color behavior and
  BButton exclusively adopt either parental or system colors without worrying
  about the case in which another view has set the button's view color manually.
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

                                        [ looncraz <looncraz@xxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev49993
Commit:      c9bd4d84b9992c986063f5cfebf92787324e0276
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c9bd4d84b999
Author:      looncraz <looncraz@xxxxxxxxxxxx>
Date:        Thu Jan  7 02:25:39 2016 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Wed Jan  6 21:55:14 2016 UTC

----------------------------------------------------------------------------

3 files changed, 8 insertions(+), 24 deletions(-)
src/kits/interface/Button.cpp      | 21 +++------------------
src/kits/interface/Control.cpp     |  6 ++++--
src/kits/interface/ControlLook.cpp |  5 +----

----------------------------------------------------------------------------

diff --git a/src/kits/interface/Button.cpp b/src/kits/interface/Button.cpp
index 68b2884..ab728e5 100644
--- a/src/kits/interface/Button.cpp
+++ b/src/kits/interface/Button.cpp
@@ -132,14 +132,11 @@ BButton::Archive(BMessage* data, bool deep) const
 void
 BButton::Draw(BRect updateRect)
 {
-       // Allow improved customization & integration
-       float buttonTint = B_DARKEN_1_TINT;
-       if (ViewUIColor() != B_CONTROL_BACKGROUND_COLOR)
-               buttonTint = B_NO_TINT;
-
        BRect rect(Bounds());
        rgb_color background = LowColor();
-       rgb_color base = tint_color(ViewColor(), buttonTint);
+
+       // Darken default control color to match default panel color.
+       rgb_color base = tint_color(ui_color(B_CONTROL_BACKGROUND_COLOR), 
1.115);
        uint32 flags = be_control_look->Flags(this);
        if (_Flag(FLAG_DEFAULT))
                flags |= BControlLook::B_DEFAULT_BUTTON;
@@ -232,18 +229,6 @@ void
 BButton::AttachedToWindow()
 {
        BControl::AttachedToWindow();
-       SetViewUIColor(B_CONTROL_BACKGROUND_COLOR);
-
-       // Ensure BButton's low color is the parent's VIEW color.
-       // We don't want to adopt the standard control lowcolor.
-       if (Parent() != NULL) {
-               float tint = B_NO_TINT;
-               color_which which = ViewUIColor(&tint);
-               if (which != B_NO_COLOR)
-                       SetLowUIColor(which, tint);
-               else
-                       SetLowColor(ViewColor());
-       }
 
        if (IsDefault())
                Window()->SetDefaultButton(this);
diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp
index 1882e8b..3009da4 100644
--- a/src/kits/interface/Control.cpp
+++ b/src/kits/interface/Control.cpp
@@ -153,8 +153,10 @@ BControl::AttachedToWindow()
 {
        AdoptParentColors();
 
-       if (ViewColor() == B_TRANSPARENT_COLOR)
-               SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+       if (ViewColor() == B_TRANSPARENT_COLOR
+               || Parent() == NULL) {
+               AdoptSystemColors();
+       }
 
        // Force view color as low color
        if (Parent() != NULL) {
diff --git a/src/kits/interface/ControlLook.cpp 
b/src/kits/interface/ControlLook.cpp
index dfeb6e3..e4c3152 100644
--- a/src/kits/interface/ControlLook.cpp
+++ b/src/kits/interface/ControlLook.cpp
@@ -2159,10 +2159,7 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
                        brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9), 
flags);
 
                // draw default button indicator
-               view->SetHighColor(background);
-               view->FillRect(rect);
-               view->SetHighColor(base);
-               view->StrokeRoundRect(rect, leftTopRadius, leftTopRadius);
+               // Allow a 1-pixel border of the background to come through.
                rect.InsetBy(1, 1);
 
                view->SetHighColor(defaultIndicatorColor);


Other related posts:

  • » [haiku-commits] haiku: hrev49993 - src/kits/interface - waddlesplash