From de12315c65a0b9dc1b72352a22c5562f0e9d5dcf Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 23 Feb 2005 21:46:43 +0000 Subject: [PATCH] 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 --- .../events/src/nsEventStateManager.cpp | 21 ++++++++++++++----- mozilla/view/src/nsViewManager.cpp | 3 +-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 08c7e30ab95..c3ede940391 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -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 diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index 706ac795b8d..c8908448240 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -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;