summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fluxbox.cc38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 8f8e044..dbf09f1 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1,5 +1,5 @@
1// fluxbox.cc for Fluxbox. 1// fluxbox.cc for Fluxbox Window Manager
2// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3// 3//
4// blackbox.cc for blackbox - an X11 Window manager 4// blackbox.cc for blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
@@ -22,6 +22,8 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.16 2002/01/09 14:07:09 fluxgen Exp $
26
25// stupid macros needed to access some functions in version 2 of the GNU C 27// stupid macros needed to access some functions in version 2 of the GNU C
26// library 28// library
27#ifndef _GNU_SOURCE 29#ifndef _GNU_SOURCE
@@ -1427,7 +1429,7 @@ void Fluxbox::save_rc(void) {
1427 XrmDatabase new_blackboxrc = (XrmDatabase) 0; 1429 XrmDatabase new_blackboxrc = (XrmDatabase) 0;
1428 char rc_string[1024]; 1430 char rc_string[1024];
1429 1431
1430 char *dbfile = getRcFilename(); //note: dbfile memory will be release @ end of function 1432 auto_ptr<char> dbfile(getRcFilename());
1431 1433
1432// load_rc(); This overwrites configs made while running, for example 1434// load_rc(); This overwrites configs made while running, for example
1433// usage of iconbar and tabs 1435// usage of iconbar and tabs
@@ -1680,15 +1682,13 @@ void Fluxbox::save_rc(void) {
1680 delete [] save_string; 1682 delete [] save_string;
1681 } 1683 }
1682 1684
1683 XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile); 1685 XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.get());
1684 1686
1685 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together 1687 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together
1686 XrmPutFileDatabase(old_blackboxrc, dbfile); 1688 XrmPutFileDatabase(old_blackboxrc, dbfile.get());
1687 XrmDestroyDatabase(old_blackboxrc); 1689 XrmDestroyDatabase(old_blackboxrc);
1688// XrmDestroyDatabase(new_blackboxrc); 1690// XrmDestroyDatabase(new_blackboxrc);
1689 1691
1690 //finaly release filename memory
1691 delete [] dbfile;
1692} 1692}
1693 1693
1694//-------- getRcFilename ------------- 1694//-------- getRcFilename -------------
@@ -1716,17 +1716,15 @@ void Fluxbox::load_rc(void) {
1716 XrmDatabase database = (XrmDatabase) 0; 1716 XrmDatabase database = (XrmDatabase) 0;
1717 1717
1718 //get resource filename 1718 //get resource filename
1719 char *dbfile = getRcFilename(); //note: dont forget to free memory 1719 auto_ptr<char> dbfile(getRcFilename());
1720 1720
1721 //load file 1721 //load file
1722 database = XrmGetFileDatabase(dbfile); 1722 database = XrmGetFileDatabase(dbfile.get());
1723 if (!database) { 1723 if (!database) {
1724 cerr<<"Fluxbox: Cant open "<<dbfile<<" !"<<endl; 1724 cerr<<"Fluxbox: Cant open "<<dbfile.get()<<" !"<<endl;
1725 cerr<<"Using: "<<DEFAULT_INITFILE<<endl; 1725 cerr<<"Using: "<<DEFAULT_INITFILE<<endl;
1726 database = XrmGetFileDatabase(DEFAULT_INITFILE); 1726 database = XrmGetFileDatabase(DEFAULT_INITFILE);
1727 } 1727 }
1728 //destroy dbfile (created by getRcFilename)
1729 delete [] dbfile;
1730 1728
1731 XrmValue value; 1729 XrmValue value;
1732 char *value_type; 1730 char *value_type;
@@ -1937,13 +1935,11 @@ void Fluxbox::loadTitlebar() {
1937void Fluxbox::load_rc(BScreen *screen) { 1935void Fluxbox::load_rc(BScreen *screen) {
1938 XrmDatabase database = (XrmDatabase) 0; 1936 XrmDatabase database = (XrmDatabase) 0;
1939 1937
1940 char *dbfile = getRcFilename(); 1938 auto_ptr<char> dbfile(getRcFilename());
1941 1939
1942 database = XrmGetFileDatabase(dbfile); 1940 database = XrmGetFileDatabase(dbfile.get());
1943 if (!database) 1941 if (!database)
1944 database = XrmGetFileDatabase(DEFAULT_INITFILE); 1942 database = XrmGetFileDatabase(DEFAULT_INITFILE);
1945
1946 delete [] dbfile;
1947 1943
1948 XrmValue value; 1944 XrmValue value;
1949 char *value_type, name_lookup[1024], class_lookup[1024]; 1945 char *value_type, name_lookup[1024], class_lookup[1024];
@@ -2398,21 +2394,19 @@ void Fluxbox::real_reconfigure(void) {
2398 XrmDatabase new_blackboxrc = (XrmDatabase) 0; 2394 XrmDatabase new_blackboxrc = (XrmDatabase) 0;
2399 char style[MAXPATHLEN + 64]; 2395 char style[MAXPATHLEN + 64];
2400 2396
2401 char *dbfile = getRcFilename(); 2397 auto_ptr<char> dbfile(getRcFilename());
2402 2398
2403 sprintf(style, "session.styleFile: %s", resource.style_file); 2399 sprintf(style, "session.styleFile: %s", resource.style_file);
2404 XrmPutLineResource(&new_blackboxrc, style); 2400 XrmPutLineResource(&new_blackboxrc, style);
2405 2401
2406 XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile); 2402 XrmDatabase old_blackboxrc = XrmGetFileDatabase(dbfile.get());
2407 2403
2408 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); 2404 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc);
2409 XrmPutFileDatabase(old_blackboxrc, dbfile); 2405 XrmPutFileDatabase(old_blackboxrc, dbfile.get());
2410 2406
2411 if (old_blackboxrc) 2407 if (old_blackboxrc)
2412 XrmDestroyDatabase(old_blackboxrc); 2408 XrmDestroyDatabase(old_blackboxrc);
2413 2409
2414 delete [] dbfile;
2415
2416 for (int i = 0, n = menuTimestamps->count(); i < n; i++) { 2410 for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
2417 MenuTimestamp *ts = menuTimestamps->remove(0); 2411 MenuTimestamp *ts = menuTimestamps->remove(0);
2418 2412