diff options
-rw-r--r-- | src/Screen.cc | 37 | ||||
-rw-r--r-- | src/fluxbox.cc | 21 |
2 files changed, 25 insertions, 33 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 319852c..8c93a7b 100644 --- a/src/Screen.cc +++ b/src/Screen.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: Screen.cc,v 1.267 2004/02/20 09:06:19 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.268 2004/02/27 12:32:54 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -641,6 +641,17 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
641 | XFlush(disp); | 641 | XFlush(disp); |
642 | } | 642 | } |
643 | 643 | ||
644 | template <typename A> | ||
645 | void destroyAndClearList(A &a) { | ||
646 | typedef typename A::iterator iterator; | ||
647 | iterator it = a.begin(); | ||
648 | iterator it_end = a.end(); | ||
649 | for (; it != it_end; ++it) | ||
650 | delete (*it); | ||
651 | |||
652 | a.clear(); | ||
653 | } | ||
654 | |||
644 | BScreen::~BScreen() { | 655 | BScreen::~BScreen() { |
645 | if (! managed) | 656 | if (! managed) |
646 | return; | 657 | return; |
@@ -656,27 +667,9 @@ BScreen::~BScreen() { | |||
656 | 667 | ||
657 | removeWorkspaceNames(); | 668 | removeWorkspaceNames(); |
658 | 669 | ||
659 | Workspaces::iterator w_it = m_workspaces_list.begin(); | 670 | destroyAndClearList(m_workspaces_list); |
660 | Workspaces::iterator w_it_end = m_workspaces_list.end(); | 671 | destroyAndClearList(m_icon_list); |
661 | for(; w_it != w_it_end; ++w_it) { | 672 | destroyAndClearList(m_netizen_list); |
662 | delete (*w_it); | ||
663 | } | ||
664 | m_workspaces_list.clear(); | ||
665 | |||
666 | Icons::iterator i_it = m_icon_list.begin(); | ||
667 | Icons::iterator i_it_end = m_icon_list.end(); | ||
668 | for(; i_it != i_it_end; ++i_it) { | ||
669 | delete (*i_it); | ||
670 | } | ||
671 | m_icon_list.clear(); | ||
672 | |||
673 | Netizens::iterator n_it = m_netizen_list.begin(); | ||
674 | Netizens::iterator n_it_end = m_netizen_list.end(); | ||
675 | for(; n_it != n_it_end; ++n_it) { | ||
676 | delete (*n_it); | ||
677 | } | ||
678 | |||
679 | m_netizen_list.clear(); | ||
680 | 673 | ||
681 | if (hasXinerama() && m_xinerama_headinfo) { | 674 | if (hasXinerama() && m_xinerama_headinfo) { |
682 | delete [] m_xinerama_headinfo; | 675 | delete [] m_xinerama_headinfo; |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index b2a1dbb..e6099aa 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.231 2004/02/20 09:29:05 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.232 2004/02/27 12:30:17 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -48,6 +48,7 @@ | |||
48 | #include "FbTk/Command.hh" | 48 | #include "FbTk/Command.hh" |
49 | #include "FbTk/RefCount.hh" | 49 | #include "FbTk/RefCount.hh" |
50 | #include "FbTk/SimpleCommand.hh" | 50 | #include "FbTk/SimpleCommand.hh" |
51 | #include "FbTk/CompareEqual.hh" | ||
51 | 52 | ||
52 | //Use GNU extensions | 53 | //Use GNU extensions |
53 | #ifndef _GNU_SOURCE | 54 | #ifndef _GNU_SOURCE |
@@ -837,14 +838,11 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
837 | screen_num = XScreenNumberOfScreen(attr.screen); | 838 | screen_num = XScreenNumberOfScreen(attr.screen); |
838 | 839 | ||
839 | // find screen | 840 | // find screen |
840 | ScreenList::iterator screen_it = m_screen_list.begin(); | 841 | ScreenList::iterator screen_it = find_if(m_screen_list.begin(), |
841 | const ScreenList::iterator screen_it_end = m_screen_list.end(); | 842 | m_screen_list.end(), |
842 | for (; screen_it != screen_it_end; ++screen_it) { | 843 | FbTk::CompareEqual<BScreen>(&BScreen::screenNumber, screen_num)); |
843 | if ((*screen_it)->screenNumber() == screen_num) { | 844 | if (screen_it != m_screen_list.end()) |
844 | screen = (*screen_it); | 845 | screen = *screen_it; |
845 | break; | ||
846 | } | ||
847 | } | ||
848 | } | 846 | } |
849 | // try with parent if we failed to find screen num | 847 | // try with parent if we failed to find screen num |
850 | if (screen == 0) | 848 | if (screen == 0) |
@@ -1435,11 +1433,12 @@ void Fluxbox::attachSignals(WinClient &winclient) { | |||
1435 | } | 1433 | } |
1436 | 1434 | ||
1437 | BScreen *Fluxbox::searchScreen(Window window) { | 1435 | BScreen *Fluxbox::searchScreen(Window window) { |
1438 | ScreenList::iterator it = m_screen_list.begin(); | 1436 | |
1437 | ScreenList::iterator it = m_screen_list.begin(); | ||
1439 | ScreenList::iterator it_end = m_screen_list.end(); | 1438 | ScreenList::iterator it_end = m_screen_list.end(); |
1440 | for (; it != it_end; ++it) { | 1439 | for (; it != it_end; ++it) { |
1441 | if (*it && (*it)->rootWindow() == window) | 1440 | if (*it && (*it)->rootWindow() == window) |
1442 | return (*it); | 1441 | return *it; |
1443 | } | 1442 | } |
1444 | 1443 | ||
1445 | return 0; | 1444 | return 0; |