aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-22 21:38:58 (GMT)
committerfluxgen <fluxgen>2003-08-22 21:38:58 (GMT)
commit062768a077b03a67b049b3c2d98341b00d5445dd (patch)
treef84588e2f33550677fcdb8829adf07df237f29f7
parentdc3f13d2fc3e731e8929ec782cad1c1e2191802e (diff)
downloadfluxbox_pavel-062768a077b03a67b049b3c2d98341b00d5445dd.zip
fluxbox_pavel-062768a077b03a67b049b3c2d98341b00d5445dd.tar.bz2
fixed search paths for new image loading
-rw-r--r--src/fluxbox.cc62
1 files changed, 27 insertions, 35 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 17e2268..370bc1d 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
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.185 2003/08/15 13:57:18 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.186 2003/08/22 21:38:58 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -42,6 +42,8 @@
42#include "FbAtoms.hh" 42#include "FbAtoms.hh"
43#include "defaults.hh" 43#include "defaults.hh"
44 44
45#include "FbTk/Image.hh"
46
45//Use GNU extensions 47//Use GNU extensions
46#ifndef _GNU_SOURCE 48#ifndef _GNU_SOURCE
47#define _GNU_SOURCE 49#define _GNU_SOURCE
@@ -118,10 +120,6 @@
118#endif // HAVE_SYS_TIME_H 120#endif // HAVE_SYS_TIME_H
119#endif // TIME_WITH_SYS_TIME 121#endif // TIME_WITH_SYS_TIME
120 122
121#ifdef HAVE_LIBGEN_H
122#include <libgen.h>
123#endif // HAVE_LIBGEN_H
124
125#include <sys/wait.h> 123#include <sys/wait.h>
126 124
127#include <iostream> 125#include <iostream>
@@ -133,24 +131,6 @@
133using namespace std; 131using namespace std;
134using namespace FbTk; 132using namespace FbTk;
135 133
136#ifndef HAVE_BASENAME
137namespace {
138
139char *basename(char *s) {
140 char *save = s;
141
142 while (*s) {
143 if (*s++ == '/')
144 save = s;
145 }
146
147 return save;
148}
149
150}; // end anonymous namespace
151
152#endif // HAVE_BASENAME
153
154//----------------------------------------------------------------- 134//-----------------------------------------------------------------
155//---- accessors for int, bool, and some enums with Resource ------ 135//---- accessors for int, bool, and some enums with Resource ------
156//----------------------------------------------------------------- 136//-----------------------------------------------------------------
@@ -1442,7 +1422,7 @@ void Fluxbox::restart(const char *prog) {
1442 1422
1443 // fall back in case the above execlp doesn't work 1423 // fall back in case the above execlp doesn't work
1444 execvp(m_argv[0], m_argv); 1424 execvp(m_argv[0], m_argv);
1445 execvp(basename(m_argv[0]), m_argv); 1425 execvp(StringUtil::basename(m_argv[0]).c_str(), m_argv);
1446} 1426}
1447 1427
1448/// prepares fluxbox for a shutdown 1428/// prepares fluxbox for a shutdown
@@ -1663,17 +1643,6 @@ void Fluxbox::load_rc() {
1663void Fluxbox::load_rc(BScreen &screen) { 1643void Fluxbox::load_rc(BScreen &screen) {
1664 //get resource filename 1644 //get resource filename
1665 string dbfile(getRcFilename()); 1645 string dbfile(getRcFilename());
1666 if (dbfile.size() != 0) {
1667 if (!m_screen_rm.load(dbfile.c_str())) {
1668 cerr<<"Failed to load database:"<<dbfile<<endl;
1669 cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl;
1670 if (!m_screen_rm.load(DEFAULT_INITFILE))
1671 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl;
1672 }
1673 } else {
1674 if (!m_screen_rm.load(DEFAULT_INITFILE))
1675 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl;
1676 }
1677 1646
1678 XrmDatabaseHelper database; 1647 XrmDatabaseHelper database;
1679 1648
@@ -1735,6 +1704,17 @@ void Fluxbox::load_rc(BScreen &screen) {
1735 delete [] search; 1704 delete [] search;
1736 } 1705 }
1737 1706
1707 FbTk::Image::removeAllSearchPaths();
1708 sprintf(name_lookup, "session.screen%d.imageSearchPath", screen_number);
1709 sprintf(class_lookup, "Session.Screen%d.imageSearchPath", screen_number);
1710 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
1711 &value) && value.addr) {
1712 std::vector<std::string> paths;
1713 StringUtil::stringtok(paths, value.addr, ", ");
1714 for (unsigned int i=0; i<paths.size(); ++i)
1715 FbTk::Image::addSearchPath(paths[i]);
1716 }
1717
1738 sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number); 1718 sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number);
1739 sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number); 1719 sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number);
1740 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1720 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
@@ -1750,6 +1730,18 @@ void Fluxbox::load_rc(BScreen &screen) {
1750 } else 1730 } else
1751 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); 1731 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
1752 1732
1733 if (dbfile.size() != 0) {
1734 if (!m_screen_rm.load(dbfile.c_str())) {
1735 cerr<<"Failed to load database:"<<dbfile<<endl;
1736 cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl;
1737 if (!m_screen_rm.load(DEFAULT_INITFILE))
1738 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl;
1739 }
1740 } else {
1741 if (!m_screen_rm.load(DEFAULT_INITFILE))
1742 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl;
1743 }
1744
1753} 1745}
1754 1746
1755void Fluxbox::loadRootCommand(BScreen &screen) { 1747void Fluxbox::loadRootCommand(BScreen &screen) {