Bug 613781 - Make NS_MOUSE_EXIT events more reliable on windows. r=robarnold, a=final.

This commit is contained in:
Jim Mathies 2010-12-15 11:01:52 -06:00
Родитель bbaf060276
Коммит 2784245427
2 изменённых файлов: 15 добавлений и 0 удалений

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

@ -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)

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

@ -500,6 +500,7 @@ protected:
PRPackedBool mHideChrome;
PRPackedBool mIsRTL;
PRPackedBool mFullscreenMode;
PRPackedBool mMousePresent;
PRUint32 mBlurSuppressLevel;
DWORD_PTR mOldStyle;
DWORD_PTR mOldExStyle;