Hi Adi,
> > {
> > - // TODO: Decorator class should have a method witch
> > - // returns the minimum frame width.
> > - if (!frame.IsValid())
> > - fFrame.Set(0, 0, 5, 5);
> > + if (!frame.IsValid()) {
> > +char helper[1024];
> > +sprintf(helper, "Layer::Layer(BRect(%.1f, %.1f, %.1f, %.1f), name:
> > %s, token: %ld) - frame is invalid\n",
> > + frame.left, frame.top, frame.right, frame.bottom, name,
> > token);
> > +CRITICAL(helper);
> > + fFrame.Set(0, 0, 10, 10);
> > + }
>
> Here, we really need a method that just does what I wrote in the
> TODO
> you deleted. Don't think about "be" decorator only.
We are within Layer. Not WinBorder. Layer has nothing to do with the
Decorator. For WinBorder, I implemented exactly the function from your
TODO in Decorator, and it is indeed called in the WinBorder
constructor.
> > Layer::Show(bool invalidate)
> > {
> > STRACE(("Layer(%s)::Show()\n", GetName()));
> > - if( !IsHidden() )
> > + if(!IsHidden())
> > return;
> >
> > 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);
> > }
>
> You should, under no circumstances call RebuildFullRegion() from
> another thread than RootLayer's one. I can guarantee this can have
> very
> ugly consequences. For example try moving a window while you show/
> hide
> another.
Well, you might be right about doing this in the wrong thread, I have
not looked which thread calls Show. But what I do there fixes a certain
problem, where layers are all screwed up when the window has been
resized programatically before being shown the first time. For me, this
is only a short term fix to an annoying problem, which I'm hoping is
fixed in your new code anyways.
> > - 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()) {
> > // send a message to the client informing about the
> > changed size
> > BRect frame(fTopLayer->Frame());
>
> Same here.
No, I don't think you're right here because I didn't move or add this
functionality. I just resize a different layer in case the WinBorder is
hidden. The resizing itself was always at this place.
Best regards,
-Stephan