AS_CREATE_WINDOW now also gets the actual frame width and size limits of
the window on server side - ie. if the app_server could not create a window of the size requested, BWindow::fFrame will still be correct (and the size limits will mirror actual decorator limits). Renamed fMinWindHeight and friends to fMinHeight and so on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13302 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -410,10 +410,10 @@ private:
|
|||||||
sem_id fMenuSem;
|
sem_id fMenuSem;
|
||||||
float fMaxZoomHeight;
|
float fMaxZoomHeight;
|
||||||
float fMaxZoomWidth;
|
float fMaxZoomWidth;
|
||||||
float fMinWindHeight;
|
float fMinHeight;
|
||||||
float fMinWindWidth;
|
float fMinWidth;
|
||||||
float fMaxWindHeight;
|
float fMaxHeight;
|
||||||
float fMaxWindWidth;
|
float fMaxWidth;
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
window_look fLook;
|
window_look fLook;
|
||||||
ViewAttr *fCurDrawViewState; // not yet used
|
ViewAttr *fCurDrawViewState; // not yet used
|
||||||
|
|||||||
@@ -166,12 +166,12 @@ BWindow::BWindow(BMessage* data)
|
|||||||
&& data->FindFloat("_zoom", 1, &fMaxZoomHeight) == B_OK)
|
&& data->FindFloat("_zoom", 1, &fMaxZoomHeight) == B_OK)
|
||||||
SetZoomLimits(fMaxZoomWidth, fMaxZoomHeight);
|
SetZoomLimits(fMaxZoomWidth, fMaxZoomHeight);
|
||||||
|
|
||||||
if (data->FindFloat("_sizel", 0, &fMinWindWidth) == B_OK
|
if (data->FindFloat("_sizel", 0, &fMinWidth) == B_OK
|
||||||
&& data->FindFloat("_sizel", 1, &fMinWindHeight) == B_OK
|
&& data->FindFloat("_sizel", 1, &fMinHeight) == B_OK
|
||||||
&& data->FindFloat("_sizel", 2, &fMaxWindWidth) == B_OK
|
&& data->FindFloat("_sizel", 2, &fMaxWidth) == B_OK
|
||||||
&& data->FindFloat("_sizel", 3, &fMaxWindHeight) == B_OK)
|
&& data->FindFloat("_sizel", 3, &fMaxHeight) == B_OK)
|
||||||
SetSizeLimits(fMinWindWidth, fMaxWindWidth,
|
SetSizeLimits(fMinWidth, fMaxWidth,
|
||||||
fMinWindHeight, fMaxWindHeight);
|
fMinHeight, fMaxHeight);
|
||||||
|
|
||||||
if (data->FindInt64("_pulse", &fPulseRate) == B_OK)
|
if (data->FindInt64("_pulse", &fPulseRate) == B_OK)
|
||||||
SetPulseRate(fPulseRate);
|
SetPulseRate(fPulseRate);
|
||||||
@@ -258,12 +258,12 @@ BWindow::Archive(BMessage* data, bool deep) const
|
|||||||
data->AddFloat("_zoom", fMaxZoomHeight);
|
data->AddFloat("_zoom", fMaxZoomHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fMinWindWidth != 0.0 || fMinWindHeight != 0.0
|
if (fMinWidth != 0.0 || fMinHeight != 0.0
|
||||||
|| fMaxWindWidth != 32768.0 || fMaxWindHeight != 32768.0) {
|
|| fMaxWidth != 32768.0 || fMaxHeight != 32768.0) {
|
||||||
data->AddFloat("_sizel", fMinWindWidth);
|
data->AddFloat("_sizel", fMinWidth);
|
||||||
data->AddFloat("_sizel", fMinWindHeight);
|
data->AddFloat("_sizel", fMinHeight);
|
||||||
data->AddFloat("_sizel", fMaxWindWidth);
|
data->AddFloat("_sizel", fMaxWidth);
|
||||||
data->AddFloat("_sizel", fMaxWindHeight);
|
data->AddFloat("_sizel", fMaxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fPulseRate != 500000)
|
if (fPulseRate != 500000)
|
||||||
@@ -1013,10 +1013,10 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
|||||||
&& code == SERVER_TRUE) {
|
&& code == SERVER_TRUE) {
|
||||||
// read the values that were really enforced on
|
// read the values that were really enforced on
|
||||||
// the server side
|
// the server side
|
||||||
fLink->Read<float>(&fMinWindWidth);
|
fLink->Read<float>(&fMinWidth);
|
||||||
fLink->Read<float>(&fMaxWindWidth);
|
fLink->Read<float>(&fMaxWidth);
|
||||||
fLink->Read<float>(&fMinWindHeight);
|
fLink->Read<float>(&fMinHeight);
|
||||||
fLink->Read<float>(&fMaxWindHeight);
|
fLink->Read<float>(&fMaxHeight);
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -1028,10 +1028,10 @@ BWindow::GetSizeLimits(float *minWidth, float *maxWidth,
|
|||||||
float *minHeight, float *maxHeight)
|
float *minHeight, float *maxHeight)
|
||||||
{
|
{
|
||||||
// TODO: What about locking?!?
|
// TODO: What about locking?!?
|
||||||
*minHeight = fMinWindHeight;
|
*minHeight = fMinHeight;
|
||||||
*minWidth = fMinWindWidth;
|
*minWidth = fMinWidth;
|
||||||
*maxHeight = fMaxWindHeight;
|
*maxHeight = fMaxHeight;
|
||||||
*maxWidth = fMaxWindWidth;
|
*maxWidth = fMaxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1039,13 +1039,13 @@ void
|
|||||||
BWindow::SetZoomLimits(float maxWidth, float maxHeight)
|
BWindow::SetZoomLimits(float maxWidth, float maxHeight)
|
||||||
{
|
{
|
||||||
// TODO: What about locking?!?
|
// TODO: What about locking?!?
|
||||||
if (maxWidth > fMaxWindWidth)
|
if (maxWidth > fMaxWidth)
|
||||||
maxWidth = fMaxWindWidth;
|
maxWidth = fMaxWidth;
|
||||||
else
|
else
|
||||||
fMaxZoomWidth = maxWidth;
|
fMaxZoomWidth = maxWidth;
|
||||||
|
|
||||||
if (maxHeight > fMaxWindHeight)
|
if (maxHeight > fMaxHeight)
|
||||||
maxHeight = fMaxWindHeight;
|
maxHeight = fMaxHeight;
|
||||||
else
|
else
|
||||||
fMaxZoomHeight = maxHeight;
|
fMaxZoomHeight = maxHeight;
|
||||||
}
|
}
|
||||||
@@ -1092,10 +1092,10 @@ BWindow::Zoom()
|
|||||||
minWidth = fMaxZoomWidth;
|
minWidth = fMaxZoomWidth;
|
||||||
|
|
||||||
// 2) the rectangle defined by SetSizeLimits()
|
// 2) the rectangle defined by SetSizeLimits()
|
||||||
if (fMaxWindHeight < minHeight)
|
if (fMaxHeight < minHeight)
|
||||||
minHeight = fMaxWindHeight;
|
minHeight = fMaxHeight;
|
||||||
if (fMaxWindWidth < minWidth)
|
if (fMaxWidth < minWidth)
|
||||||
minWidth = fMaxWindWidth;
|
minWidth = fMaxWidth;
|
||||||
|
|
||||||
// 3) the screen rectangle
|
// 3) the screen rectangle
|
||||||
if (screen.Frame().Width() < minWidth)
|
if (screen.Frame().Width() < minWidth)
|
||||||
@@ -1832,14 +1832,14 @@ BWindow::ResizeBy(float dx, float dy)
|
|||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
// stay in minimum & maximum frame limits
|
// stay in minimum & maximum frame limits
|
||||||
if (fFrame.Width() + dx < fMinWindWidth)
|
if (fFrame.Width() + dx < fMinWidth)
|
||||||
dx = fMinWindWidth - fFrame.Width();
|
dx = fMinWidth - fFrame.Width();
|
||||||
if (fFrame.Width() + dx > fMaxWindWidth)
|
if (fFrame.Width() + dx > fMaxWidth)
|
||||||
dx = fMaxWindWidth - fFrame.Width();
|
dx = fMaxWidth - fFrame.Width();
|
||||||
if (fFrame.Height() + dy < fMinWindHeight)
|
if (fFrame.Height() + dy < fMinHeight)
|
||||||
dy = fMinWindHeight - fFrame.Height();
|
dy = fMinHeight - fFrame.Height();
|
||||||
if (fFrame.Height() + dy > fMaxWindHeight)
|
if (fFrame.Height() + dy > fMaxHeight)
|
||||||
dy = fMaxWindHeight - fFrame.Height();
|
dy = fMaxHeight - fFrame.Height();
|
||||||
|
|
||||||
if (dx != 0.0 || dy != 0.0) {
|
if (dx != 0.0 || dy != 0.0) {
|
||||||
fLink->StartMessage(AS_WINDOW_RESIZE);
|
fLink->StartMessage(AS_WINDOW_RESIZE);
|
||||||
@@ -2037,10 +2037,10 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
|||||||
|
|
||||||
fMaxZoomHeight = 32768.0;
|
fMaxZoomHeight = 32768.0;
|
||||||
fMaxZoomWidth = 32768.0;
|
fMaxZoomWidth = 32768.0;
|
||||||
fMinWindHeight = 0.0;
|
fMinHeight = 0.0;
|
||||||
fMinWindWidth = 0.0;
|
fMinWidth = 0.0;
|
||||||
fMaxWindHeight = 32768.0;
|
fMaxHeight = 32768.0;
|
||||||
fMaxWindWidth = 32768.0;
|
fMaxWidth = 32768.0;
|
||||||
|
|
||||||
fLastViewToken = B_NULL_TOKEN;
|
fLastViewToken = B_NULL_TOKEN;
|
||||||
|
|
||||||
@@ -2083,9 +2083,21 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
|||||||
int32 code;
|
int32 code;
|
||||||
if (fLink->FlushWithReply(code) == B_OK
|
if (fLink->FlushWithReply(code) == B_OK
|
||||||
&& code == SERVER_TRUE
|
&& code == SERVER_TRUE
|
||||||
&& fLink->Read<port_id>(&sendPort) == B_OK)
|
&& fLink->Read<port_id>(&sendPort) == B_OK) {
|
||||||
fLink->SetSenderPort(sendPort);
|
fLink->SetSenderPort(sendPort);
|
||||||
else
|
|
||||||
|
// read the frame size and its limits that were really
|
||||||
|
// enforced on the server side
|
||||||
|
|
||||||
|
fLink->Read<BRect>(&fFrame);
|
||||||
|
fLink->Read<float>(&fMinWidth);
|
||||||
|
fLink->Read<float>(&fMaxWidth);
|
||||||
|
fLink->Read<float>(&fMinHeight);
|
||||||
|
fLink->Read<float>(&fMaxHeight);
|
||||||
|
|
||||||
|
fMaxZoomWidth = fMaxWidth;
|
||||||
|
fMaxZoomHeight = fMaxHeight;
|
||||||
|
} else
|
||||||
sendPort = -1;
|
sendPort = -1;
|
||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
@@ -3005,10 +3017,10 @@ BWindow::PrintToStream() const
|
|||||||
fMenuSem,
|
fMenuSem,
|
||||||
fMaxZoomHeight,
|
fMaxZoomHeight,
|
||||||
fMaxZoomWidth,
|
fMaxZoomWidth,
|
||||||
fMinWindHeight,
|
fMinHeight,
|
||||||
fMinWindWidth,
|
fMinWidth,
|
||||||
fMaxWindHeight,
|
fMaxHeight,
|
||||||
fMaxWindWidth,
|
fMaxWidth,
|
||||||
fFrame.left, fFrame.top, fFrame.right, fFrame.bottom,
|
fFrame.left, fFrame.top, fFrame.right, fFrame.bottom,
|
||||||
(int16)fLook,
|
(int16)fLook,
|
||||||
(int16)fFeel,
|
(int16)fFeel,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <ViewAux.h>
|
#include <ViewAux.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
#include "BGet++.h"
|
#include "BGet++.h"
|
||||||
@@ -136,6 +137,8 @@ ServerWindow::InitCheck()
|
|||||||
bool
|
bool
|
||||||
ServerWindow::Run()
|
ServerWindow::Run()
|
||||||
{
|
{
|
||||||
|
BAutolock locker(this);
|
||||||
|
|
||||||
// Spawn our message-monitoring thread
|
// Spawn our message-monitoring thread
|
||||||
fThread = spawn_thread(_message_thread, fTitle, B_NORMAL_PRIORITY, this);
|
fThread = spawn_thread(_message_thread, fTitle, B_NORMAL_PRIORITY, this);
|
||||||
if (fThread < B_OK)
|
if (fThread < B_OK)
|
||||||
@@ -147,9 +150,20 @@ ServerWindow::Run()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a reply to our window - it is expecting fMessagePort port.
|
// Send a reply to our window - it is expecting fMessagePort
|
||||||
|
// port and some other info
|
||||||
|
|
||||||
fLink.StartMessage(SERVER_TRUE);
|
fLink.StartMessage(SERVER_TRUE);
|
||||||
fLink.Attach<port_id>(fMessagePort);
|
fLink.Attach<port_id>(fMessagePort);
|
||||||
|
|
||||||
|
float minWidth, maxWidth, minHeight, maxHeight;
|
||||||
|
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||||
|
|
||||||
|
fLink.Attach<BRect>(fWinBorder->Frame());
|
||||||
|
fLink.Attach<float>(minWidth);
|
||||||
|
fLink.Attach<float>(maxWidth);
|
||||||
|
fLink.Attach<float>(minHeight);
|
||||||
|
fLink.Attach<float>(maxHeight);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user