Bug 125386. Turn MOUSE_EXIT events into MOUSE_MOVEs when the mouse didn't actually leave the top level widget. r+sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@169684 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2005-02-23 21:46:43 +00:00
parent e1db3ec1ac
commit de12315c65
2 changed files with 17 additions and 7 deletions

View File

@@ -460,6 +460,22 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case NS_MOUSE_MIDDLE_BUTTON_UP:
SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
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(aPresContext, (nsGUIEvent*)aEvent);
//This is a window level mouse exit event and should stop here
aEvent->message = 0;
break;
}
case NS_MOUSE_MOVE:
if (IsTrackingDragGesture() &&
NS_STATIC_CAST(nsMouseEvent*, aEvent)->reason ==
@@ -482,11 +498,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
GenerateMouseEnterExit(aPresContext, (nsGUIEvent*)aEvent);
break;
case NS_MOUSE_EXIT:
GenerateMouseEnterExit(aPresContext, (nsGUIEvent*)aEvent);
//This is a window level mouseenter event and should stop here
aEvent->message = 0;
break;
#ifdef CLICK_HOLD_CONTEXT_MENUS
case NS_DRAGDROP_GESTURE:
// an external drag gesture event came in, not generated internally

View File

@@ -2434,7 +2434,6 @@ nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBo
// accessibility events and key events are dispatched directly to the focused view
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT
|| aEvent->message == NS_CONTEXTMENU_KEY
|| aEvent->message == NS_MOUSE_EXIT
|| NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent) || NS_IS_FOCUS_EVENT(aEvent)) {
nsEventStatus status = nsEventStatus_eIgnore;
if (obs) {
@@ -3598,7 +3597,7 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView,
if (isClipView) {
aDamageRect = &irect;
}
if (aEventProcessing && aRealView == aView) {
if (aEventProcessing && aTopView == aView) {
// Always deliver an event somewhere, at least to the top-level target.
// There may be mouse capturing going on.
overlap = PR_TRUE;