fixed resizing of hidden windows

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12953 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-06-04 11:18:30 +00:00
parent f9e3895bf2
commit 6a2575c9d2
2 changed files with 28 additions and 12 deletions
+18 -10
View File
@@ -110,10 +110,13 @@ Layer::Layer(BRect frame, const char* name, int32 token,
fRootLayer (NULL) fRootLayer (NULL)
{ {
// TODO: Decorator class should have a method witch if (!frame.IsValid()) {
// returns the minimum frame width. char helper[1024];
if (!frame.IsValid()) sprintf(helper, "Layer::Layer(BRect(%.1f, %.1f, %.1f, %.1f), name: %s, token: %ld) - frame is invalid\n",
fFrame.Set(0, 0, 5, 5); frame.left, frame.top, frame.right, frame.bottom, name, token);
CRITICAL(helper);
fFrame.Set(0, 0, 10, 10);
}
if (!fDriver) if (!fDriver)
CRITICAL("You MUST have a valid driver to init a Layer object\n"); CRITICAL("You MUST have a valid driver to init a Layer object\n");
@@ -122,7 +125,7 @@ Layer::Layer(BRect frame, const char* name, int32 token,
} }
//! Destructor frees all allocated heap space //! Destructor frees all allocated heap space
Layer::~Layer(void) Layer::~Layer()
{ {
delete fLayerData; delete fLayerData;
delete fName; delete fName;
@@ -146,6 +149,7 @@ void
Layer::AddChild(Layer* layer, ServerWindow* serverWin) Layer::AddChild(Layer* layer, ServerWindow* serverWin)
{ {
STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName())); STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName()));
//printf("Layer(%s)::AddChild(%s)\n", GetName(), layer->GetName());
if (layer->fParent != NULL) { if (layer->fParent != NULL) {
printf("ERROR: AddChild(): Layer already has a parent\n"); printf("ERROR: AddChild(): Layer already has a parent\n");
@@ -582,7 +586,6 @@ Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOf
//SendViewResizedMsg(); //SendViewResizedMsg();
AddToViewsWithInvalidCoords(); AddToViewsWithInvalidCoords();
newAction = B_LAYER_MASK_RESIZE; newAction = B_LAYER_MASK_RESIZE;
break; break;
} }
@@ -881,12 +884,17 @@ void
Layer::Show(bool invalidate) Layer::Show(bool invalidate)
{ {
STRACE(("Layer(%s)::Show()\n", GetName())); STRACE(("Layer(%s)::Show()\n", GetName()));
if( !IsHidden() ) if(!IsHidden())
return; return;
fHidden = false; fHidden = false;
if(invalidate) // NOTE: I added this here and it solves the invalid region problem
// for Windows that have been resized before they were shown. -Stephan
RebuildFullRegion();
SendViewCoordUpdateMsg();
if (invalidate)
GetRootLayer()->GoInvalidate(this, fFull); GetRootLayer()->GoInvalidate(this, fFull);
} }
@@ -898,12 +906,12 @@ void
Layer::Hide(bool invalidate) Layer::Hide(bool invalidate)
{ {
STRACE(("Layer(%s)::Hide()\n", GetName())); STRACE(("Layer(%s)::Hide()\n", GetName()));
if ( IsHidden() ) if (IsHidden())
return; return;
fHidden = true; fHidden = true;
if(invalidate) if (invalidate)
GetRootLayer()->GoInvalidate(this, fFullVisible); GetRootLayer()->GoInvalidate(this, fFullVisible);
} }
+9 -1
View File
@@ -413,7 +413,15 @@ WinBorder::ResizeBy(float x, float y)
if (fDecorator) if (fDecorator)
fDecorator->ResizeBy(x, y); fDecorator->ResizeBy(x, y);
resize_layer(x, y); if (IsHidden()) {
// TODO: See large comment in MoveBy()
fFrame.right += x;
fFrame.bottom += y;
fTopLayer->resize_layer(x, y);
} else {
resize_layer(x, y);
}
if (Window()) { if (Window()) {
// send a message to the client informing about the changed size // send a message to the client informing about the changed size