aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authorcout <cout>2002-04-09 12:09:03 (GMT)
committercout <cout>2002-04-09 12:09:03 (GMT)
commit30fe2fb8feb4a1405ea164424a2b8336d2f5a8f4 (patch)
treea073716b4bca24bd193003bab6418ccde6ff5e93 /src/fluxbox.cc
parent4d6f6ba54f34c8465d0b3179fe0fbd42d935edf2 (diff)
downloadfluxbox_pavel-30fe2fb8feb4a1405ea164424a2b8336d2f5a8f4.zip
fluxbox_pavel-30fe2fb8feb4a1405ea164424a2b8336d2f5a8f4.tar.bz2
Replaced LinkedList structures with std::map, std::vector, and std::list.
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc336
1 files changed, 98 insertions, 238 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index f183851..e0895d4 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.47 2002/04/09 09:42:16 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.48 2002/04/09 12:09:03 cout Exp $
26 26
27//Use some GNU extensions 27//Use some GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -333,11 +333,7 @@ key(0)
333 333
334 masked = None; 334 masked = None;
335 335
336 windowSearchList = new LinkedList<WindowSearch>;
337 menuSearchList = new LinkedList<MenuSearch>;
338
339 #ifdef SLIT 336 #ifdef SLIT
340 slitSearchList = new LinkedList<SlitSearch>;
341 #ifdef KDE 337 #ifdef KDE
342 //For KDE dock applets 338 //For KDE dock applets
343 kwm1_dockwindow = XInternAtom(getXDisplay(), "KWM_DOCKWINDOW", False); //KDE v1.x 339 kwm1_dockwindow = XInternAtom(getXDisplay(), "KWM_DOCKWINDOW", False); //KDE v1.x
@@ -346,18 +342,10 @@ key(0)
346 342
347 #endif // SLIT 343 #endif // SLIT
348 344
349 toolbarSearchList = new LinkedList<ToolbarSearch>;
350 tabSearchList = new LinkedList<TabSearch>;
351 groupSearchList = new LinkedList<WindowSearch>;
352
353 menuTimestamps = new LinkedList<MenuTimestamp>;
354
355
356 #ifdef HAVE_GETPID 345 #ifdef HAVE_GETPID
357 fluxbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False); 346 fluxbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False);
358 #endif // HAVE_GETPID 347 #endif // HAVE_GETPID
359 348
360 screenList = new LinkedList<BScreen>;
361 int i; 349 int i;
362 load_rc(); 350 load_rc();
363 //allocate screens 351 //allocate screens
@@ -372,11 +360,11 @@ key(0)
372 continue; 360 continue;
373 } 361 }
374 362
375 screenList->insert(screen); 363 screenList.push_back(screen);
376 } 364 }
377 365
378 I18n *i18n = I18n::instance(); 366 I18n *i18n = I18n::instance();
379 if (! screenList->count()) { 367 if (screenList.size() == 0) {
380 fprintf(stderr, 368 fprintf(stderr,
381 i18n-> 369 i18n->
382 getMessage( 370 getMessage(
@@ -404,12 +392,10 @@ key(0)
404 392
405 393
406Fluxbox::~Fluxbox(void) { 394Fluxbox::~Fluxbox(void) {
407 395 std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
408 while (screenList->count()) 396 std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
409 delete screenList->remove(0); 397 for (; it != it_end; ++it) {
410 398 MenuTimestamp *ts = *it;
411 while (menuTimestamps->count()) {
412 MenuTimestamp *ts = menuTimestamps->remove(0);
413 399
414 if (ts->filename) 400 if (ts->filename)
415 delete [] ts->filename; 401 delete [] ts->filename;
@@ -419,19 +405,6 @@ Fluxbox::~Fluxbox(void) {
419 405
420 delete key; 406 delete key;
421 key = 0; 407 key = 0;
422
423 delete screenList;
424 delete menuTimestamps;
425
426 delete windowSearchList;
427 delete menuSearchList;
428 delete toolbarSearchList;
429 delete tabSearchList;
430 delete groupSearchList;
431
432#ifdef SLIT
433 delete slitSearchList;
434#endif // SLIT
435} 408}
436 409
437//---------- setupConfigFiles ----------- 410//---------- setupConfigFiles -----------
@@ -637,10 +610,10 @@ void Fluxbox::process_event(XEvent *e) {
637 610
638 if (iskdedockapp) { 611 if (iskdedockapp) {
639 XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask); 612 XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask);
640 LinkedListIterator<BScreen> it(screenList); 613 std::list<BScreen *>::iterator it = screenList.begin();
641 for (; it.current() == screenList->last(); it++) { 614 std::list<BScreen *>::iterator it_end = screenList.end();
642 BScreen *screen = it.current(); 615 for (; (*it) == screenList->last(); ++it) {
643 screen->getSlit()->addClient(e->xmaprequest.window); 616 (*it)->getSlit()->addClient(e->xmaprequest.window);
644 } 617 }
645 return; 618 return;
646 } 619 }
@@ -926,11 +899,12 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
926 } else if ((tab = searchTab(be.window))) { 899 } else if ((tab = searchTab(be.window))) {
927 tab->buttonPressEvent(&be); 900 tab->buttonPressEvent(&be);
928 } else { 901 } else {
929 LinkedListIterator<BScreen> it(screenList); 902 std::list<BScreen *>::iterator it = screenList.begin();
903 std::list<BScreen *>::iterator it_end = screenList.end();
930 904
931 for (; it.current(); it++) { 905 for (; it != it_end; ++it) {
932 906
933 BScreen *screen = it.current(); 907 BScreen *screen = *it;
934 if (be.window != screen->getRootWindow()) 908 if (be.window != screen->getRootWindow())
935 continue; 909 continue;
936 910
@@ -1271,11 +1245,12 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1271 break; 1245 break;
1272 case Keys::ROOTMENU: //show root menu 1246 case Keys::ROOTMENU: //show root menu
1273 { 1247 {
1274 LinkedListIterator<BScreen> it(screenList); 1248 std::list<BScreen *>::iterator it = screenList.begin();
1249 std::list<BScreen *>::iterator it_end = screenList.end();
1275 1250
1276 for (; it.current(); it++) { 1251 for (; it != it_end; ++it) {
1277 1252
1278 BScreen *screen = it.current(); 1253 BScreen *screen = (*it);
1279 if (ke.window != screen->getRootWindow()) 1254 if (ke.window != screen->getRootWindow())
1280 continue; 1255 continue;
1281 1256
@@ -1575,12 +1550,13 @@ Bool Fluxbox::handleSignal(int sig) {
1575 1550
1576BScreen *Fluxbox::searchScreen(Window window) { 1551BScreen *Fluxbox::searchScreen(Window window) {
1577 BScreen *screen = (BScreen *) 0; 1552 BScreen *screen = (BScreen *) 0;
1578 LinkedListIterator<BScreen> it(screenList); 1553 std::list<BScreen *>::iterator it = screenList.begin();
1554 std::list<BScreen *>::iterator it_end = screenList.end();
1579 1555
1580 for (; it.current(); it++) { 1556 for (; it != it_end; ++it) {
1581 if (it.current()) { 1557 if (*it) {
1582 if (it.current()->getRootWindow() == window) { 1558 if ((*it)->getRootWindow() == window) {
1583 screen = it.current(); 1559 screen = (*it);
1584 return screen; 1560 return screen;
1585 } 1561 }
1586 } 1562 }
@@ -1591,228 +1567,100 @@ BScreen *Fluxbox::searchScreen(Window window) {
1591 1567
1592 1568
1593FluxboxWindow *Fluxbox::searchWindow(Window window) { 1569FluxboxWindow *Fluxbox::searchWindow(Window window) {
1594 LinkedListIterator<WindowSearch> it(windowSearchList); 1570 std::map<Window, FluxboxWindow *>::iterator it = windowSearch.find(window);
1595 1571 return it == windowSearch.end() ? 0 : it->second;
1596 for (; it.current(); it++) {
1597 WindowSearch *tmp = it.current();
1598 if (tmp && tmp->getWindow() == window)
1599 return tmp->getData();
1600 }
1601
1602 return (FluxboxWindow *) 0;
1603} 1572}
1604 1573
1605 1574
1606FluxboxWindow *Fluxbox::searchGroup(Window window, FluxboxWindow *win) { 1575FluxboxWindow *Fluxbox::searchGroup(Window window, FluxboxWindow *win) {
1607 FluxboxWindow *w = (FluxboxWindow *) 0; 1576 std::map<Window, FluxboxWindow *>::iterator it = groupSearch.find(window);
1608 LinkedListIterator<WindowSearch> it(groupSearchList); 1577 return it == groupSearch.end() ? 0 : it->second;
1609
1610 for (; it.current(); it++) {
1611 WindowSearch *tmp = it.current();
1612 if (tmp) {
1613 if (tmp->getWindow() == window) {
1614 w = tmp->getData();
1615 if (w->getClientWindow() != win->getClientWindow())
1616 return win;
1617 }
1618 }
1619 }
1620
1621 return (FluxboxWindow *) 0;
1622} 1578}
1623 1579
1624 1580
1625Basemenu *Fluxbox::searchMenu(Window window) { 1581Basemenu *Fluxbox::searchMenu(Window window) {
1626 Basemenu *menu = (Basemenu *) 0; 1582 std::map<Window, Basemenu *>::iterator it = menuSearch.find(window);
1627 LinkedListIterator<MenuSearch> it(menuSearchList); 1583 return it == menuSearch.end() ? 0 : it->second;
1628
1629 for (; it.current(); it++) {
1630 MenuSearch *tmp = it.current();
1631
1632 if (tmp) {
1633 if (tmp->getWindow() == window) {
1634 menu = tmp->getData();
1635 return menu;
1636 }
1637 }
1638 }
1639
1640 return (Basemenu *) 0;
1641} 1584}
1642 1585
1643 1586
1644Toolbar *Fluxbox::searchToolbar(Window window) { 1587Toolbar *Fluxbox::searchToolbar(Window window) {
1645 Toolbar *tbar = (Toolbar *) 0; 1588 std::map<Window, Toolbar *>::iterator it = toolbarSearch.find(window);
1646 LinkedListIterator<ToolbarSearch> it(toolbarSearchList); 1589 return it == toolbarSearch.end() ? 0 : it->second;
1647
1648 for (; it.current(); it++) {
1649 ToolbarSearch *tmp = it.current();
1650
1651 if (tmp) {
1652 if (tmp->getWindow() == window) {
1653 tbar = tmp->getData();
1654 return tbar;
1655 }
1656 }
1657 }
1658
1659 return (Toolbar *) 0;
1660} 1590}
1661 1591
1662Tab *Fluxbox::searchTab(Window window) { 1592Tab *Fluxbox::searchTab(Window window) {
1663 LinkedListIterator<TabSearch> it(tabSearchList); 1593 std::map<Window, Tab *>::iterator it = tabSearch.find(window);
1664 1594 return it == tabSearch.end() ? 0 : it->second;
1665 for (; it.current(); it++) {
1666 TabSearch *tmp = it.current();
1667 if (tmp && tmp->getWindow() == window)
1668 return tmp->getData();
1669 }
1670
1671 return 0;
1672} 1595}
1673 1596
1674 1597
1675#ifdef SLIT 1598#ifdef SLIT
1676Slit *Fluxbox::searchSlit(Window window) { 1599Slit *Fluxbox::searchSlit(Window window) {
1677 Slit *s = (Slit *) 0; 1600 std::map<Window, Slit *>::iterator it = slitSearch.find(window);
1678 LinkedListIterator<SlitSearch> it(slitSearchList); 1601 return it == slitSearch.end() ? 0 : it->second;
1679
1680 for (; it.current(); it++) {
1681 SlitSearch *tmp = it.current();
1682
1683 if (tmp) {
1684 if (tmp->getWindow() == window) {
1685 s = tmp->getData();
1686 return s;
1687 }
1688 }
1689 }
1690
1691 return (Slit *) 0;
1692} 1602}
1693#endif // SLIT 1603#endif // SLIT
1694 1604
1695 1605
1696void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) { 1606void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) {
1697 windowSearchList->insert(new WindowSearch(window, data)); 1607 windowSearch[window] = data;
1698} 1608}
1699 1609
1700 1610
1701void Fluxbox::saveGroupSearch(Window window, FluxboxWindow *data) { 1611void Fluxbox::saveGroupSearch(Window window, FluxboxWindow *data) {
1702 groupSearchList->insert(new WindowSearch(window, data)); 1612 groupSearch[window] = data;
1703} 1613}
1704 1614
1705 1615
1706void Fluxbox::saveMenuSearch(Window window, Basemenu *data) { 1616void Fluxbox::saveMenuSearch(Window window, Basemenu *data) {
1707 menuSearchList->insert(new MenuSearch(window, data)); 1617 menuSearch[window] = data;
1708} 1618}
1709 1619
1710 1620
1711void Fluxbox::saveToolbarSearch(Window window, Toolbar *data) { 1621void Fluxbox::saveToolbarSearch(Window window, Toolbar *data) {
1712 toolbarSearchList->insert(new ToolbarSearch(window, data)); 1622 toolbarSearch[window] = data;
1713} 1623}
1714 1624
1715 1625
1716void Fluxbox::saveTabSearch(Window window, Tab *data) { 1626void Fluxbox::saveTabSearch(Window window, Tab *data) {
1717 tabSearchList->insert(new TabSearch(window, data)); 1627 tabSearch[window] = data;
1718} 1628}
1719 1629
1720#ifdef SLIT 1630#ifdef SLIT
1721void Fluxbox::saveSlitSearch(Window window, Slit *data) { 1631void Fluxbox::saveSlitSearch(Window window, Slit *data) {
1722 slitSearchList->insert(new SlitSearch(window, data)); 1632 slitSearch[window] = data;
1723} 1633}
1724#endif // SLIT 1634#endif // SLIT
1725 1635
1726 1636
1727void Fluxbox::removeWindowSearch(Window window) { 1637void Fluxbox::removeWindowSearch(Window window) {
1728 LinkedListIterator<WindowSearch> it(windowSearchList); 1638 windowSearch.erase(window);
1729 for (; it.current(); it++) {
1730 WindowSearch *tmp = it.current();
1731
1732 if (tmp) {
1733 if (tmp->getWindow() == window) {
1734 windowSearchList->remove(tmp);
1735 delete tmp;
1736 break;
1737 }
1738 }
1739 }
1740} 1639}
1741 1640
1742 1641
1743void Fluxbox::removeGroupSearch(Window window) { 1642void Fluxbox::removeGroupSearch(Window window) {
1744 LinkedListIterator<WindowSearch> it(groupSearchList); 1643 groupSearch.erase(window);
1745 for (; it.current(); it++) {
1746 WindowSearch *tmp = it.current();
1747
1748 if (tmp) {
1749 if (tmp->getWindow() == window) {
1750 groupSearchList->remove(tmp);
1751 delete tmp;
1752 break;
1753 }
1754 }
1755 }
1756} 1644}
1757 1645
1758 1646
1759void Fluxbox::removeMenuSearch(Window window) { 1647void Fluxbox::removeMenuSearch(Window window) {
1760 LinkedListIterator<MenuSearch> it(menuSearchList); 1648 menuSearch.erase(window);
1761 for (; it.current(); it++) {
1762 MenuSearch *tmp = it.current();
1763
1764 if (tmp) {
1765 if (tmp->getWindow() == window) {
1766 menuSearchList->remove(tmp);
1767 delete tmp;
1768 break;
1769 }
1770 }
1771 }
1772} 1649}
1773 1650
1774 1651
1775void Fluxbox::removeToolbarSearch(Window window) { 1652void Fluxbox::removeToolbarSearch(Window window) {
1776 LinkedListIterator<ToolbarSearch> it(toolbarSearchList); 1653 toolbarSearch.erase(window);
1777 for (; it.current(); it++) {
1778 ToolbarSearch *tmp = it.current();
1779 if (tmp) {
1780 if (tmp->getWindow() == window) {
1781 toolbarSearchList->remove(tmp);
1782 delete tmp;
1783 break;
1784 }
1785 }
1786 }
1787} 1654}
1788 1655
1789 1656
1790void Fluxbox::removeTabSearch(Window window) { 1657void Fluxbox::removeTabSearch(Window window) {
1791 LinkedListIterator<TabSearch> it(tabSearchList); 1658 tabSearch.erase(window);
1792 for (; it.current(); it++) {
1793 TabSearch *tmp = it.current();
1794 if (tmp && tmp->getWindow() == window) {
1795 tabSearchList->remove(tmp);
1796 delete tmp;
1797 break;
1798 }
1799 }
1800} 1659}
1801 1660
1802#ifdef SLIT 1661#ifdef SLIT
1803void Fluxbox::removeSlitSearch(Window window) { 1662void Fluxbox::removeSlitSearch(Window window) {
1804 LinkedListIterator<SlitSearch> it(slitSearchList); 1663 slitSearch.erase(window);
1805 for (; it.current(); it++) {
1806 SlitSearch *tmp = it.current();
1807
1808 if (tmp) {
1809 if (tmp->getWindow() == window) {
1810 slitSearchList->remove(tmp);
1811 delete tmp;
1812 break;
1813 }
1814 }
1815 }
1816} 1664}
1817#endif // SLIT 1665#endif // SLIT
1818 1666
@@ -1836,10 +1684,13 @@ void Fluxbox::shutdown(void) {
1836 1684
1837 XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime); 1685 XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
1838 1686
1839 LinkedListIterator<BScreen> it(screenList); 1687 std::list<BScreen *>::iterator it = screenList.begin();
1840 for (; it.current(); it++) 1688 std::list<BScreen *>::iterator it_end = screenList.end();
1841 if(it.current()) 1689 for (; it != it_end; ++it) {
1842 it.current()->shutdown(); 1690 if(*it) {
1691 (*it)->shutdown();
1692 }
1693 }
1843 1694
1844 XSync(getXDisplay(), False); 1695 XSync(getXDisplay(), False);
1845 1696
@@ -1878,12 +1729,13 @@ void Fluxbox::save_rc(void) {
1878 (resource.auto_raise_delay.tv_usec / 1000))); 1729 (resource.auto_raise_delay.tv_usec / 1000)));
1879 XrmPutLineResource(&new_blackboxrc, rc_string); 1730 XrmPutLineResource(&new_blackboxrc, rc_string);
1880 1731
1881 LinkedListIterator<BScreen> it(screenList); 1732 std::list<BScreen *>::iterator it = screenList.begin();
1733 std::list<BScreen *>::iterator it_end = screenList.end();
1882 1734
1883 //Save screen resources 1735 //Save screen resources
1884 1736
1885 for (; it.current(); it++) { 1737 for (; it != it_end; ++it) {
1886 BScreen *screen = it.current(); 1738 BScreen *screen = *it;
1887 int screen_number = screen->getScreenNumber(); 1739 int screen_number = screen->getScreenNumber();
1888 1740
1889 #ifdef SLIT 1741 #ifdef SLIT
@@ -2398,8 +2250,10 @@ void Fluxbox::real_reconfigure(void) {
2398 if (old_blackboxrc) 2250 if (old_blackboxrc)
2399 XrmDestroyDatabase(old_blackboxrc); 2251 XrmDestroyDatabase(old_blackboxrc);
2400 2252
2401 for (int i = 0, n = menuTimestamps->count(); i < n; i++) { 2253 std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
2402 MenuTimestamp *ts = menuTimestamps->remove(0); 2254 std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
2255 for (; it != it_end; ++it) {
2256 MenuTimestamp *ts = *it;
2403 2257
2404 if (ts) { 2258 if (ts) {
2405 if (ts->filename) 2259 if (ts->filename)
@@ -2408,12 +2262,12 @@ void Fluxbox::real_reconfigure(void) {
2408 delete ts; 2262 delete ts;
2409 } 2263 }
2410 } 2264 }
2265 menuTimestamps.erase(menuTimestamps.begin(), menuTimestamps.end());
2411 2266
2412 LinkedListIterator<BScreen> it(screenList); 2267 std::list<BScreen *>::iterator sit = screenList.begin();
2413 for (; it.current(); it++) { 2268 std::list<BScreen *>::iterator sit_end = screenList.end();
2414 BScreen *screen = it.current(); 2269 for (; sit != sit_end; ++sit) {
2415 2270 (*sit)->reconfigure();
2416 screen->reconfigure();
2417 } 2271 }
2418 2272
2419 //reconfigure keys 2273 //reconfigure keys
@@ -2432,18 +2286,16 @@ void Fluxbox::real_reconfigure(void) {
2432// --------------------------------------- 2286// ---------------------------------------
2433void Fluxbox::reconfigureTabs(void) { 2287void Fluxbox::reconfigureTabs(void) {
2434 //tab reconfiguring 2288 //tab reconfiguring
2435 LinkedListIterator<TabSearch> it(tabSearchList); 2289 std::map<Window, Tab *>::iterator it = tabSearch.begin();
2290 std::map<Window, Tab *>::iterator it_end = tabSearch.end();
2436 //setting all to unconfigured 2291 //setting all to unconfigured
2437 for (; it.current(); it++) { 2292 for (; it != it_end; ++it) {
2438 TabSearch *tmp = it.current(); 2293 it->second->setConfigured(false);
2439 if (tmp)
2440 tmp->getData()->setConfigured(false);
2441 } 2294 }
2442 it.reset(); // resetting list and start configure tabs 2295 it = tabSearch.begin(); // resetting list and start configure tabs
2443 //reconfiguring 2296 //reconfiguring
2444 for (; it.current(); it++) { 2297 for (; it != it_end; ++it) {
2445 TabSearch *tmp = it.current(); 2298 Tab *tab = it->second;
2446 Tab *tab = tmp->getData();
2447 if (!tab->configured()) { 2299 if (!tab->configured()) {
2448 tab->setConfigured(true); 2300 tab->setConfigured(true);
2449 tab->resizeGroup(); 2301 tab->resizeGroup();
@@ -2455,12 +2307,13 @@ void Fluxbox::reconfigureTabs(void) {
2455 2307
2456void Fluxbox::checkMenu(void) { 2308void Fluxbox::checkMenu(void) {
2457 Bool reread = False; 2309 Bool reread = False;
2458 LinkedListIterator<MenuTimestamp> it(menuTimestamps); 2310 std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
2459 for (; it.current() && (! reread); it++) { 2311 std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
2312 for (; it != it_end && (! reread); ++it) {
2460 struct stat buf; 2313 struct stat buf;
2461 2314
2462 if (! stat(it.current()->filename, &buf)) { 2315 if (! stat((*it)->filename, &buf)) {
2463 if (it.current()->timestamp != buf.st_ctime) 2316 if ((*it)->timestamp != buf.st_ctime)
2464 reread = True; 2317 reread = True;
2465 } else 2318 } else
2466 reread = True; 2319 reread = True;
@@ -2478,28 +2331,35 @@ void Fluxbox::rereadMenu(void) {
2478 2331
2479 2332
2480void Fluxbox::real_rereadMenu(void) { 2333void Fluxbox::real_rereadMenu(void) {
2481 for (int i = 0, n = menuTimestamps->count(); i < n; i++) { 2334 std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
2482 MenuTimestamp *ts = menuTimestamps->remove(0); 2335 std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
2336 for (; it != it_end; ++it) {
2337 MenuTimestamp *ts = *it;
2483 2338
2484 if (ts) { 2339 if (ts) {
2485 if (ts->filename) 2340 if (ts->filename)
2486 delete [] ts->filename; 2341 delete [] ts->filename;
2487 2342
2488 delete ts; 2343 delete ts;
2489 } 2344 }
2490 } 2345 }
2346 menuTimestamps.erase(menuTimestamps.begin(), menuTimestamps.end());
2491 2347
2492 LinkedListIterator<BScreen> it(screenList); 2348 std::list<BScreen *>::iterator sit = screenList.begin();
2493 for (; it.current(); it++) 2349 std::list<BScreen *>::iterator sit_end = screenList.end();
2494 it.current()->rereadMenu(); 2350 for (; sit != sit_end; ++it) {
2351 (*sit)->rereadMenu();
2352 }
2495} 2353}
2496 2354
2497void Fluxbox::saveMenuFilename(const char *filename) { 2355void Fluxbox::saveMenuFilename(const char *filename) {
2498 Bool found = False; 2356 Bool found = False;
2499 2357
2500 LinkedListIterator<MenuTimestamp> it(menuTimestamps); 2358 std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
2501 for (; it.current() && (! found); it++) 2359 std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
2502 if (! strcmp(it.current()->filename, filename)) found = True; 2360 for (; it != it_end; ++it) {
2361 if (! strcmp((*it)->filename, filename)) found = True;
2362 }
2503 2363
2504 if (! found) { 2364 if (! found) {
2505 struct stat buf; 2365 struct stat buf;
@@ -2510,7 +2370,7 @@ void Fluxbox::saveMenuFilename(const char *filename) {
2510 ts->filename = StringUtil::strdup(filename); 2370 ts->filename = StringUtil::strdup(filename);
2511 ts->timestamp = buf.st_ctime; 2371 ts->timestamp = buf.st_ctime;
2512 2372
2513 menuTimestamps->insert(ts); 2373 menuTimestamps.push_back(ts);
2514 } 2374 }
2515 } 2375 }
2516} 2376}