1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-20 20:05:20 +02:00

LinkApp: various cleanups.

Log a warning message if setsid() fails.
Also improved code layout.
This commit is contained in:
Maarten ter Huurne 2011-10-23 13:03:11 +02:00
parent 40fcd5137e
commit 14bae043c0

View File

@ -458,28 +458,39 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
if (dontleave) { if (dontleave) {
system(command.c_str()); system(command.c_str());
} else { } else {
if (gmenu2x->confInt["saveSelection"] && (gmenu2x->confInt["section"]!=gmenu2x->menu->selSectionIndex() || gmenu2x->confInt["link"]!=gmenu2x->menu->selLinkIndex())) if (gmenu2x->confInt["saveSelection"] && (
gmenu2x->confInt["section"]!=gmenu2x->menu->selSectionIndex()
|| gmenu2x->confInt["link"]!=gmenu2x->menu->selLinkIndex()
)) {
gmenu2x->writeConfig(); gmenu2x->writeConfig();
}
#ifdef PLATFORM_GP2X #ifdef PLATFORM_GP2X
if (gmenu2x->fwType == "open2x" && gmenu2x->savedVolumeMode != gmenu2x->volumeMode) if (gmenu2x->fwType == "open2x"
&& gmenu2x->savedVolumeMode != gmenu2x->volumeMode) {
gmenu2x->writeConfigOpen2x(); gmenu2x->writeConfigOpen2x();
}
#endif #endif
if (selectedFile=="") if (selectedFile == "") {
gmenu2x->writeTmp(); gmenu2x->writeTmp();
gmenu2x->quit(); }
if (clock()!=gmenu2x->confInt["menuClock"]) if (clock() != gmenu2x->confInt["menuClock"]) {
gmenu2x->setClock(clock()); gmenu2x->setClock(clock());
}
gmenu2x->quit();
//if (gamma()!=0 && gamma()!=gmenu2x->confInt["gamma"]) //if (gamma()!=0 && gamma()!=gmenu2x->confInt["gamma"])
// gmenu2x->setGamma(gamma()); // gmenu2x->setGamma(gamma());
/* Make the terminal we're connected to (via stdin/stdout) our /* Make the terminal we're connected to (via stdin/stdout) our
contolling terminal again. Else many console programs are controlling terminal again. Else many console programs are
not going to work correctly. Actually this would not be not going to work correctly. Actually this would not be
necessary, if SDL correctly restored terminal state after necessary, if SDL correctly restored terminal state after
SDL_Quit(). */ SDL_Quit(). */
int pid = setsid(); pid_t pid = setsid();
if (pid == (pid_t)-1) {
WARNING("Failed to create new process group\n");
}
ioctl(1, TIOCSCTTY, STDOUT_FILENO); ioctl(1, TIOCSCTTY, STDOUT_FILENO);
int pgid = tcgetpgrp(STDOUT_FILENO); int pgid = tcgetpgrp(STDOUT_FILENO);
@ -493,7 +504,6 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
execlp("./gmenu2x", "./gmenu2x", NULL); execlp("./gmenu2x", "./gmenu2x", NULL);
} }
chdir(gmenu2x->getExePath().c_str()); chdir(gmenu2x->getExePath().c_str());
} }