bug #8627: simulates NS_MOUSE_LEFT_BUTTON_UP after TrackControl/LClick calls which eat the native mouseUp event. This enables correct DOM event filtering.

This commit is contained in:
beard%netscape.com 1999-07-23 00:27:05 +00:00
Родитель 1aa9b24b4f
Коммит 8c56ffebfe
2 изменённых файлов: 26 добавлений и 11 удалений

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

@ -332,22 +332,31 @@ nsresult nsComboBox::Deselect()
//-------------------------------------------------------------------------
PRBool nsComboBox::DispatchMouseEvent(nsMouseEvent &aEvent)
{
PRBool eventHandled = PR_FALSE;
switch (aEvent.message)
{
case NS_MOUSE_LEFT_DOUBLECLICK:
case NS_MOUSE_LEFT_BUTTON_DOWN:
StartDraw();
{
eventHandled = Inherited::DispatchMouseEvent(aEvent);
if (!eventHandled) {
StartDraw();
Point thePoint;
thePoint.h = aEvent.point.x;
thePoint.v = aEvent.point.y;
::TrackControl(mControl, thePoint, nil);
ControlChanged(::GetControlValue(mControl));
//¥TODO: the mouseUp event is eaten by TrackControl.
//¥ We should create it and dispatch it after the mouseDown;
EndDraw();
// since the mouseUp event will be consumed by TrackControl,
// simulate the mouse up event immediately.
nsMouseEvent mouseUpEvent = aEvent;
mouseUpEvent.message = NS_MOUSE_LEFT_BUTTON_UP;
Inherited::DispatchMouseEvent(mouseUpEvent);
}
EndDraw();
break;
default:
eventHandled = Inherited::DispatchMouseEvent(aEvent);
break;
}
return (Inherited::DispatchMouseEvent(aEvent));
return eventHandled;
}

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

@ -512,12 +512,14 @@ nsresult nsListBox::Deselect()
//-------------------------------------------------------------------------
PRBool nsListBox::DispatchMouseEvent(nsMouseEvent &aEvent)
{
PRBool eventHandled = PR_FALSE;
switch (aEvent.message)
{
case NS_MOUSE_LEFT_DOUBLECLICK:
case NS_MOUSE_LEFT_BUTTON_DOWN:
StartDraw();
{
eventHandled = Inherited::DispatchMouseEvent(aEvent);
if (!eventHandled) {
StartDraw();
Point thePoint;
thePoint.h = aEvent.point.x;
thePoint.v = aEvent.point.y;
@ -529,10 +531,14 @@ PRBool nsListBox::DispatchMouseEvent(nsMouseEvent &aEvent)
::LClick(thePoint, modifiers, mListHandle);
ControlChanged(GetSelectedIndex());
}
//¥TODO: the mouseUp event is eaten by TrackControl.
//¥ We should create it and dispatch it after the mouseDown;
EndDraw();
// since the mouseUp event will be consumed by TrackControl,
// simulate the mouse up event immediately.
nsMouseEvent mouseUpEvent = aEvent;
mouseUpEvent.message = NS_MOUSE_LEFT_BUTTON_UP;
Inherited::DispatchMouseEvent(mouseUpEvent);
}
EndDraw();
break;
}
return (Inherited::DispatchMouseEvent(aEvent));