From bafb4a773758c4ba4d07ea72125ea88ddaa40321 Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Thu, 24 Jun 2010 21:01:07 -0500 Subject: [PATCH] Bug 555081 - Fix for mouse capture now that ChildWindow is gone from the main window. r=jmathies. --- widget/src/windows/nsWindow.cpp | 52 ++++++++++++--------------------- widget/src/windows/nsWindow.h | 4 --- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 6b7a7a1db9e..129b39e2662 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -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() { diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index fbee5c0b270..d53351821c3 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -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();