* _DetermineTarget() will now return fLastMouseMovedView in case there
was no valid "_view_token" in the mouse event. * _SanitizeMessage() will now only add the "be:transit" field for B_MOUSE_MOVED messages. It will also now only update fLastMouseMovedView for B_MOUSE_MOVED messages, and not for all mouse messages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15124 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5afc064831
commit
5604d3c9ce
@ -2454,6 +2454,11 @@ BWindow::_DetermineTarget(BMessage *message, BHandler *target)
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if there is no valid token in the message, we try our
|
||||||
|
// luck with the last target, if available
|
||||||
|
if (fLastMouseMovedView != NULL)
|
||||||
|
return fLastMouseMovedView;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PULSE:
|
case B_PULSE:
|
||||||
@ -2582,38 +2587,40 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* target, bool usePreferred
|
|||||||
// add local view coordinates
|
// add local view coordinates
|
||||||
message->AddPoint("be:view_where", view->ConvertFromScreen(where));
|
message->AddPoint("be:view_where", view->ConvertFromScreen(where));
|
||||||
|
|
||||||
// is there a token of the view that is currently under the mouse?
|
if (message->what == B_MOUSE_MOVED) {
|
||||||
BView* viewUnderMouse = NULL;
|
// is there a token of the view that is currently under the mouse?
|
||||||
int32 token;
|
BView* viewUnderMouse = NULL;
|
||||||
if (message->FindInt32("_view_token", &token) == B_OK) {
|
int32 token;
|
||||||
BHandler* handler;
|
if (message->FindInt32("_view_token", &token) == B_OK) {
|
||||||
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN,
|
BHandler* handler;
|
||||||
(void**)&handler) == B_OK)
|
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN,
|
||||||
viewUnderMouse = dynamic_cast<BView*>(handler);
|
(void**)&handler) == B_OK)
|
||||||
}
|
viewUnderMouse = dynamic_cast<BView*>(handler);
|
||||||
|
}
|
||||||
// add transit information
|
|
||||||
int32 transit;
|
// add transit information
|
||||||
if (message->FindInt32("be:transit", &transit) != B_OK) {
|
int32 transit;
|
||||||
if (viewUnderMouse == view) {
|
if (message->FindInt32("be:transit", &transit) != B_OK) {
|
||||||
// the mouse is over the target view
|
if (viewUnderMouse == view) {
|
||||||
if (fLastMouseMovedView != view)
|
// the mouse is over the target view
|
||||||
transit = B_ENTERED_VIEW;
|
if (fLastMouseMovedView != view)
|
||||||
else
|
transit = B_ENTERED_VIEW;
|
||||||
transit = B_INSIDE_VIEW;
|
else
|
||||||
} else {
|
transit = B_INSIDE_VIEW;
|
||||||
// the mouse is not over the target view
|
} else {
|
||||||
if (view == fLastMouseMovedView)
|
// the mouse is not over the target view
|
||||||
transit = B_EXITED_VIEW;
|
if (view == fLastMouseMovedView)
|
||||||
else
|
transit = B_EXITED_VIEW;
|
||||||
transit = B_OUTSIDE_VIEW;
|
else
|
||||||
|
transit = B_OUTSIDE_VIEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
message->AddInt32("be:transit", transit);
|
||||||
}
|
}
|
||||||
|
|
||||||
message->AddInt32("be:transit", transit);
|
if (usePreferred || viewUnderMouse == NULL)
|
||||||
|
fLastMouseMovedView = viewUnderMouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usePreferred || viewUnderMouse == NULL)
|
|
||||||
fLastMouseMovedView = viewUnderMouse;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user