backing out changes for 129953...

git-svn-id: svn://10.0.0.236/trunk@118729 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com
2002-04-11 05:38:55 +00:00
parent a770b81658
commit 63ff0ed4b4
7 changed files with 28 additions and 203 deletions

View File

@@ -89,21 +89,12 @@ NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
//
//-------------------------------------------------------------------------
#include "nsITimerManager.h"
NS_METHOD nsAppShell::Run(void)
{
NS_ADDREF_THIS();
MSG msg;
int keepGoing = 1;
nsresult rv;
nsCOMPtr<nsITimerManager> timerManager(do_GetService("@mozilla.org/timer/manager;1", &rv));
if (NS_FAILED(rv)) return rv;
timerManager->SetUseIdleTimers(PR_TRUE);
gKeepGoing = 1;
// Process messages
do {
@@ -125,26 +116,15 @@ NS_METHOD nsAppShell::Run(void)
mDispatchListener->AfterDispatch();
}
} else {
PRBool hasTimers;
timerManager->HasIdleTimers(&hasTimers);
if (hasTimers) {
do {
timerManager->FireNextIdleTimer();
timerManager->HasIdleTimers(&hasTimers);
} while (hasTimers && !::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
if (!gKeepGoing) {
// In this situation, PostQuitMessage() was called, but the WM_QUIT
// message was removed from the event queue by someone else -
// (see bug #54725). So, just exit the loop as if WM_QUIT had been
// reeceived...
keepGoing = 0;
} else {
if (!gKeepGoing) {
// In this situation, PostQuitMessage() was called, but the WM_QUIT
// message was removed from the event queue by someone else -
// (see bug #54725). So, just exit the loop as if WM_QUIT had been
// reeceived...
keepGoing = 0;
} else {
// Block and wait for any posted application message
::WaitMessage();
}
// Block and wait for any posted application message
::WaitMessage();
}
}
@@ -169,10 +149,6 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
BOOL gotMessage = false;
nsresult rv;
nsCOMPtr<nsITimerManager> timerManager(do_GetService("@mozilla.org/timer/manager;1", &rv));
if (NS_FAILED(rv)) return rv;
do {
// Give priority to system messages (in particular keyboard, mouse,
// timer, and paint messages).
@@ -182,17 +158,8 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
gotMessage = true;
} else {
PRBool hasTimers;
timerManager->HasIdleTimers(&hasTimers);
if (hasTimers) {
do {
timerManager->FireNextIdleTimer();
timerManager->HasIdleTimers(&hasTimers);
} while (hasTimers && !::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE));
} else {
// Block and wait for any posted application message
::WaitMessage();
}
// Block and wait for any posted application message
::WaitMessage();
}
} while (!gotMessage);