예제 #1
0
파일: SoWin.cpp 프로젝트: Alexpux/SoWin
// documented in common/SoGuiCommon.cpp.in
void
SoWin::mainLoop(void)
{
  MSG msg;
  while (TRUE) {
    // FIXME: shouldn't this be a while loop, i.e. process all
    // messages, before doing the idle tasks? 20040721 mortene.
    if (GetQueueStatus(QS_ALLINPUT) != 0) { // if messagequeue != empty
      BOOL bRet;
      if ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0){ // if msg != WM_QUIT
        if (bRet == -1){
          // FIXME: handle the error and possibly exit
          break;
        }
        else {
          TranslateMessage(&msg); 
          DispatchMessage(&msg); 
        }
      }
      else break; // msg == WM_QUIT
    }
    else if (SoWinP::idleSensorId != 0) {
      doIdleTasks();
    }
    else {
      WaitMessage();
    }
  }
// Disabled invocation of SoWin::done(), since this calls SoDB::finish(),
// which means we would run into issues doing the usual...
//    SoWin::mainLoop();
//    root->unref();
}
예제 #2
0
SOSIMPLE_API void
SoSimple_mainLoop()
{
	MSG msg;

	while (TRUE)
	{
		if (::GetQueueStatus(QS_ALLINPUT) != 0)		// if messagequeue != empty
		{		
			if (::GetMessage(& msg, NULL, 0, 0))		// if msg != WM_QUIT
			{
				::TranslateMessage(& msg);
				::DispatchMessage(& msg);
			}
			else
				break;								// msg == WM_QUIT
		}
		else if (idleSensorId != 0)
		{
			doIdleTasks();
		}
		else
		{
			::WaitMessage();
		}
	}

	SoSimple::done();
}
예제 #3
0
SOSIMPLE_API void
SoSimple_mainLoop()
{
	MSG msg;

	for(;;)
	{
		while(::PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
		{
			if (msg.message == WM_QUIT)
			{
				SoSimple::done();
				return;
			}
			::TranslateMessage( &msg );
			::DispatchMessage( &msg );
		}

		if(idleSensorId!=0)
			doIdleTasks();

		SoSimple::doStbCallback();
	}

	SoSimple::done();
	return;
}
예제 #4
0
void CALLBACK
idleSensorCB(HWND window, UINT message, UINT idevent, DWORD dwtime)
{
#if SOWIN_DEBUG && 0
	SoDebugError::postInfo("SoWin::idleSensorCB", "called");
#endif // SOWIN_DEBUG

	doIdleTasks();
}