зеркало из https://github.com/mozilla/gecko-dev.git
Bug 297080. Mouse exit events from top-level windows should always be treated as exit events even if the cursor is still within window bounds (it must have moved into an on-top window). r+sr=bzbarsky,a=bsmedberg
This commit is contained in:
Родитель
b18f5dca93
Коммит
67a0394d02
|
@ -451,19 +451,29 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
break;
|
||||
case NS_MOUSE_EXIT:
|
||||
// If the event coordinate is within the bounds of the view,
|
||||
// then it's not really an exit --- we may have traversed
|
||||
// widget boundaries but we're still in our toplevel window.
|
||||
if ((aView->GetBounds() - aView->GetPosition()).Contains(aEvent->point)) {
|
||||
// treat it as a move so we don't generate spurious "exit"
|
||||
// events Any necessary exit events will be generated by
|
||||
// GenerateMouseEnterExit
|
||||
aEvent->message = NS_MOUSE_MOVE;
|
||||
// then fall through...
|
||||
} else {
|
||||
GenerateMouseEnterExit((nsGUIEvent*)aEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->message = 0;
|
||||
break;
|
||||
// and this is not the top-level window, then it's not really
|
||||
// an exit --- we may have traversed widget boundaries but
|
||||
// we're still in our toplevel window.
|
||||
// On the other hand, if we exit a toplevel window, then
|
||||
// it's really an exit even if the mouse is still in the
|
||||
// window bounds --- the mouse probably moved into some
|
||||
// "on top" window.
|
||||
{
|
||||
nsMouseEvent* mouseEvent = NS_STATIC_CAST(nsMouseEvent*, aEvent);
|
||||
nsCOMPtr<nsIWidget> parentWidget = getter_AddRefs(mouseEvent->widget->GetParent());
|
||||
if (parentWidget &&
|
||||
(aView->GetBounds() - aView->GetPosition()).Contains(aEvent->point)) {
|
||||
// treat it as a move so we don't generate spurious "exit"
|
||||
// events Any necessary exit events will be generated by
|
||||
// GenerateMouseEnterExit
|
||||
aEvent->message = NS_MOUSE_MOVE;
|
||||
// then fall through...
|
||||
} else {
|
||||
GenerateMouseEnterExit((nsGUIEvent*)aEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->message = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case NS_MOUSE_MOVE:
|
||||
// on the Mac, GenerateDragGesture() may not return until the drag
|
||||
|
|
Загрузка…
Ссылка в новой задаче