Skip to content

Commit

Permalink
BView/BBox: Fixed FrameResized() handling.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
axeld committed Mar 24, 2017
1 parent a652a5f commit ff4dee1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 5 additions & 4 deletions 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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}


Expand Down Expand Up @@ -395,6 +395,7 @@ void
BBox::FrameMoved(BPoint newLocation)
{
BView::FrameMoved(newLocation);
fBounds.OffsetTo(newLocation);
}


Expand Down
8 changes: 3 additions & 5 deletions 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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ff4dee1

Please sign in to comment.