diff --git a/src/servers/app/Layer.cpp b/src/servers/app/Layer.cpp index 13d8757842..309980db91 100644 --- a/src/servers/app/Layer.cpp +++ b/src/servers/app/Layer.cpp @@ -93,10 +93,10 @@ Layer::Layer(BRect frame, const char* name, int32 token, fOverlayBitmap(NULL) { 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); + 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, 1, 1); } @@ -563,6 +563,7 @@ Layer::Bounds(void) const return r; } + //! Matches the BView call of the same name BRect Layer::Frame(void) const @@ -570,6 +571,7 @@ Layer::Frame(void) const return fFrame; } + //! Moves the layer by specified values, complete with redraw void Layer::MoveBy(float x, float y) @@ -587,6 +589,7 @@ Layer::MoveBy(float x, float y) STRACE(("Layer(%s)::MoveBy() END\n", Name())); } + //! Resize the layer by the specified amount, complete with redraw void Layer::ResizeBy(float x, float y) @@ -594,7 +597,9 @@ Layer::ResizeBy(float x, float y) STRACE(("Layer(%s)::ResizeBy() START\n", Name())); if (!fParent) { - printf("ERROR: in Layer::ResizeBy()! - No parent!\n"); + // there is no parent yet, so we'll silently adopt the new size + fFrame.right += x; + fFrame.bottom += y; return; } @@ -605,6 +610,7 @@ Layer::ResizeBy(float x, float y) STRACE(("Layer(%s)::ResizeBy() END\n", Name())); } + //! scrolls the layer by the specified amount, complete with redraw void Layer::ScrollBy(float x, float y) @@ -1327,10 +1333,9 @@ Layer::resize_layer_frame_by(float x, float y) // call hook function ResizedByHook(dx, dy, true); // automatic - for (Layer *lay = LastChild(); lay; lay = PreviousChild()) - lay->resize_layer_frame_by(dx, dy); - } - else + for (Layer *child = LastChild(); child != NULL; child = PreviousChild()) + child->resize_layer_frame_by(dx, dy); + } else MovedByHook(dx, dy); } } @@ -1412,8 +1417,8 @@ Layer::do_ResizeBy(float dx, float dy) fFrame.Set(fFrame.left, fFrame.top, fFrame.right+dx, fFrame.bottom+dy); // resize children using their resize_mask. - for (Layer *lay = LastChild(); lay; lay = PreviousChild()) - lay->resize_layer_frame_by(dx, dy); + for (Layer *child = LastChild(); child != NULL; child = PreviousChild()) + child->resize_layer_frame_by(dx, dy); // call hook function if (dx != 0.0f || dy != 0.0f) diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index 1c1724cc3b..745a02fa96 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -127,12 +127,8 @@ WinBorder::WinBorder(const BRect &frame, uint16 width, height; uint32 colorSpace; float frequency; - if (GetRootLayer() == NULL) - debugger("WinBorder: no root layer"); - if (GetRootLayer()->GetDesktop() == NULL) - debugger("WinBorder: no desktop"); - if (GetRootLayer()->GetDesktop()->ScreenAt(0)) { - GetRootLayer()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency); + if (window->App()->GetDesktop()->ScreenAt(0)) { + window->App()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency); _ResizeBy(width - frame.Width(), height - frame.Height()); } }