Bug 503892 - Remove window proc hook from nsToolkit r=roc

This commit is contained in:
Rob Arnold 2009-07-21 15:53:04 -07:00
Родитель b50c6956e5
Коммит 2a7ab3c42d
3 изменённых файлов: 7 добавлений и 68 удалений

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

@ -58,13 +58,6 @@
NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit)
// If PR_TRUE the user is currently moving a top level window.
static PRBool gIsMovingWindow = PR_FALSE;
// Message filter used to determine if the user is currently
// moving a top-level window.
static HHOOK nsMsgFilterHook = NULL;
//
// Static thread local storage index of the Toolkit
// object associated with a given thread...
@ -130,39 +123,6 @@ struct ThreadInitInfo {
nsToolkit *toolkit;
};
/* Detect when the user is moving a top-level window */
#ifndef WINCE
LRESULT CALLBACK DetectWindowMove(int code, WPARAM wParam, LPARAM lParam)
{
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
/* This msg filter is required to determine when the user has
* clicked in the window title bar and is moving the window.
*/
CWPSTRUCT* sysMsg = (CWPSTRUCT*)lParam;
if (sysMsg) {
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
NS_ASSERTION(appShell, "no appshell");
if (sysMsg->message == WM_ENTERSIZEMOVE) {
gIsMovingWindow = PR_TRUE;
// Notify appshell that it should favor interactivity
// over performance because the user is moving a
// window
appShell->FavorPerformanceHint(PR_FALSE, 0);
} else if (sysMsg->message == WM_EXITSIZEMOVE) {
gIsMovingWindow = PR_FALSE;
// Notify appshell that it should go back to its
// previous performance setting which may favor
// performance over interactivity
appShell->FavorPerformanceHint(PR_TRUE, 0);
}
}
return CallNextHookEx(nsMsgFilterHook, code, wParam, lParam);
}
#endif //#ifndef WINCE
MouseTrailer* nsToolkit::gMouseTrailer;
void RunPump(void* arg)
@ -228,15 +188,6 @@ nsToolkit::~nsToolkit()
gMouseTrailer = nsnull;
}
// Unhook the filter used to determine when
// the user is moving a top-level window.
#ifndef WINCE
if (nsMsgFilterHook != NULL) {
UnhookWindowsHookEx(nsMsgFilterHook);
nsMsgFilterHook = NULL;
}
#endif
#if defined (MOZ_STATIC_COMPONENT_LIBS) || defined(WINCE)
nsToolkit::Shutdown();
#endif
@ -370,23 +321,9 @@ NS_METHOD nsToolkit::Init(PRThread *aThread)
nsWidgetAtoms::RegisterAtoms();
#ifndef WINCE
// Hook window move messages so the toolkit can report when
// the user is moving a top-level window.
if (nsMsgFilterHook == NULL) {
nsMsgFilterHook = SetWindowsHookEx(WH_CALLWNDPROC, DetectWindowMove,
NULL, GetCurrentThreadId());
}
#endif
return NS_OK;
}
PRBool nsToolkit::UserIsMovingWindow(void)
{
return gIsMovingWindow;
}
//-------------------------------------------------------------------------
//
// nsToolkit WindowProc. Used to call methods on the "main GUI thread"...

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

@ -89,8 +89,6 @@ class nsToolkit : public nsIToolkit
PRThread* GetGuiThread(void) { return mGuiThread; }
HWND GetDispatchWindow(void) { return mDispatchWnd; }
void CreateInternalWindow(PRThread *aThread);
// Return whether the user is currently moving any application window
PRBool UserIsMovingWindow(void);
private:
~nsToolkit();

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

@ -2729,9 +2729,13 @@ nsWindow::HasPendingInputEvent()
// Note: When the user is moving the window WIN32 spins
// a separate event loop and input events are not
// reported to the application.
WORD qstatus = HIWORD(GetQueueStatus(QS_INPUT));
nsToolkit* toolkit = (nsToolkit *)mToolkit;
return qstatus || (toolkit && toolkit->UserIsMovingWindow());
if (HIWORD(GetQueueStatus(QS_INPUT)))
return PR_TRUE;
GUITHREADINFO guiInfo;
guiInfo.cbSize = sizeof(GUITHREADINFO);
if (!GetGUIThreadInfo(GetCurrentThreadId(), &guiInfo))
return PR_FALSE;
return GUI_INMOVESIZE == (guiInfo.flags & GUI_INMOVESIZE);
}
/**************************************************************