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

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 24 Mar 2017 16:35:48 +0100 (CET)

hrev51035 adds 1 changeset to branch 'master'
old head: a652a5fed3f065fba18791bd24f425059c927cf4
new head: ff4dee1cafee7a9bf111fc361e58e7829e4852cf
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=ff4dee1cafee+%5Ea652a5fed3f0

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

ff4dee1cafee: BView/BBox: Fixed FrameResized() handling.
  
  * BView incorrectly passed the current width and height to
    FrameResized(), not the one from the message. Since there is such
    a call for each size change, a Draw() might have been called for
    each of those in return.
  * This should also fix such problems in BMenuBar, as it used the size
    from FrameResized() as it should have.
  * BBox now correctly takes the update events into account, and no
    longer ignores the size passed to FrameResized().
  * This fixes bug #3037.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

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

Revision:    hrev51035
Commit:      ff4dee1cafee7a9bf111fc361e58e7829e4852cf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ff4dee1cafee
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Fri Mar 24 15:27:15 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/3037

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

2 files changed, 8 insertions(+), 9 deletions(-)
src/kits/interface/Box.cpp  | 9 +++++----
src/kits/interface/View.cpp | 8 +++-----

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

diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp
index 7efdbb4..955bd0f 100644
--- a/src/kits/interface/Box.cpp
+++ b/src/kits/interface/Box.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2015 Haiku, Inc. All Rights Reserved.
+ * Copyright 2001-2017 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT license.
  *
  * Authors:
@@ -322,7 +322,7 @@ BBox::FrameResized(float width, float height)
                // TODO: this must be made part of the be_control_look stuff!
                int32 borderSize = fStyle == B_PLAIN_BORDER ? 0 : 2;
 
-               BRect invalid(bounds);
+               BRect invalid(fBounds);
                if (fBounds.right < bounds.right) {
                        // enlarging
                        invalid.left = fBounds.right - borderSize;
@@ -351,8 +351,8 @@ BBox::FrameResized(float width, float height)
                }
        }
 
-       fBounds.right = bounds.right;
-       fBounds.bottom = bounds.bottom;
+       fBounds.right = fBounds.left + width;
+       fBounds.bottom = fBounds.top + height;
 }
 
 
@@ -395,6 +395,7 @@ void
 BBox::FrameMoved(BPoint newLocation)
 {
        BView::FrameMoved(newLocation);
+       fBounds.OffsetTo(newLocation);
 }
 
 
diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp
index fb7a55f..8f164a6 100644
--- a/src/kits/interface/View.cpp
+++ b/src/kits/interface/View.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2015 Haiku, Inc. All rights reserved.
+ * Copyright 2001-2017 Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -4894,10 +4894,8 @@ BView::MessageReceived(BMessage* message)
        if (!message->HasSpecifiers()) {
                switch (message->what) {
                        case B_VIEW_RESIZED:
-                               // By the time the message arrives, the bounds 
may have
-                               // changed already, that's why we don't use the 
values
-                               // in the message itself.
-                               FrameResized(fBounds.Width(), fBounds.Height());
+                               FrameResized(message->GetInt32("width", 0),
+                                       message->GetInt32("height", 0));
                                break;
 
                        case B_VIEW_MOVED:


Other related posts: