This commit is contained in:
Mathias Gumz 2010-09-18 17:27:28 +02:00
parent 9cf312fc9d
commit c9c741c88d
3 changed files with 121 additions and 64 deletions

View file

@ -164,8 +164,14 @@ int handleXErrors(Display *d, XErrorEvent *e) {
char errtxt[128]; char errtxt[128];
XGetErrorText(d, e->error_code, errtxt, 128); XGetErrorText(d, e->error_code, errtxt, 128);
cerr<<"Fluxbox: X Error: "<<errtxt<<"("<<(int)e->error_code<<") opcodes "<< cerr << "Fluxbox: X Error: "
(int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; << errtxt
<< "(" <<(int)e->error_code << ") opcodes "
<< (int)e->request_code
<< "/"
<< (int)e->minor_code
<< " resource 0x" << hex <<(int)e->resourceid
<< dec << endl;
// if (e->error_code != 9 && e->error_code != 183) // if (e->error_code != 9 && e->error_code != 183)
// kill(0, 2); // kill(0, 2);
} }
@ -1156,7 +1162,7 @@ void Fluxbox::shutdown() {
/// saves resources /// saves resources
void Fluxbox::save_rc() { void Fluxbox::save_rc() {
_FB_USES_NLS; _FB_USES_NLS;
XrmDatabase new_blackboxrc = 0; XrmDatabase new_rc = 0;
string dbfile(getRcFilename()); string dbfile(getRcFilename());
@ -1187,15 +1193,15 @@ void Fluxbox::save_rc() {
workspaces_string += ','; workspaces_string += ',';
} }
XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str()); XrmPutLineResource(&new_rc, workspaces_string.c_str());
} }
XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.c_str()); XrmDatabase old_rc = XrmGetFileDatabase(dbfile.c_str());
XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together XrmMergeDatabases(new_rc, &old_rc); //merge database together
XrmPutFileDatabase(old_blackboxrc, dbfile.c_str()); XrmPutFileDatabase(old_rc, dbfile.c_str());
XrmDestroyDatabase(old_blackboxrc); XrmDestroyDatabase(old_rc);
fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl; fbdbg<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;

View file

@ -70,116 +70,142 @@ using std::exception;
static void showInfo(ostream &ostr) { static void showInfo(ostream &ostr) {
_FB_USES_NLS; _FB_USES_NLS;
ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl; ostr <<
_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")
<< ": "
<< __fluxbox_version <<endl;
if (strlen(gitrevision()) > 0) if (strlen(gitrevision()) > 0)
ostr << _FB_CONSOLETEXT(Common, SvnRevision, "GIT Revision", "Revision number in GIT repositary") << ": " << gitrevision() << endl; ostr << _FB_CONSOLETEXT(Common, SvnRevision, "GIT Revision", "Revision number in GIT repositary")
<< ": "
<< gitrevision() << endl;
#if defined(__DATE__) && defined(__TIME__) #if defined(__DATE__) && defined(__TIME__)
ostr<<_FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")<<": "<<__DATE__<<" "<<__TIME__<<endl; ostr << _FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")
<< ": "
<< __DATE__
<< " "
<< __TIME__ << endl;
#endif #endif
#ifdef __fluxbox_compiler #ifdef __fluxbox_compiler
ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl; ostr << _FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")
<< ": "
<< __fluxbox_compiler << endl;
#endif // __fluxbox_compiler #endif // __fluxbox_compiler
#ifdef __fluxbox_compiler_version #ifdef __fluxbox_compiler_version
ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; ostr << _FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")
<< ": "
<< __fluxbox_compiler_version << endl;
#endif // __fluxbox_compiler_version #endif // __fluxbox_compiler_version
ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl; ostr << endl
<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")
<< ": " << endl;
ostr<<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl; ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")
ostr<<_FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl; << ": "
<< DEFAULTMENU << endl;
ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")
<< ": "
<< DEFAULTSTYLE << endl;
ostr<<_FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl; ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")
ostr<<_FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl; << ": "
<< DEFAULTKEYSFILE << endl;
ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")
<< ": "
<< DEFAULT_INITFILE << endl;
#ifdef NLS #ifdef NLS
ostr<<_FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")<<": "<<LOCALEPATH<<endl; ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")
<< ": "
<< LOCALEPATH << endl;
#endif #endif
const char NOT[] = "-"; const char NOT[] = "-";
ostr<<endl<< ostr << endl
_FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled") << _FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled")
<<" ("<<NOT<<" => "<< << " (" << NOT << " => "
_FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<< << _FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off") << "): " << endl
<<
/**** NOTE: This list is in alphabetical order! ****/ /**** NOTE: This list is in alphabetical order! ****/
#ifndef HAVE_FRIBIDI #ifndef HAVE_FRIBIDI
NOT<< NOT <<
#endif #endif
"BIDI"<<endl<< "BIDI" << endl <<
#ifndef DEBUG #ifndef DEBUG
NOT<< NOT <<
#endif // DEBUG #endif // DEBUG
"DEBUG"<<endl<< "DEBUG" << endl <<
#ifndef USE_NEWWMSPEC #ifndef USE_NEWWMSPEC
NOT<< NOT <<
#endif // USE_NEWWMSPEC #endif // USE_NEWWMSPEC
"EWMH"<<endl<< "EWMH" << endl <<
#ifndef USE_GNOME #ifndef USE_GNOME
NOT<< NOT <<
#endif // USE_GNOME #endif // USE_GNOME
"GNOME"<<endl<< "GNOME" << endl <<
#ifndef HAVE_IMLIB2 #ifndef HAVE_IMLIB2
NOT<< NOT<<
#endif // HAVE_IMLIB2 #endif // HAVE_IMLIB2
"IMLIB2"<<endl<< "IMLIB2" << endl <<
#ifndef NLS #ifndef NLS
NOT<< NOT<<
#endif // NLS #endif // NLS
"NLS"<<endl<< "NLS" << endl <<
#ifndef REMEMBER #ifndef REMEMBER
NOT<< NOT <<
#endif // REMEMBER #endif // REMEMBER
"REMEMBER"<<endl<< "REMEMBER" << endl <<
#ifndef HAVE_XRENDER #ifndef HAVE_XRENDER
NOT<< NOT <<
#endif // HAVE_XRENDER #endif // HAVE_XRENDER
"RENDER"<<endl<< "RENDER" << endl <<
#ifndef SHAPE #ifndef SHAPE
NOT<< NOT <<
#endif // SHAPE #endif // SHAPE
"SHAPE"<<endl<< "SHAPE" << endl <<
#ifndef SLIT #ifndef SLIT
NOT<< NOT <<
#endif // SLIT #endif // SLIT
"SLIT"<<endl<< "SLIT" << endl <<
#ifndef USE_TOOLBAR #ifndef USE_TOOLBAR
NOT<< NOT <<
#endif // USE_TOOLBAR #endif // USE_TOOLBAR
"TOOLBAR"<<endl<< "TOOLBAR" << endl <<
#ifndef USE_XFT #ifndef USE_XFT
NOT<< NOT <<
#endif // USE_XFT #endif // USE_XFT
"XFT"<<endl<< "XFT" << endl <<
#ifndef XINERAMA #ifndef XINERAMA
NOT<< NOT <<
#endif // XINERAMA #endif // XINERAMA
"XINERAMA"<<endl<< "XINERAMA" << endl <<
#ifndef USE_XMB #ifndef USE_XMB
NOT<< NOT <<
#endif // USE_XMB #endif // USE_XMB
"XMB"<<endl<< "XMB" << endl <<
#ifndef HAVE_XPM #ifndef HAVE_XPM
NOT<< NOT <<
#endif // HAVE_XPM #endif // HAVE_XPM
"XPM"<<endl<< "XPM" << endl
endl; << endl;
} }
struct Options { struct Options {
@ -294,11 +320,17 @@ int main(int argc, char **argv) {
// setup log file // setup log file
if (log_file.is_open()) { if (log_file.is_open()) {
cerr<<_FB_CONSOLETEXT(main, LoggingTo, "Logging to", "Logging to a file")<<": "<<opts.log_filename<<endl; cerr << _FB_CONSOLETEXT(main, LoggingTo, "Logging to", "Logging to a file")
log_file<<"------------------------------------------"<<endl; << ": "
log_file<<_FB_CONSOLETEXT(main, LogFile, "Log File", "")<<": "<<opts.log_filename<<endl; << opts.log_filename << endl;
log_file <<"------------------------------------------" << endl;
log_file << _FB_CONSOLETEXT(main, LogFile, "Log File", "")
<< ": "
<< opts.log_filename <<endl;
showInfo(log_file); showInfo(log_file);
log_file<<"------------------------------------------"<<endl; log_file << "------------------------------------------" << endl;
// setup log to use cout and cerr stream // setup log to use cout and cerr stream
outbuf = cout.rdbuf(log_file.rdbuf()); outbuf = cout.rdbuf(log_file.rdbuf());
errbuf = cerr.rdbuf(log_file.rdbuf()); errbuf = cerr.rdbuf(log_file.rdbuf());
@ -317,19 +349,38 @@ int main(int argc, char **argv) {
exitcode = EXIT_SUCCESS; exitcode = EXIT_SUCCESS;
} catch (out_of_range &oor) { } catch (out_of_range &oor) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; cerr <<"Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")
<< ": "
<< oor.what() << endl;
} catch (runtime_error &re) { } catch (runtime_error &re) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl; cerr << "Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")
<< ": "
<< re.what() << endl;
} catch (bad_cast &bc) { } catch (bad_cast &bc) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; cerr << "Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")
<< ": "
<< bc.what() << endl;
} catch (bad_alloc &ba) { } catch (bad_alloc &ba) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl; cerr << "Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")
<< ": "
<< ba.what() << endl;
} catch (exception &e) { } catch (exception &e) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl; cerr << "Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")
<< ": "
<< e.what() << endl;
} catch (string error_str) { } catch (string error_str) {
cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; cerr << _FB_CONSOLETEXT(Common, Error, "Error", "Error message header")
<< ": "
<< error_str << endl;
} catch (...) { } catch (...) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl; cerr << "Fluxbox: "
<< _FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")
<< "." << endl;
abort(); abort();
} }

View file

@ -563,7 +563,7 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile); string appsfilename = FbTk::StringUtil::expandFilename(*rc_appsfile);
string keyfilename = FbTk::StringUtil::expandFilename(*rc_keyfile); string keyfilename = FbTk::StringUtil::expandFilename(*rc_keyfile);
int i; size_t i;
for (i = 0; i < sizeof(UPDATES) / sizeof(Update); ++i) { for (i = 0; i < sizeof(UPDATES) / sizeof(Update); ++i) {
if (old_version < UPDATES[i].version) { if (old_version < UPDATES[i].version) {
UPDATES[i].update(rm, keyfilename, appsfilename); UPDATES[i].update(rm, keyfilename, appsfilename);