BWindow: style fixes only, no functional change.

This commit is contained in:
John Scipione
2013-07-26 18:36:00 -04:00
parent e94c611961
commit 323523c4b9
2 changed files with 109 additions and 126 deletions
+2 -2
View File
@@ -123,7 +123,7 @@ public:
void Zoom(); void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight); void SetZoomLimits(float maxWidth, float maxHeight);
virtual void ScreenChanged(BRect screenSize, virtual void ScreenChanged(BRect screenSize,
color_space format); color_space depth);
void SetPulseRate(bigtime_t rate); void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const; bigtime_t PulseRate() const;
@@ -219,7 +219,7 @@ public:
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 form, const char* property); int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
status_t AddToSubset(BWindow* window); status_t AddToSubset(BWindow* window);
+107 -124
View File
@@ -440,7 +440,7 @@ BWindow::~BWindow()
BArchivable* BArchivable*
BWindow::Instantiate(BMessage* data) BWindow::Instantiate(BMessage* data)
{ {
if (!validate_instantiation(data , "BWindow")) if (!validate_instantiation(data, "BWindow"))
return NULL; return NULL;
return new(std::nothrow) BWindow(data); return new(std::nothrow) BWindow(data);
@@ -511,7 +511,7 @@ BWindow::Quit()
{ {
if (!IsLocked()) { if (!IsLocked()) {
const char* name = Name(); const char* name = Name();
if (!name) if (name == NULL)
name = "no-name"; name = "no-name";
printf("ERROR - you must Lock a looper before calling Quit(), " printf("ERROR - you must Lock a looper before calling Quit(), "
@@ -718,13 +718,13 @@ BWindow::IsFront() const
void void
BWindow::MessageReceived(BMessage* msg) BWindow::MessageReceived(BMessage* message)
{ {
if (!msg->HasSpecifiers()) { if (!message->HasSpecifiers()) {
if (msg->what == B_KEY_DOWN) if (message->what == B_KEY_DOWN)
_KeyboardNavigation(); _KeyboardNavigation();
if (msg->what == (int32)kMsgAppServerRestarted) { if (message->what == (int32)kMsgAppServerRestarted) {
fLink->SetSenderPort(BApplication::Private::ServerLink()->SenderPort()); fLink->SetSenderPort(BApplication::Private::ServerLink()->SenderPort());
BPrivate::AppServerLink lockLink; BPrivate::AppServerLink lockLink;
@@ -773,7 +773,7 @@ BWindow::MessageReceived(BMessage* msg)
_SendShowOrHideMessage(); _SendShowOrHideMessage();
} }
return BLooper::MessageReceived(msg); return BLooper::MessageReceived(message);
} }
BMessage replyMsg(B_REPLY); BMessage replyMsg(B_REPLY);
@@ -784,54 +784,54 @@ BWindow::MessageReceived(BMessage* msg)
const char* prop; const char* prop;
int32 index; int32 index;
if (msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK) if (message->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK)
return BLooper::MessageReceived(msg); return BLooper::MessageReceived(message);
BPropertyInfo propertyInfo(sWindowPropInfo); BPropertyInfo propertyInfo(sWindowPropInfo);
switch (propertyInfo.FindMatch(msg, index, &specifier, what, prop)) { switch (propertyInfo.FindMatch(message, index, &specifier, what, prop)) {
case 0: case 0:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddBool("result", IsActive()); replyMsg.AddBool("result", IsActive());
handled = true; handled = true;
} else if (msg->what == B_SET_PROPERTY) { } else if (message->what == B_SET_PROPERTY) {
bool newActive; bool newActive;
if (msg->FindBool("data", &newActive) == B_OK) { if (message->FindBool("data", &newActive) == B_OK) {
Activate(newActive); Activate(newActive);
handled = true; handled = true;
} }
} }
break; break;
case 1: case 1:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddInt32("result", (uint32)Feel()); replyMsg.AddInt32("result", (uint32)Feel());
handled = true; handled = true;
} else { } else {
uint32 newFeel; uint32 newFeel;
if (msg->FindInt32("data", (int32*)&newFeel) == B_OK) { if (message->FindInt32("data", (int32*)&newFeel) == B_OK) {
SetFeel((window_feel)newFeel); SetFeel((window_feel)newFeel);
handled = true; handled = true;
} }
} }
break; break;
case 2: case 2:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddInt32("result", Flags()); replyMsg.AddInt32("result", Flags());
handled = true; handled = true;
} else { } else {
uint32 newFlags; uint32 newFlags;
if (msg->FindInt32("data", (int32*)&newFlags) == B_OK) { if (message->FindInt32("data", (int32*)&newFlags) == B_OK) {
SetFlags(newFlags); SetFlags(newFlags);
handled = true; handled = true;
} }
} }
break; break;
case 3: case 3:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddRect("result", Frame()); replyMsg.AddRect("result", Frame());
handled = true; handled = true;
} else { } else {
BRect newFrame; BRect newFrame;
if (msg->FindRect("data", &newFrame) == B_OK) { if (message->FindRect("data", &newFrame) == B_OK) {
MoveTo(newFrame.LeftTop()); MoveTo(newFrame.LeftTop());
ResizeTo(newFrame.Width(), newFrame.Height()); ResizeTo(newFrame.Width(), newFrame.Height());
handled = true; handled = true;
@@ -839,12 +839,12 @@ BWindow::MessageReceived(BMessage* msg)
} }
break; break;
case 4: case 4:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddBool("result", IsHidden()); replyMsg.AddBool("result", IsHidden());
handled = true; handled = true;
} else { } else {
bool hide; bool hide;
if (msg->FindBool("data", &hide) == B_OK) { if (message->FindBool("data", &hide) == B_OK) {
if (hide) { if (hide) {
if (!IsHidden()) if (!IsHidden())
Hide(); Hide();
@@ -855,55 +855,55 @@ BWindow::MessageReceived(BMessage* msg)
} }
break; break;
case 5: case 5:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddInt32("result", (uint32)Look()); replyMsg.AddInt32("result", (uint32)Look());
handled = true; handled = true;
} else { } else {
uint32 newLook; uint32 newLook;
if (msg->FindInt32("data", (int32*)&newLook) == B_OK) { if (message->FindInt32("data", (int32*)&newLook) == B_OK) {
SetLook((window_look)newLook); SetLook((window_look)newLook);
handled = true; handled = true;
} }
} }
break; break;
case 6: case 6:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddString("result", Title()); replyMsg.AddString("result", Title());
handled = true; handled = true;
} else { } else {
const char* newTitle = NULL; const char* newTitle = NULL;
if (msg->FindString("data", &newTitle) == B_OK) { if (message->FindString("data", &newTitle) == B_OK) {
SetTitle(newTitle); SetTitle(newTitle);
handled = true; handled = true;
} }
} }
break; break;
case 7: case 7:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddInt32( "result", Workspaces()); replyMsg.AddInt32( "result", Workspaces());
handled = true; handled = true;
} else { } else {
uint32 newWorkspaces; uint32 newWorkspaces;
if (msg->FindInt32("data", (int32*)&newWorkspaces) == B_OK) { if (message->FindInt32("data", (int32*)&newWorkspaces) == B_OK) {
SetWorkspaces(newWorkspaces); SetWorkspaces(newWorkspaces);
handled = true; handled = true;
} }
} }
break; break;
case 11: case 11:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
replyMsg.AddBool("result", IsMinimized()); replyMsg.AddBool("result", IsMinimized());
handled = true; handled = true;
} else { } else {
bool minimize; bool minimize;
if (msg->FindBool("data", &minimize) == B_OK) { if (message->FindBool("data", &minimize) == B_OK) {
Minimize(minimize); Minimize(minimize);
handled = true; handled = true;
} }
} }
break; break;
case 12: case 12:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
BMessage settings; BMessage settings;
if (GetDecoratorSettings(&settings) == B_OK) { if (GetDecoratorSettings(&settings) == B_OK) {
BRect frame; BRect frame;
@@ -915,28 +915,28 @@ BWindow::MessageReceived(BMessage* msg)
} }
break; break;
default: default:
return BLooper::MessageReceived(msg); return BLooper::MessageReceived(message);
} }
if (handled) { if (handled) {
if (msg->what == B_SET_PROPERTY) if (message->what == B_SET_PROPERTY)
replyMsg.AddInt32("error", B_OK); replyMsg.AddInt32("error", B_OK);
} else { } else {
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD; replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
replyMsg.AddInt32("error", B_BAD_SCRIPT_SYNTAX); replyMsg.AddInt32("error", B_BAD_SCRIPT_SYNTAX);
replyMsg.AddString("message", "Didn't understand the specifier(s)"); replyMsg.AddString("message", "Didn't understand the specifier(s)");
} }
msg->SendReply(&replyMsg); message->SendReply(&replyMsg);
} }
void void
BWindow::DispatchMessage(BMessage* msg, BHandler* target) BWindow::DispatchMessage(BMessage* message, BHandler* target)
{ {
if (!msg) if (message == NULL)
return; return;
switch (msg->what) { switch (message->what) {
case B_ZOOM: case B_ZOOM:
Zoom(); Zoom();
break; break;
@@ -964,11 +964,11 @@ BWindow::DispatchMessage(BMessage* msg, BHandler* target)
case _SWITCH_WORKSPACE_: case _SWITCH_WORKSPACE_:
{ {
int32 deltaX = 0; int32 deltaX = 0;
msg->FindInt32("delta_x", &deltaX); message->FindInt32("delta_x", &deltaX);
int32 deltaY = 0; int32 deltaY = 0;
msg->FindInt32("delta_y", &deltaY); message->FindInt32("delta_y", &deltaY);
bool takeMeThere = false; bool takeMeThere = false;
msg->FindBool("take_me_there", &takeMeThere); message->FindBool("take_me_there", &takeMeThere);
if (deltaX == 0 && deltaY == 0) if (deltaX == 0 && deltaY == 0)
break; break;
@@ -1012,7 +1012,7 @@ BWindow::DispatchMessage(BMessage* msg, BHandler* target)
case B_MINIMIZE: case B_MINIMIZE:
{ {
bool minimize; bool minimize;
if (msg->FindBool("minimize", &minimize) == B_OK) if (message->FindBool("minimize", &minimize) == B_OK)
Minimize(minimize); Minimize(minimize);
break; break;
} }
@@ -1038,8 +1038,8 @@ BWindow::DispatchMessage(BMessage* msg, BHandler* target)
case B_WINDOW_RESIZED: case B_WINDOW_RESIZED:
{ {
int32 width, height; int32 width, height;
if (msg->FindInt32("width", &width) == B_OK if (message->FindInt32("width", &width) == B_OK
&& msg->FindInt32("height", &height) == B_OK) { && message->FindInt32("height", &height) == B_OK) {
// combine with pending resize notifications // combine with pending resize notifications
BMessage* pendingMessage; BMessage* pendingMessage;
while ((pendingMessage = MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) { while ((pendingMessage = MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) {
@@ -1078,7 +1078,7 @@ FrameResized(width, height);
case B_WINDOW_MOVED: case B_WINDOW_MOVED:
{ {
BPoint origin; BPoint origin;
if (msg->FindPoint("where", &origin) == B_OK) { if (message->FindPoint("where", &origin) == B_OK) {
if (fFrame.LeftTop() != origin) { if (fFrame.LeftTop() != origin) {
// NOTE: we might have already handled the move // NOTE: we might have already handled the move
// in an _UPDATE_ message // in an _UPDATE_ message
@@ -1098,12 +1098,12 @@ FrameMoved(origin);
case B_WINDOW_ACTIVATED: case B_WINDOW_ACTIVATED:
if (target != this) { if (target != this) {
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
bool active; bool active;
if (msg->FindBool("active", &active) != B_OK) if (message->FindBool("active", &active) != B_OK)
break; break;
// find latest activation message // find latest activation message
@@ -1139,12 +1139,12 @@ FrameMoved(origin);
bool inputMethodAware = false; bool inputMethodAware = false;
if (fFocus) if (fFocus)
inputMethodAware = fFocus->Flags() & B_INPUT_METHOD_AWARE; inputMethodAware = fFocus->Flags() & B_INPUT_METHOD_AWARE;
BMessage msg(inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); BMessage message(inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW);
BMessenger messenger(fFocus); BMessenger messenger(fFocus);
BMessage reply; BMessage reply;
if (fFocus) if (fFocus)
msg.AddMessenger("view", messenger); message.AddMessenger("view", messenger);
_control_input_server_(&msg, &reply); _control_input_server_(&message, &reply);
} }
break; break;
@@ -1152,62 +1152,62 @@ FrameMoved(origin);
if (target == this) { if (target == this) {
BRect frame; BRect frame;
uint32 mode; uint32 mode;
if (msg->FindRect("frame", &frame) == B_OK if (message->FindRect("frame", &frame) == B_OK
&& msg->FindInt32("mode", (int32*)&mode) == B_OK) && message->FindInt32("mode", (int32*)&mode) == B_OK)
ScreenChanged(frame, (color_space)mode); ScreenChanged(frame, (color_space)mode);
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
case B_WORKSPACE_ACTIVATED: case B_WORKSPACE_ACTIVATED:
if (target == this) { if (target == this) {
uint32 workspace; uint32 workspace;
bool active; bool active;
if (msg->FindInt32("workspace", (int32*)&workspace) == B_OK if (message->FindInt32("workspace", (int32*)&workspace) == B_OK
&& msg->FindBool("active", &active) == B_OK) && message->FindBool("active", &active) == B_OK)
WorkspaceActivated(workspace, active); WorkspaceActivated(workspace, active);
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
case B_WORKSPACES_CHANGED: case B_WORKSPACES_CHANGED:
if (target == this) { if (target == this) {
uint32 oldWorkspace, newWorkspace; uint32 oldWorkspace, newWorkspace;
if (msg->FindInt32("old", (int32*)&oldWorkspace) == B_OK if (message->FindInt32("old", (int32*)&oldWorkspace) == B_OK
&& msg->FindInt32("new", (int32*)&newWorkspace) == B_OK) && message->FindInt32("new", (int32*)&newWorkspace) == B_OK)
WorkspacesChanged(oldWorkspace, newWorkspace); WorkspacesChanged(oldWorkspace, newWorkspace);
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
case B_INVALIDATE: case B_INVALIDATE:
{ {
if (BView* view = dynamic_cast<BView*>(target)) { if (BView* view = dynamic_cast<BView*>(target)) {
BRect rect; BRect rect;
if (msg->FindRect("be:area", &rect) == B_OK) if (message->FindRect("be:area", &rect) == B_OK)
view->Invalidate(rect); view->Invalidate(rect);
else else
view->Invalidate(); view->Invalidate();
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
case B_KEY_DOWN: case B_KEY_DOWN:
{ {
if (!_HandleKeyDown(msg)) { if (!_HandleKeyDown(message)) {
if (BView* view = dynamic_cast<BView*>(target)) { if (BView* view = dynamic_cast<BView*>(target)) {
// TODO: cannot use "string" here if we support having // TODO: cannot use "string" here if we support having
// different font encoding per view (it's supposed to be // different font encoding per view (it's supposed to be
// converted by _HandleKeyDown() one day) // converted by _HandleKeyDown() one day)
const char* string; const char* string;
ssize_t bytes; ssize_t bytes;
if (msg->FindData("bytes", B_STRING_TYPE, if (message->FindData("bytes", B_STRING_TYPE,
(const void**)&string, &bytes) == B_OK) { (const void**)&string, &bytes) == B_OK) {
view->KeyDown(string, bytes - 1); view->KeyDown(string, bytes - 1);
} }
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
} }
break; break;
} }
@@ -1218,19 +1218,19 @@ FrameMoved(origin);
if (BView* view = dynamic_cast<BView*>(target)) { if (BView* view = dynamic_cast<BView*>(target)) {
const char* string; const char* string;
ssize_t bytes; ssize_t bytes;
if (msg->FindData("bytes", B_STRING_TYPE, if (message->FindData("bytes", B_STRING_TYPE,
(const void**)&string, &bytes) == B_OK) { (const void**)&string, &bytes) == B_OK) {
view->KeyUp(string, bytes - 1); view->KeyUp(string, bytes - 1);
} }
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
case B_UNMAPPED_KEY_DOWN: case B_UNMAPPED_KEY_DOWN:
{ {
if (!_HandleUnmappedKeyDown(msg)) if (!_HandleUnmappedKeyDown(message))
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
@@ -1240,10 +1240,10 @@ FrameMoved(origin);
if (view != NULL) { if (view != NULL) {
BPoint where; BPoint where;
msg->FindPoint("be:view_where", &where); message->FindPoint("be:view_where", &where);
view->MouseDown(where); view->MouseDown(where);
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
@@ -1252,11 +1252,11 @@ FrameMoved(origin);
{ {
if (BView* view = dynamic_cast<BView*>(target)) { if (BView* view = dynamic_cast<BView*>(target)) {
BPoint where; BPoint where;
msg->FindPoint("be:view_where", &where); message->FindPoint("be:view_where", &where);
view->fMouseEventOptions = 0; view->fMouseEventOptions = 0;
view->MouseUp(where); view->MouseUp(where);
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
@@ -1270,11 +1270,11 @@ FrameMoved(origin);
bool dropIfLate = !(eventOptions & B_FULL_POINTER_HISTORY); bool dropIfLate = !(eventOptions & B_FULL_POINTER_HISTORY);
bigtime_t eventTime; bigtime_t eventTime;
if (msg->FindInt64("when", (int64*)&eventTime) < B_OK) if (message->FindInt64("when", (int64*)&eventTime) < B_OK)
eventTime = system_time(); eventTime = system_time();
uint32 transit; uint32 transit;
msg->FindInt32("be:transit", (int32*)&transit); message->FindInt32("be:transit", (int32*)&transit);
// don't drop late messages with these important transit values // don't drop late messages with these important transit values
if (transit == B_ENTERED_VIEW || transit == B_EXITED_VIEW) if (transit == B_ENTERED_VIEW || transit == B_EXITED_VIEW)
dropIfLate = false; dropIfLate = false;
@@ -1299,7 +1299,7 @@ FrameMoved(origin);
BMessage* moved; BMessage* moved;
for (int32 i = 0; (moved = queue->FindMessage(i)) != NULL; for (int32 i = 0; (moved = queue->FindMessage(i)) != NULL;
i++) { i++) {
if (moved != msg && moved->what == B_MOUSE_MOVED) { if (moved != message && moved->what == B_MOUSE_MOVED) {
// there is a newer mouse moved message in the // there is a newer mouse moved message in the
// queue, just ignore the current one, the newer one // queue, just ignore the current one, the newer one
// will be handled here eventually // will be handled here eventually
@@ -1312,8 +1312,8 @@ FrameMoved(origin);
BPoint where; BPoint where;
uint32 buttons; uint32 buttons;
msg->FindPoint("be:view_where", &where); message->FindPoint("be:view_where", &where);
msg->FindInt32("buttons", (int32*)&buttons); message->FindInt32("buttons", (int32*)&buttons);
delete fIdleMouseRunner; delete fIdleMouseRunner;
@@ -1331,9 +1331,9 @@ FrameMoved(origin);
} }
BMessage* dragMessage = NULL; BMessage* dragMessage = NULL;
if (msg->HasMessage("be:drag_message")) { if (message->HasMessage("be:drag_message")) {
dragMessage = new BMessage(); dragMessage = new BMessage();
if (msg->FindMessage("be:drag_message", dragMessage) if (message->FindMessage("be:drag_message", dragMessage)
!= B_OK) { != B_OK) {
delete dragMessage; delete dragMessage;
dragMessage = NULL; dragMessage = NULL;
@@ -1343,7 +1343,7 @@ FrameMoved(origin);
view->MouseMoved(where, transit, dragMessage); view->MouseMoved(where, transit, dragMessage);
delete dragMessage; delete dragMessage;
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
} }
@@ -1353,7 +1353,7 @@ FrameMoved(origin);
fTopView->_Pulse(); fTopView->_Pulse();
fLink->Flush(); fLink->Flush();
} else } else
target->MessageReceived(msg); target->MessageReceived(message);
break; break;
case _UPDATE_: case _UPDATE_:
@@ -1468,10 +1468,10 @@ FrameMoved(origin);
case B_WINDOW_MOVE_BY: case B_WINDOW_MOVE_BY:
{ {
BPoint offset; BPoint offset;
if (msg->FindPoint("data", &offset) == B_OK) if (message->FindPoint("data", &offset) == B_OK)
MoveBy(offset.x, offset.y); MoveBy(offset.x, offset.y);
else else
msg->SendReply(B_MESSAGE_NOT_UNDERSTOOD); message->SendReply(B_MESSAGE_NOT_UNDERSTOOD);
break; break;
} }
@@ -1479,10 +1479,10 @@ FrameMoved(origin);
case B_WINDOW_MOVE_TO: case B_WINDOW_MOVE_TO:
{ {
BPoint origin; BPoint origin;
if (msg->FindPoint("data", &origin) == B_OK) if (message->FindPoint("data", &origin) == B_OK)
MoveTo(origin); MoveTo(origin);
else else
msg->SendReply(B_MESSAGE_NOT_UNDERSTOOD); message->SendReply(B_MESSAGE_NOT_UNDERSTOOD);
break; break;
} }
@@ -1493,14 +1493,14 @@ FrameMoved(origin);
} }
default: default:
BLooper::DispatchMessage(msg, target); BLooper::DispatchMessage(message, target);
break; break;
} }
} }
void void
BWindow::FrameMoved(BPoint new_position) BWindow::FrameMoved(BPoint newPosition)
{ {
// does nothing // does nothing
// Hook function // Hook function
@@ -1508,7 +1508,7 @@ BWindow::FrameMoved(BPoint new_position)
void void
BWindow::FrameResized(float new_width, float new_height) BWindow::FrameResized(float newWidth, float newHeight)
{ {
// does nothing // does nothing
// Hook function // Hook function
@@ -1516,7 +1516,7 @@ BWindow::FrameResized(float new_width, float new_height)
void void
BWindow::WorkspacesChanged(uint32 old_ws, uint32 new_ws) BWindow::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
{ {
// does nothing // does nothing
// Hook function // Hook function
@@ -1524,7 +1524,7 @@ BWindow::WorkspacesChanged(uint32 old_ws, uint32 new_ws)
void void
BWindow::WorkspaceActivated(int32 ws, bool state) BWindow::WorkspaceActivated(int32 workspace, bool state)
{ {
// does nothing // does nothing
// Hook function // Hook function
@@ -1599,16 +1599,6 @@ BWindow::GetSizeLimits(float* _minWidth, float* _maxWidth, float* _minHeight,
} }
/*! Updates the window's size limits from the minimum and maximum sizes of its
top view.
Is a no-op, unless the \c B_AUTO_UPDATE_SIZE_LIMITS window flag is set.
The method is called automatically after a layout invalidation. Since it is
invoked asynchronously, calling this method manually is necessary, if it is
desired to adjust the limits (and as a possible side effect the window size)
earlier (e.g. before the first Show()).
*/
void void
BWindow::UpdateSizeLimits() BWindow::UpdateSizeLimits()
{ {
@@ -1709,11 +1699,11 @@ BWindow::SetZoomLimits(float maxWidth, float maxHeight)
void void
BWindow::Zoom(BPoint leftTop, float width, float height) BWindow::Zoom(BPoint origin, float width, float height)
{ {
// the default implementation of this hook function // the default implementation of this hook function
// just does the obvious: // just does the obvious:
MoveTo(leftTop); MoveTo(origin);
ResizeTo(width, height); ResizeTo(width, height);
} }
@@ -1781,7 +1771,7 @@ BWindow::Zoom()
void void
BWindow::ScreenChanged(BRect screen_size, color_space depth) BWindow::ScreenChanged(BRect screenSize, color_space depth)
{ {
// Hook function // Hook function
} }
@@ -2584,10 +2574,7 @@ BWindow::ResizeTo(float width, float height)
} }
/*! // Center the window in the passed in rect.
\brief Center the window in the passed in \a rect.
\param rect The rectangle to center the window in.
*/
void void
BWindow::CenterIn(const BRect& rect) BWindow::CenterIn(const BRect& rect)
{ {
@@ -2600,9 +2587,7 @@ BWindow::CenterIn(const BRect& rect)
} }
/*! // Centers the window on the screen the window is currently on.
\brief Centers the window on the screen the window is currently on.
*/
void void
BWindow::CenterOnScreen() BWindow::CenterOnScreen()
{ {
@@ -2610,9 +2595,7 @@ BWindow::CenterOnScreen()
} }
/*! // Centers the window on the screen with the passed in id.
\brief Centers the window on the screen with the passed in \a id.
*/
void void
BWindow::CenterOnScreen(screen_id id) BWindow::CenterOnScreen(screen_id id)
{ {
@@ -2738,35 +2721,35 @@ BWindow::GetSupportedSuites(BMessage* data)
BHandler* BHandler*
BWindow::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, BWindow::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
int32 what, const char* property) int32 what, const char* property)
{ {
if (msg->what == B_WINDOW_MOVE_BY if (message->what == B_WINDOW_MOVE_BY
|| msg->what == B_WINDOW_MOVE_TO) || message->what == B_WINDOW_MOVE_TO)
return this; return this;
BPropertyInfo propertyInfo(sWindowPropInfo); BPropertyInfo propertyInfo(sWindowPropInfo);
if (propertyInfo.FindMatch(msg, index, specifier, what, property) >= 0) { if (propertyInfo.FindMatch(message, index, specifier, what, property) >= 0) {
if (!strcmp(property, "View")) { if (strcmp(property, "View") == 0) {
// we will NOT pop the current specifier // we will NOT pop the current specifier
return fTopView; return fTopView;
} else if (!strcmp(property, "MenuBar")) { } else if (strcmp(property, "MenuBar") == 0) {
if (fKeyMenuBar) { if (fKeyMenuBar) {
msg->PopSpecifier(); message->PopSpecifier();
return fKeyMenuBar; return fKeyMenuBar;
} else { } else {
BMessage replyMsg(B_MESSAGE_NOT_UNDERSTOOD); BMessage replyMsg(B_MESSAGE_NOT_UNDERSTOOD);
replyMsg.AddInt32("error", B_NAME_NOT_FOUND); replyMsg.AddInt32("error", B_NAME_NOT_FOUND);
replyMsg.AddString("message", replyMsg.AddString("message",
"This window doesn't have a main MenuBar"); "This window doesn't have a main MenuBar");
msg->SendReply(&replyMsg); message->SendReply(&replyMsg);
return NULL; return NULL;
} }
} else } else
return this; return this;
} }
return BLooper::ResolveSpecifier(msg, index, specifier, what, property); return BLooper::ResolveSpecifier(message, index, specifier, what, property);
} }
@@ -3072,7 +3055,7 @@ BWindow::task_looper()
if (!Lock()) if (!Lock())
break; break;
if (!fLastMessage) { if (fLastMessage == NULL) {
// No more messages: Unlock the looper and terminate the // No more messages: Unlock the looper and terminate the
// dispatch loop. // dispatch loop.
dispatchNextMessage = false; dispatchNextMessage = false;
@@ -3512,7 +3495,7 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* target, bool usePreferred
BView* view = dynamic_cast<BView*>(target); BView* view = dynamic_cast<BView*>(target);
if (!view || message->what == B_MOUSE_MOVED) { if (view == NULL || message->what == B_MOUSE_MOVED) {
// add local window coordinates, only // add local window coordinates, only
// for regular mouse moved messages // for regular mouse moved messages
message->AddPoint("where", ConvertFromScreen(where)); message->AddPoint("where", ConvertFromScreen(where));
@@ -3969,7 +3952,7 @@ BWindow::_FindView(BView* view, BPoint point) const
{ {
// point is assumed to be already in view's coordinates // point is assumed to be already in view's coordinates
if (!view->IsHidden() && view->Bounds().Contains(point)) { if (!view->IsHidden() && view->Bounds().Contains(point)) {
if (!view->fFirstChild) if (view->fFirstChild == NULL)
return view; return view;
else { else {
BView* child = view->fFirstChild; BView* child = view->fFirstChild;