correctly send dragExit events when the mouse leaves the window (bug# 18356) r=saari.

This commit is contained in:
pinkerton%netscape.com 1999-11-11 20:28:23 +00:00
Родитель e00d672d83
Коммит f83ca3629c
1 изменённых файлов: 16 добавлений и 5 удалений

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

@ -455,8 +455,16 @@ PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal,
widgetHit->LocalToWindowCoordinate(widgetOrigin);
widgetHitPoint.MoveBy(-widgetOrigin.x, -widgetOrigin.y);
}
else
widgetHit = mTopLevelWidget;
else {
// this is most likely the case of a drag exit, so we need to make sure
// we send the event to the last pointed to widget. We don't really care
// about the mouse coordinates because we know they're outside the window.
widgetHit = gEventDispatchHandler.GetWidgetPointed();
widgetHitPoint = nsPoint(0,0);
}
// update the tracking of which widget the mouse is now over.
gEventDispatchHandler.SetWidgetPointed(widgetHit);
// nsEvent
geckoEvent.eventStructType = NS_DRAGDROP_EVENT;
@ -477,7 +485,10 @@ PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal,
// nsMouseEvent
geckoEvent.clickCount = 1;
widgetHit->DispatchMouseEvent(geckoEvent);
if ( widgetHit )
widgetHit->DispatchMouseEvent(geckoEvent);
else
NS_WARNING ("Oh shit, no widget to dispatch event to, we're in trouble" );
return PR_TRUE;