diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 5c348802e706..10f14f6ac1ac 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -400,6 +400,7 @@ nsWindow::nsWindow() : nsBaseWidget() mCustomNonClient = PR_FALSE; mHideChrome = PR_FALSE; mFullscreenMode = PR_FALSE; + mMousePresent = PR_FALSE; mWindowType = eWindowType_child; mBorderStyle = eBorderStyle_default; mPopupType = ePopupTypeAny; @@ -4921,6 +4922,8 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam, // priority SetTimer(mWnd, KILL_PRIORITY_ID, 2000 /* 2seconds */, NULL); #endif + mMousePresent = PR_TRUE; + // Suppress dispatch of pending events // when mouse moves are generated by widget // creation instead of user input. @@ -4942,6 +4945,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam, } break; + case WM_NCMOUSEMOVE: + // If we receive a mouse move event on non-client chrome, make sure and + // send an NS_MOUSE_EXIT event as well. + if (mMousePresent && !mIsInMouseCapture) + SendMessage(mWnd, WM_MOUSELEAVE, 0, 0); + break; + #ifdef WINCE_WINDOWS_MOBILE case WM_TIMER: SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); @@ -4977,6 +4987,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam, #ifndef WINCE case WM_MOUSELEAVE: { + if (!mMousePresent) + break; + mMousePresent = PR_FALSE; + // We need to check mouse button states and put them in for // wParam. WPARAM mouseState = (GetKeyState(VK_LBUTTON) ? MK_LBUTTON : 0) diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 96bd5e0b62e2..3cf566633807 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -500,6 +500,7 @@ protected: PRPackedBool mHideChrome; PRPackedBool mIsRTL; PRPackedBool mFullscreenMode; + PRPackedBool mMousePresent; PRUint32 mBlurSuppressLevel; DWORD_PTR mOldStyle; DWORD_PTR mOldExStyle;