Added a half second sleep after calling system command when the command is run in the background so

that this command has a chance to run and open a window before the calling present3D moves on to the next frame.
This commit is contained in:
Robert Osfield
2011-09-20 11:46:45 +00:00
parent 0b7dbc68c9
commit 12e8d09ed1

View File

@@ -161,10 +161,21 @@ void PickEventHandler::doOperation()
}
#endif
bool commandRunsInBackground = (_command.find("&")!=std::string::npos);
int result = system(_command.c_str());
OSG_INFO<<"system("<<_command<<") result "<<result<<std::endl;
if (commandRunsInBackground)
{
// Sleep breifly while command runs in background to give it a chance to open
// a window and obscure this present3D's window avoiding this present3D from
// rendering anything new before the new window opens.
OpenThreads::Thread::microSleep(500000); // half second sleep.
}
break;
}
case(osgPresentation::LOAD):