Some minor work on minimum window sizes. A WinBorder now makes sure it has
a valid size on construction; DefaultDecorator should do that as well. ServerApp AS_CREATE_WINDOW now makes sure it passes a valid rectangle to ServerWindow's constructor. Smaller default size for Layers that have been created with an invalid frame. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13291 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -58,8 +58,11 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
|
|||||||
// Do initial decorator setup
|
// Do initial decorator setup
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
|
|
||||||
|
// ToDo: if the decorator was created with a frame too small, it should resize itself!
|
||||||
|
|
||||||
STRACE(("DefaultDecorator:\n"));
|
STRACE(("DefaultDecorator:\n"));
|
||||||
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",
|
||||||
|
rect.left, rect.top, rect.right, rect.bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultDecorator::~DefaultDecorator(void)
|
DefaultDecorator::~DefaultDecorator(void)
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ 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, 10, 10);
|
fFrame.Set(0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fDriver)
|
if (!fDriver)
|
||||||
@@ -1040,7 +1040,7 @@ void
|
|||||||
Layer::ResizeBy(float x, float y)
|
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");
|
printf("ERROR: in Layer::ResizeBy()! - No parent!\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -443,6 +443,12 @@ ServerApp::_MessageLooper()
|
|||||||
if (receiver.ReadString(&title) != B_OK)
|
if (receiver.ReadString(&title) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (!frame.IsValid()) {
|
||||||
|
// make sure we pass a valid rectangle to ServerWindow
|
||||||
|
frame.right = frame.left + 1;
|
||||||
|
frame.bottom = frame.top + 1;
|
||||||
|
}
|
||||||
|
|
||||||
// ServerWindow constructor will reply with port_id of a newly created port
|
// ServerWindow constructor will reply with port_id of a newly created port
|
||||||
ServerWindow *window = new ServerWindow(title, this, clientReplyPort,
|
ServerWindow *window = new ServerWindow(title, this, clientReplyPort,
|
||||||
looperPort, token, frame, look, feel, flags, workspaces);
|
looperPort, token, frame, look, feel, flags, workspaces);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
# define STRACE_CLICK(x) ;
|
# define STRACE_CLICK(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WinBorder::WinBorder(const BRect &r,
|
WinBorder::WinBorder(const BRect &frame,
|
||||||
const char *name,
|
const char *name,
|
||||||
const uint32 wlook,
|
const uint32 wlook,
|
||||||
const uint32 wfeel,
|
const uint32 wfeel,
|
||||||
@@ -65,7 +65,7 @@ WinBorder::WinBorder(const BRect &r,
|
|||||||
const uint32 wwksindex,
|
const uint32 wwksindex,
|
||||||
ServerWindow *win,
|
ServerWindow *win,
|
||||||
DisplayDriver *driver)
|
DisplayDriver *driver)
|
||||||
: Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
|
: Layer(frame, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
|
||||||
fDecorator(NULL),
|
fDecorator(NULL),
|
||||||
fTopLayer(NULL),
|
fTopLayer(NULL),
|
||||||
|
|
||||||
@@ -116,10 +116,29 @@ WinBorder::WinBorder(const BRect &r,
|
|||||||
QuietlySetFeel(wfeel);
|
QuietlySetFeel(wfeel);
|
||||||
|
|
||||||
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
|
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
|
||||||
fDecorator = gDecorManager.AllocateDecorator(r, name, fLook, fFeel,
|
// ToDo: these should probably restricted by the decorator only, but
|
||||||
|
// the code there doesn't look too robust to me currently
|
||||||
|
fMinWidth = 20;
|
||||||
|
fMinHeight = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fFrame.Width() < fMinWidth)
|
||||||
|
fFrame.right = fFrame.left + fMinWidth;
|
||||||
|
if (fFrame.Height() < fMinHeight)
|
||||||
|
fFrame.bottom = fFrame.top + fMinHeight;
|
||||||
|
|
||||||
|
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
|
||||||
|
fDecorator = gDecorManager.AllocateDecorator(frame, name, fLook, fFeel,
|
||||||
fWindowFlags, fDriver);
|
fWindowFlags, fDriver);
|
||||||
if (fDecorator)
|
if (fDecorator) {
|
||||||
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
||||||
|
|
||||||
|
// we need to change our size to let the decorator fit
|
||||||
|
if (fMinWidth > fFrame.Width())
|
||||||
|
fFrame.right = fFrame.left + fMinWidth;
|
||||||
|
if (fMinHeight > fFrame.Height())
|
||||||
|
fFrame.bottom = fFrame.top + fMinHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEW_CLIPPING
|
#ifndef NEW_CLIPPING
|
||||||
@@ -130,7 +149,7 @@ WinBorder::WinBorder(const BRect &r,
|
|||||||
|
|
||||||
STRACE(("WinBorder %s:\n", GetName()));
|
STRACE(("WinBorder %s:\n", GetName()));
|
||||||
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", r.left, r.top, r.right, r.bottom));
|
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", r.left, r.top, r.right, r.bottom));
|
||||||
STRACE(("\tWindow %s\n",win ? win->Title() : "NULL"));
|
STRACE(("\tWindow %s\n", win ? win->Title() : "NULL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
WinBorder::~WinBorder()
|
WinBorder::~WinBorder()
|
||||||
|
|||||||
Reference in New Issue
Block a user