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