summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/main.cc b/src/main.cc
index b7fb949..137d1de 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: main.cc,v 1.32 2004/10/11 22:48:35 rathnor Exp $ 23// $Id: main.cc,v 1.33 2004/10/18 01:26:54 akir Exp $
24 24
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "version.h" 26#include "version.h"
@@ -28,6 +28,7 @@
28 28
29#include "FbTk/Theme.hh" 29#include "FbTk/Theme.hh"
30#include "FbTk/I18n.hh" 30#include "FbTk/I18n.hh"
31#include "FbTk/StringUtil.hh"
31 32
32#ifdef HAVE_CONFIG_H 33#ifdef HAVE_CONFIG_H
33#include "config.h" 34#include "config.h"
@@ -73,10 +74,10 @@ void showInfo(ostream &ostr) {
73#endif // __fluxbox_compiler_version 74#endif // __fluxbox_compiler_version
74 75
75 ostr<<endl<<_FBTEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl; 76 ostr<<endl<<_FBTEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;
76 77
77 ostr<<_FBTEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl; 78 ostr<<_FBTEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl;
78 ostr<<_FBTEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl; 79 ostr<<_FBTEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl;
79 80
80 ostr<<_FBTEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl; 81 ostr<<_FBTEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl;
81 ostr<<_FBTEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl; 82 ostr<<_FBTEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl;
82 83
@@ -87,7 +88,7 @@ void showInfo(ostream &ostr) {
87 _FBTEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<< 88 _FBTEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<<
88#ifndef DEBUG 89#ifndef DEBUG
89 NOT<< 90 NOT<<
90#endif // DEBUG 91#endif // DEBUG
91 "DEBUG"<<endl<< 92 "DEBUG"<<endl<<
92 93
93#ifndef SLIT 94#ifndef SLIT
@@ -107,7 +108,7 @@ void showInfo(ostream &ostr) {
107 108
108#ifndef USE_GNOME 109#ifndef USE_GNOME
109 NOT<< 110 NOT<<
110#endif // USE_GNOME 111#endif // USE_GNOME
111 "GNOME"<<endl<< 112 "GNOME"<<endl<<
112 113
113#ifndef KDE 114#ifndef KDE
@@ -153,14 +154,14 @@ void showInfo(ostream &ostr) {
153} 154}
154 155
155int main(int argc, char **argv) { 156int main(int argc, char **argv) {
156 157
157 std::string session_display = ""; 158 std::string session_display = "";
158 std::string rc_file; 159 std::string rc_file;
159 std::string log_filename; 160 std::string log_filename;
160 161
161 FbTk::NLSInit("fluxbox.cat"); 162 FbTk::NLSInit("fluxbox.cat");
162 _FB_USES_NLS; 163 _FB_USES_NLS;
163 164
164 int i; 165 int i;
165 for (i = 1; i < argc; ++i) { 166 for (i = 1; i < argc; ++i) {
166 if (! strcmp(argv[i], "-rc")) { 167 if (! strcmp(argv[i], "-rc")) {
@@ -249,11 +250,11 @@ int main(int argc, char **argv) {
249 } 250 }
250 251
251 try { 252 try {
252 253
253 fluxbox.reset(new Fluxbox(argc, argv, session_display.c_str(), rc_file.c_str())); 254 fluxbox.reset(new Fluxbox(argc, argv, session_display.c_str(), rc_file.c_str()));
254 fluxbox->eventLoop(); 255 fluxbox->eventLoop();
255 256
256 exitcode = EXIT_SUCCESS; 257 exitcode = EXIT_SUCCESS;
257 258
258 } catch (std::out_of_range &oor) { 259 } catch (std::out_of_range &oor) {
259 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; 260 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl;
@@ -271,6 +272,10 @@ int main(int argc, char **argv) {
271 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl; 272 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
272 abort(); 273 abort();
273 } 274 }
275
276 bool restarting = fluxbox->isRestarting();
277 const std::string restart_argument(fluxbox->getRestartArgument());
278
274 // destroy fluxbox 279 // destroy fluxbox
275 fluxbox.reset(0); 280 fluxbox.reset(0);
276 281
@@ -280,5 +285,16 @@ int main(int argc, char **argv) {
280 if (errbuf != 0) 285 if (errbuf != 0)
281 cerr.rdbuf(errbuf); 286 cerr.rdbuf(errbuf);
282 287
288 if (restarting) {
289 if (restart_argument.c_str()) {
290 execlp(restart_argument.c_str(), restart_argument.c_str(), 0);
291 perror(restart_argument.c_str());
292 }
293
294 // fall back in case the above execlp doesn't work
295 execvp(argv[0], argv);
296 execvp(FbTk::StringUtil::basename(argv[0]).c_str(), argv);
297 }
298
283 return exitcode; 299 return exitcode;
284} 300}