aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fluxbox.cc22
-rw-r--r--src/main.cc161
2 files changed, 120 insertions, 63 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 61b740a..78a482e 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -164,8 +164,14 @@ int handleXErrors(Display *d, XErrorEvent *e) {
164 char errtxt[128]; 164 char errtxt[128];
165 165
166 XGetErrorText(d, e->error_code, errtxt, 128); 166 XGetErrorText(d, e->error_code, errtxt, 128);
167 cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<< 167 cerr << "Fluxbox: X Error: "
168 (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; 168 << errtxt
169 << "(" <<(int)e->error_code << ") opcodes "
170 << (int)e->request_code
171 << "/"
172 << (int)e->minor_code
173 << " resource 0x" << hex <<(int)e->resourceid
174 << dec << endl;
169// if (e->error_code != 9 && e->error_code != 183) 175// if (e->error_code != 9 && e->error_code != 183)
170// kill(0, 2); 176// kill(0, 2);
171 } 177 }
@@ -1156,7 +1162,7 @@ void Fluxbox::shutdown() {
1156/// saves resources 1162/// saves resources
1157void Fluxbox::save_rc() { 1163void Fluxbox::save_rc() {
1158 _FB_USES_NLS; 1164 _FB_USES_NLS;
1159 XrmDatabase new_blackboxrc = 0; 1165 XrmDatabase new_rc = 0;
1160 1166
1161 string dbfile(getRcFilename()); 1167 string dbfile(getRcFilename());
1162 1168
@@ -1187,15 +1193,15 @@ void Fluxbox::save_rc() {
1187 workspaces_string += ','; 1193 workspaces_string += ',';
1188 } 1194 }
1189 1195
1190 XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str()); 1196 XrmPutLineResource(&new_rc, workspaces_string.c_str());
1191 1197
1192 } 1198 }
1193 1199
1194 XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.c_str()); 1200 XrmDatabase old_rc = XrmGetFileDatabase(dbfile.c_str());
1195 1201
1196 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together 1202 XrmMergeDatabases(new_rc, &old_rc); //merge database together
1197 XrmPutFileDatabase(old_blackboxrc, dbfile.c_str()); 1203 XrmPutFileDatabase(old_rc, dbfile.c_str());
1198 XrmDestroyDatabase(old_blackboxrc); 1204 XrmDestroyDatabase(old_rc);
1199 1205
1200 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl; 1206 fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;
1201 1207
diff --git a/src/main.cc b/src/main.cc
index 28302d4..6c03c63 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -70,116 +70,142 @@ using std::exception;
70 70
71static void showInfo(ostream &ostr) { 71static void showInfo(ostream &ostr) {
72 _FB_USES_NLS; 72 _FB_USES_NLS;
73 ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl; 73 ostr <<
74 _FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")
75 << ": "
76 << __fluxbox_version <<endl;
74 77
75 if (strlen(gitrevision()) > 0) 78 if (strlen(gitrevision()) > 0)
76 ostr << _FB_CONSOLETEXT(Common, SvnRevision, "GIT Revision", "Revision number in GIT repositary") << ": " << gitrevision() << endl; 79 ostr << _FB_CONSOLETEXT(Common, SvnRevision, "GIT Revision", "Revision number in GIT repositary")
80 << ": "
81 << gitrevision() << endl;
77#if defined(__DATE__) && defined(__TIME__) 82#if defined(__DATE__) && defined(__TIME__)
78 ostr<<_FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")<<": "<<__DATE__<<" "<<__TIME__<<endl; 83 ostr << _FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")
84 << ": "
85 << __DATE__
86 << " "
87 << __TIME__ << endl;
79#endif 88#endif
80#ifdef __fluxbox_compiler 89#ifdef __fluxbox_compiler
81 ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl; 90 ostr << _FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")
91 << ": "
92 << __fluxbox_compiler << endl;
82#endif // __fluxbox_compiler 93#endif // __fluxbox_compiler
83#ifdef __fluxbox_compiler_version 94#ifdef __fluxbox_compiler_version
84 ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; 95 ostr << _FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")
96 << ": "
97 << __fluxbox_compiler_version << endl;
85#endif // __fluxbox_compiler_version 98#endif // __fluxbox_compiler_version
86 99
87 ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl; 100 ostr << endl
101 <<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")
102 << ": " << endl;
88 103
89 ostr<<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl; 104 ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")
90 ostr<<_FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl; 105 << ": "
106 << DEFAULTMENU << endl;
107 ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")
108 << ": "
109 << DEFAULTSTYLE << endl;
91 110
92 ostr<<_FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl; 111 ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")
93 ostr<<_FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl; 112 << ": "
113 << DEFAULTKEYSFILE << endl;
114 ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")
115 << ": "
116 << DEFAULT_INITFILE << endl;
94 117
95#ifdef NLS 118#ifdef NLS
96 ostr<<_FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")<<": "<<LOCALEPATH<<endl; 119 ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")
120 << ": "
121 << LOCALEPATH << endl;
97#endif 122#endif
98 123
99 const char NOT[] = "-"; 124 const char NOT[] = "-";
100 ostr<<endl<< 125 ostr << endl
101 _FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled") 126 << _FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled")
102 <<" ("<<NOT<<" => "<< 127 << " (" << NOT << " => "
103 _FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<< 128 << _FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off") << "): " << endl
129 <<
104 130
105/**** NOTE: This list is in alphabetical order! ****/ 131/**** NOTE: This list is in alphabetical order! ****/
106 132
107#ifndef HAVE_FRIBIDI 133#ifndef HAVE_FRIBIDI
108 NOT<< 134 NOT <<
109#endif 135#endif
110 "BIDI"<<endl<< 136 "BIDI" << endl <<
111 137
112#ifndef DEBUG 138#ifndef DEBUG
113 NOT<< 139 NOT <<
114#endif // DEBUG 140#endif // DEBUG
115 "DEBUG"<<endl<< 141 "DEBUG" << endl <<
116 142
117#ifndef USE_NEWWMSPEC 143#ifndef USE_NEWWMSPEC
118 NOT<< 144 NOT <<
119#endif // USE_NEWWMSPEC 145#endif // USE_NEWWMSPEC
120 "EWMH"<<endl<< 146 "EWMH" << endl <<
121 147
122#ifndef USE_GNOME 148#ifndef USE_GNOME
123 NOT<< 149 NOT <<
124#endif // USE_GNOME 150#endif // USE_GNOME
125 "GNOME"<<endl<< 151 "GNOME" << endl <<
126 152
127#ifndef HAVE_IMLIB2 153#ifndef HAVE_IMLIB2
128 NOT<< 154 NOT<<
129#endif // HAVE_IMLIB2 155#endif // HAVE_IMLIB2
130 "IMLIB2"<<endl<< 156 "IMLIB2" << endl <<
131 157
132#ifndef NLS 158#ifndef NLS
133 NOT<< 159 NOT<<
134#endif // NLS 160#endif // NLS
135 "NLS"<<endl<< 161 "NLS" << endl <<
136 162
137#ifndef REMEMBER 163#ifndef REMEMBER
138 NOT<< 164 NOT <<
139#endif // REMEMBER 165#endif // REMEMBER
140 "REMEMBER"<<endl<< 166 "REMEMBER" << endl <<
141 167
142#ifndef HAVE_XRENDER 168#ifndef HAVE_XRENDER
143 NOT<< 169 NOT <<
144#endif // HAVE_XRENDER 170#endif // HAVE_XRENDER
145 "RENDER"<<endl<< 171 "RENDER" << endl <<
146 172
147#ifndef SHAPE 173#ifndef SHAPE
148 NOT<< 174 NOT <<
149#endif // SHAPE 175#endif // SHAPE
150 "SHAPE"<<endl<< 176 "SHAPE" << endl <<
151 177
152#ifndef SLIT 178#ifndef SLIT
153 NOT<< 179 NOT <<
154#endif // SLIT 180#endif // SLIT
155 "SLIT"<<endl<< 181 "SLIT" << endl <<
156 182
157#ifndef USE_TOOLBAR 183#ifndef USE_TOOLBAR
158 NOT<< 184 NOT <<
159#endif // USE_TOOLBAR 185#endif // USE_TOOLBAR
160 "TOOLBAR"<<endl<< 186 "TOOLBAR" << endl <<
161 187
162#ifndef USE_XFT 188#ifndef USE_XFT
163 NOT<< 189 NOT <<
164#endif // USE_XFT 190#endif // USE_XFT
165 "XFT"<<endl<< 191 "XFT" << endl <<
166 192
167#ifndef XINERAMA 193#ifndef XINERAMA
168 NOT<< 194 NOT <<
169#endif // XINERAMA 195#endif // XINERAMA
170 "XINERAMA"<<endl<< 196 "XINERAMA" << endl <<
171 197
172#ifndef USE_XMB 198#ifndef USE_XMB
173 NOT<< 199 NOT <<
174#endif // USE_XMB 200#endif // USE_XMB
175 "XMB"<<endl<< 201 "XMB" << endl <<
176 202
177#ifndef HAVE_XPM 203#ifndef HAVE_XPM
178 NOT<< 204 NOT <<
179#endif // HAVE_XPM 205#endif // HAVE_XPM
180 "XPM"<<endl<< 206 "XPM" << endl
181 207
182 endl; 208 << endl;
183} 209}
184 210
185struct Options { 211struct Options {
@@ -294,11 +320,17 @@ int main(int argc, char **argv) {
294 320
295 // setup log file 321 // setup log file
296 if (log_file.is_open()) { 322 if (log_file.is_open()) {
297 cerr<<_FB_CONSOLETEXT(main, LoggingTo, "Logging to", "Logging to a file")<<": "<<opts.log_filename<<endl; 323 cerr << _FB_CONSOLETEXT(main, LoggingTo, "Logging to", "Logging to a file")
298 log_file<<"------------------------------------------"<<endl; 324 << ": "
299 log_file<<_FB_CONSOLETEXT(main, LogFile, "Log File", "")<<": "<<opts.log_filename<<endl; 325 << opts.log_filename << endl;
326
327 log_file <<"------------------------------------------" << endl;
328 log_file << _FB_CONSOLETEXT(main, LogFile, "Log File", "")
329 << ": "
330 << opts.log_filename <<endl;
331
300 showInfo(log_file); 332 showInfo(log_file);
301 log_file<<"------------------------------------------"<<endl; 333 log_file << "------------------------------------------" << endl;
302 // setup log to use cout and cerr stream 334 // setup log to use cout and cerr stream
303 outbuf = cout.rdbuf(log_file.rdbuf()); 335 outbuf = cout.rdbuf(log_file.rdbuf());
304 errbuf = cerr.rdbuf(log_file.rdbuf()); 336 errbuf = cerr.rdbuf(log_file.rdbuf());
@@ -317,19 +349,38 @@ int main(int argc, char **argv) {
317 exitcode = EXIT_SUCCESS; 349 exitcode = EXIT_SUCCESS;
318 350
319 } catch (out_of_range &oor) { 351 } catch (out_of_range &oor) {
320 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; 352 cerr <<"Fluxbox: "
353 << _FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")
354 << ": "
355 << oor.what() << endl;
321 } catch (runtime_error &re) { 356 } catch (runtime_error &re) {
322 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl; 357 cerr << "Fluxbox: "
358 << _FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")
359 << ": "
360 << re.what() << endl;
323 } catch (bad_cast &bc) { 361 } catch (bad_cast &bc) {
324 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; 362 cerr << "Fluxbox: "
363 << _FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")
364 << ": "
365 << bc.what() << endl;
325 } catch (bad_alloc &ba) { 366 } catch (bad_alloc &ba) {
326 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl; 367 cerr << "Fluxbox: "
368 << _FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")
369 << ": "
370 << ba.what() << endl;
327 } catch (exception &e) { 371 } catch (exception &e) {
328 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl; 372 cerr << "Fluxbox: "
373 << _FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")
374 << ": "
375 << e.what() << endl;
329 } catch (string error_str) { 376 } catch (string error_str) {
330 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; 377 cerr << _FB_CONSOLETEXT(Common, Error, "Error", "Error message header")
378 << ": "
379 << error_str << endl;
331 } catch (...) { 380 } catch (...) {
332 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl; 381 cerr << "Fluxbox: "
382 << _FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")
383 << "." << endl;
333 abort(); 384 abort();
334 } 385 }
335 386