At some point, there was some hassle about what coordinate system the "where"
BPoint in a mouse moved message is. Turns out it's different (!) according to the type of message and this is even documented in the BeBook. I don't really know if we want to copy this, but since there are apps out there that depend on this, I am implementing it so that it's compatible with BeOS: In the B_MOUSE_UP/DOWN case, it's the coordinate space of the target view, in B_MOUSE_MOVED messages, it's that of the window. That explains a few things... Clicking into Pe's function popup window should now select the right icon. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3152,14 +3152,24 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* target, bool usePreferred
|
|||||||
if (message->FindPoint("screen_where", &where) != B_OK)
|
if (message->FindPoint("screen_where", &where) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// add local window coordinates
|
|
||||||
message->AddPoint("where", ConvertFromScreen(where));
|
|
||||||
|
|
||||||
BView* view = dynamic_cast<BView*>(target);
|
BView* view = dynamic_cast<BView*>(target);
|
||||||
|
|
||||||
|
if (!view || message->what == B_MOUSE_MOVED) {
|
||||||
|
// add local window coordinates, only
|
||||||
|
// for regular mouse moved messages
|
||||||
|
message->AddPoint("where", ConvertFromScreen(where));
|
||||||
|
}
|
||||||
|
|
||||||
if (view != NULL) {
|
if (view != NULL) {
|
||||||
// add local view coordinates
|
// add local view coordinates
|
||||||
message->AddPoint("be:view_where",
|
BPoint viewWhere = view->ConvertFromScreen(where);
|
||||||
view->ConvertFromScreen(where));
|
if (message->what != B_MOUSE_MOVED) {
|
||||||
|
// Yep, the meaning of "where" is different
|
||||||
|
// for regular mouse moved messages versus
|
||||||
|
// mouse up/down!
|
||||||
|
message->AddPoint("where", viewWhere);
|
||||||
|
}
|
||||||
|
message->AddPoint("be:view_where", viewWhere);
|
||||||
|
|
||||||
if (message->what == B_MOUSE_MOVED) {
|
if (message->what == B_MOUSE_MOVED) {
|
||||||
// is there a token of the view that is currently under
|
// is there a token of the view that is currently under
|
||||||
|
|||||||
Reference in New Issue
Block a user