Adi's changes broke layer resizing before they are attached to the layer hierarchy.
Also fixed a drop into the debugger when starting Tracker: fRootLayer is now NULL in the constructor of WinBorder - which is not fatal, as we only wanted to get the screen size (which was formerly managed by RootLayer). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14772 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+16
-11
@@ -93,10 +93,10 @@ Layer::Layer(BRect frame, const char* name, int32 token,
|
|||||||
fOverlayBitmap(NULL)
|
fOverlayBitmap(NULL)
|
||||||
{
|
{
|
||||||
if (!frame.IsValid()) {
|
if (!frame.IsValid()) {
|
||||||
char helper[1024];
|
char helper[1024];
|
||||||
sprintf(helper, "Layer::Layer(BRect(%.1f, %.1f, %.1f, %.1f), name: %s, token: %ld) - frame is invalid\n",
|
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);
|
frame.left, frame.top, frame.right, frame.bottom, name, token);
|
||||||
CRITICAL(helper);
|
CRITICAL(helper);
|
||||||
fFrame.Set(0, 0, 1, 1);
|
fFrame.Set(0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,6 +563,7 @@ Layer::Bounds(void) const
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Matches the BView call of the same name
|
//! Matches the BView call of the same name
|
||||||
BRect
|
BRect
|
||||||
Layer::Frame(void) const
|
Layer::Frame(void) const
|
||||||
@@ -570,6 +571,7 @@ Layer::Frame(void) const
|
|||||||
return fFrame;
|
return fFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Moves the layer by specified values, complete with redraw
|
//! Moves the layer by specified values, complete with redraw
|
||||||
void
|
void
|
||||||
Layer::MoveBy(float x, float y)
|
Layer::MoveBy(float x, float y)
|
||||||
@@ -587,6 +589,7 @@ Layer::MoveBy(float x, float y)
|
|||||||
STRACE(("Layer(%s)::MoveBy() END\n", Name()));
|
STRACE(("Layer(%s)::MoveBy() END\n", Name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Resize the layer by the specified amount, complete with redraw
|
//! Resize the layer by the specified amount, complete with redraw
|
||||||
void
|
void
|
||||||
Layer::ResizeBy(float x, float y)
|
Layer::ResizeBy(float x, float y)
|
||||||
@@ -594,7 +597,9 @@ Layer::ResizeBy(float x, float y)
|
|||||||
STRACE(("Layer(%s)::ResizeBy() START\n", Name()));
|
STRACE(("Layer(%s)::ResizeBy() START\n", Name()));
|
||||||
|
|
||||||
if (!fParent) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,6 +610,7 @@ Layer::ResizeBy(float x, float y)
|
|||||||
STRACE(("Layer(%s)::ResizeBy() END\n", Name()));
|
STRACE(("Layer(%s)::ResizeBy() END\n", Name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! scrolls the layer by the specified amount, complete with redraw
|
//! scrolls the layer by the specified amount, complete with redraw
|
||||||
void
|
void
|
||||||
Layer::ScrollBy(float x, float y)
|
Layer::ScrollBy(float x, float y)
|
||||||
@@ -1327,10 +1333,9 @@ Layer::resize_layer_frame_by(float x, float y)
|
|||||||
// call hook function
|
// call hook function
|
||||||
ResizedByHook(dx, dy, true); // automatic
|
ResizedByHook(dx, dy, true); // automatic
|
||||||
|
|
||||||
for (Layer *lay = LastChild(); lay; lay = PreviousChild())
|
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
||||||
lay->resize_layer_frame_by(dx, dy);
|
child->resize_layer_frame_by(dx, dy);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
MovedByHook(dx, dy);
|
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);
|
fFrame.Set(fFrame.left, fFrame.top, fFrame.right+dx, fFrame.bottom+dy);
|
||||||
|
|
||||||
// resize children using their resize_mask.
|
// resize children using their resize_mask.
|
||||||
for (Layer *lay = LastChild(); lay; lay = PreviousChild())
|
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
||||||
lay->resize_layer_frame_by(dx, dy);
|
child->resize_layer_frame_by(dx, dy);
|
||||||
|
|
||||||
// call hook function
|
// call hook function
|
||||||
if (dx != 0.0f || dy != 0.0f)
|
if (dx != 0.0f || dy != 0.0f)
|
||||||
|
|||||||
@@ -127,12 +127,8 @@ WinBorder::WinBorder(const BRect &frame,
|
|||||||
uint16 width, height;
|
uint16 width, height;
|
||||||
uint32 colorSpace;
|
uint32 colorSpace;
|
||||||
float frequency;
|
float frequency;
|
||||||
if (GetRootLayer() == NULL)
|
if (window->App()->GetDesktop()->ScreenAt(0)) {
|
||||||
debugger("WinBorder: no root layer");
|
window->App()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
||||||
if (GetRootLayer()->GetDesktop() == NULL)
|
|
||||||
debugger("WinBorder: no desktop");
|
|
||||||
if (GetRootLayer()->GetDesktop()->ScreenAt(0)) {
|
|
||||||
GetRootLayer()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
|
||||||
_ResizeBy(width - frame.Width(), height - frame.Height());
|
_ResizeBy(width - frame.Width(), height - frame.Height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user