Bug 555081 - Fix for mouse capture now that ChildWindow is gone from the main window. r=jmathies.

This commit is contained in:
Felipe Gomes 2010-06-24 21:01:07 -05:00
Родитель 308150b6d1
Коммит 90c57943da
2 изменённых файлов: 19 добавлений и 37 удалений

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

@ -3735,6 +3735,25 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam,
return result;
}
switch (aEventType) {
case NS_MOUSE_BUTTON_DOWN:
CaptureMouse(PR_TRUE);
break;
// NS_MOUSE_MOVE and NS_MOUSE_EXIT are here because we need to make sure capture flag
// isn't left on after a drag where we wouldn't see a button up message (see bug 324131).
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_MOVE:
case NS_MOUSE_EXIT:
if (!(wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) && mIsInMouseCapture)
CaptureMouse(PR_FALSE);
break;
default:
break;
} // switch
nsIntPoint eventPoint;
eventPoint.x = GET_X_LPARAM(lParam);
eventPoint.y = GET_Y_LPARAM(lParam);
@ -8023,39 +8042,6 @@ LPARAM nsWindow::lParamToClient(LPARAM lParam)
**************************************************************
**************************************************************/
// Deal with all sort of mouse event
PRBool ChildWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, LPARAM lParam,
PRBool aIsContextMenuKey, PRInt16 aButton, PRUint16 aInputSource)
{
PRBool result = PR_FALSE;
if (nsnull == mEventCallback) {
return result;
}
switch (aEventType) {
case NS_MOUSE_BUTTON_DOWN:
CaptureMouse(PR_TRUE);
break;
// NS_MOUSE_MOVE and NS_MOUSE_EXIT are here because we need to make sure capture flag
// isn't left on after a drag where we wouldn't see a button up message (see bug 324131).
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_MOVE:
case NS_MOUSE_EXIT:
if (!(wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) && mIsInMouseCapture)
CaptureMouse(PR_FALSE);
break;
default:
break;
} // switch
return nsWindow::DispatchMouseEvent(aEventType, wParam, lParam,
aIsContextMenuKey, aButton, aInputSource);
}
// return the style for a child nsWindow
DWORD ChildWindow::WindowStyle()
{

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

@ -564,10 +564,6 @@ class ChildWindow : public nsWindow {
public:
ChildWindow() {}
PRBool DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam, LPARAM lParam,
PRBool aIsContextMenuKey = PR_FALSE,
PRInt16 aButton = nsMouseEvent::eLeftButton,
PRUint16 aInputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE);
protected:
virtual DWORD WindowStyle();