aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fluxbox.cc47
-rw-r--r--src/fluxbox.hh6
2 files changed, 30 insertions, 23 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ab35aff..c26f766 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.142 2003/05/12 11:14:47 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.143 2003/05/13 00:20:49 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -559,12 +559,8 @@ Fluxbox::~Fluxbox() {
559 delete m_atomhandler.back(); 559 delete m_atomhandler.back();
560 m_atomhandler.pop_back(); 560 m_atomhandler.pop_back();
561 } 561 }
562 562
563 std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); 563 clearMenuFilenames();
564 std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end();
565 for (; it != it_end; ++it)
566 delete *it;
567
568} 564}
569 565
570void Fluxbox::eventLoop() { 566void Fluxbox::eventLoop() {
@@ -2227,18 +2223,12 @@ void Fluxbox::real_reconfigure() {
2227 if (old_blackboxrc) 2223 if (old_blackboxrc)
2228 XrmDestroyDatabase(old_blackboxrc); 2224 XrmDestroyDatabase(old_blackboxrc);
2229 2225
2230 std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin();
2231 std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end();
2232 for (; it != it_end; ++it)
2233 delete *it;
2234
2235 m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end());
2236 2226
2237 ScreenList::iterator sit = m_screen_list.begin(); 2227 ScreenList::iterator sit = m_screen_list.begin();
2238 ScreenList::iterator sit_end = m_screen_list.end(); 2228 ScreenList::iterator sit_end = m_screen_list.end();
2239 for (; sit != sit_end; ++sit) 2229 for (; sit != sit_end; ++sit)
2240 (*sit)->reconfigure(); 2230 (*sit)->reconfigure();
2241 2231
2242 //reconfigure keys 2232 //reconfigure keys
2243 m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); 2233 m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str());
2244 2234
@@ -2246,21 +2236,26 @@ void Fluxbox::real_reconfigure() {
2246} 2236}
2247 2237
2248 2238
2249void Fluxbox::checkMenu() { 2239bool Fluxbox::menuTimestampsChanged() const {
2250 bool reread = false; 2240 std::list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin();
2251 std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); 2241 std::list<MenuTimestamp *>::const_iterator it_end = m_menu_timestamps.end();
2252 std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); 2242 for (; it != it_end; ++it) {
2253 for (; it != it_end && (! reread); ++it) {
2254 struct stat buf; 2243 struct stat buf;
2255 2244
2256 if (! stat((*it)->filename.c_str(), &buf)) { 2245 if (! stat((*it)->filename.c_str(), &buf)) {
2257 if ((*it)->timestamp != buf.st_ctime) 2246 if ((*it)->timestamp != buf.st_ctime)
2258 reread = true; 2247 return true;
2259 } else 2248 } else
2260 reread = true; 2249 return true;
2261 } 2250 }
2262 2251
2263 if (reread) rereadMenu(); 2252 // no timestamp changed
2253 return false;
2254}
2255
2256void Fluxbox::checkMenu() {
2257 if (menuTimestampsChanged())
2258 rereadMenu();
2264} 2259}
2265 2260
2266 2261
@@ -2316,6 +2311,14 @@ void Fluxbox::saveMenuFilename(const char *filename) {
2316 } 2311 }
2317} 2312}
2318 2313
2314void Fluxbox::clearMenuFilenames() {
2315 std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin();
2316 std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end();
2317 for (; it != it_end; ++it)
2318 delete *it;
2319
2320 m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end());
2321}
2319 2322
2320void Fluxbox::timeout() { 2323void Fluxbox::timeout() {
2321 if (m_reconfigure_wait) 2324 if (m_reconfigure_wait)
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 503e55c..a3c4f81 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -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.hh,v 1.57 2003/05/12 04:23:31 fluxgen Exp $ 25// $Id: fluxbox.hh,v 1.58 2003/05/13 00:18:28 fluxgen Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -156,6 +156,7 @@ public:
156 void loadTitlebar(); 156 void loadTitlebar();
157 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } 157 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
158 void saveMenuFilename(const char *); 158 void saveMenuFilename(const char *);
159 void clearMenuFilenames();
159 void saveTitlebarFilename(const char *); 160 void saveTitlebarFilename(const char *);
160 void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); } 161 void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); }
161 void saveWindowSearch(Window win, FluxboxWindow *fbwin); 162 void saveWindowSearch(Window win, FluxboxWindow *fbwin);
@@ -166,6 +167,7 @@ public:
166 void restart(const char *command = 0); 167 void restart(const char *command = 0);
167 void reconfigure(); 168 void reconfigure();
168 void rereadMenu(); 169 void rereadMenu();
170 /// reloads the menus if the timestamps changed
169 void checkMenu(); 171 void checkMenu();
170 172
171 /// handle any system signal sent to the application 173 /// handle any system signal sent to the application
@@ -185,6 +187,8 @@ public:
185 enum { B_AMERICANDATE = 1, B_EUROPEANDATE }; 187 enum { B_AMERICANDATE = 1, B_EUROPEANDATE };
186 188
187 typedef std::vector<Fluxbox::Titlebar> TitlebarList; 189 typedef std::vector<Fluxbox::Titlebar> TitlebarList;
190 /// @return whether the timestamps on the menu changed
191 bool menuTimestampsChanged() const;
188 192
189private: 193private:
190 struct cursor { 194 struct cursor {