Changed Run() to give priority to system messages over application messages

This commit is contained in:
troy%netscape.com 1999-09-13 18:45:03 +00:00
parent 6a276ed201
commit b09c6bfe4e

View File

@ -42,18 +42,34 @@ nsNativeViewerApp::Run()
OpenWindow();
// Process messages
MSG msg;
while (::GetMessage(&msg, NULL, 0, 0)) {
if (!JSConsole::sAccelTable ||
!gConsole ||
!gConsole->GetMainWindow() ||
!TranslateAccelerator(gConsole->GetMainWindow(),
JSConsole::sAccelTable, &msg)) {
MSG msg;
int keepGoing = 1;
// Pump all messages
do {
BOOL havePriorityMessage;
// Give priority to system messages (in particular keyboard, mouse,
// timer, and paint messages).
// Note: on Win98 and NT 5.0 we can also use PM_QS_INPUT and PM_QS_PAINT flags.
if (::PeekMessage(&msg, NULL, 0, WM_USER-1, PM_REMOVE)) {
keepGoing = (msg.message != WM_QUIT);
} else {
// Block and wait for any posted application message
keepGoing = ::GetMessage(&msg, NULL, 0, 0);
}
// If we successfully retrieved a message then dispatch it
if (keepGoing >= 0) {
if (!JSConsole::sAccelTable || !gConsole || !gConsole->GetMainWindow() ||
!TranslateAccelerator(gConsole->GetMainWindow(), JSConsole::sAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} while (keepGoing != 0);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}