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

This commit is contained in:
roc+%cs.cmu.edu 2005-02-23 21:46:43 +00:00
Родитель e706278ebb
Коммит 55480a9b6f
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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;