* GetMouse() now survives being called with NULL parameters for location or

buttons.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-10-15 00:02:54 +00:00
parent 8cc45109d2
commit 0945268d80

View File

@ -1375,8 +1375,11 @@ BView::DragMessage(BMessage *message, BBitmap *image,
void
BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
BView::GetMouse(BPoint *_location, uint32 *_buttons, bool checkMessageQueue)
{
if (_location == NULL && _buttons == NULL)
return;
_CheckOwnerLockAndSwitchCurrent();
uint32 eventOptions = fEventOptions | fMouseEventOptions;
@ -1424,13 +1427,14 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
continue;
}
}
message->FindPoint("screen_where", location);
message->FindInt32("buttons", (int32 *)buttons);
message->FindPoint("screen_where", _location);
message->FindInt32("buttons", (int32 *)_buttons);
queue->Unlock();
// we need to hold the queue lock until here, because
// the message might still be used for something else
ConvertFromScreen(location);
if (_location != NULL)
ConvertFromScreen(_location);
if (deleteMessage)
delete message;
@ -1449,8 +1453,10 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
int32 code;
if (fOwner->fLink->FlushWithReply(code) == B_OK
&& code == B_OK) {
fOwner->fLink->Read<BPoint>(location);
fOwner->fLink->Read<uint32>(buttons);
BPoint location;
uint32 buttons;
fOwner->fLink->Read<BPoint>(&location);
fOwner->fLink->Read<uint32>(&buttons);
// TODO: ServerWindow replies with an int32 here
ConvertFromScreen(location);
@ -1464,8 +1470,16 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
// to scrolling. An app reading these messages would have to know
// the locations of the window and view for each message...
// otherwise it is potentially broken anyways.
} else
*buttons = 0;
if (_location != NULL)
*_location = location;
if (_buttons != NULL)
*_buttons = buttons;
} else {
if (_location != NULL)
_location->Set(0, 0);
if (_buttons != NULL)
*_buttons = 0;
}
}