aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-05-02 12:10:01 (GMT)
committerfluxgen <fluxgen>2005-05-02 12:10:01 (GMT)
commitdce0e2e40c9fed226139c3def26e423b75c6bb9c (patch)
tree55784f6a6c526ebf06fb0a116b74efbf0b9ca66a /src/fluxbox.cc
parent6b943ec69ada6ba8c7b0a8305f048df8ef07f961 (diff)
downloadfluxbox_pavel-dce0e2e40c9fed226139c3def26e423b75c6bb9c.zip
fluxbox_pavel-dce0e2e40c9fed226139c3def26e423b75c6bb9c.tar.bz2
using Select2nd
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ce3161a..cd289ed 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -51,6 +51,8 @@
51#include "FbTk/SimpleCommand.hh" 51#include "FbTk/SimpleCommand.hh"
52#include "FbTk/CompareEqual.hh" 52#include "FbTk/CompareEqual.hh"
53#include "FbTk/Transparent.hh" 53#include "FbTk/Transparent.hh"
54#include "FbTk/Select2nd.hh"
55#include "FbTk/Compose.hh"
54 56
55//Use GNU extensions 57//Use GNU extensions
56#ifndef _GNU_SOURCE 58#ifndef _GNU_SOURCE
@@ -1329,11 +1331,13 @@ BScreen *Fluxbox::searchScreen(Window window) {
1329 1331
1330AtomHandler* Fluxbox::getAtomHandler(const std::string &name) { 1332AtomHandler* Fluxbox::getAtomHandler(const std::string &name) {
1331 if ( name != "" ) { 1333 if ( name != "" ) {
1332 for (AtomHandlerContainerIt it= m_atomhandler.begin(); 1334 using namespace FbTk;
1333 it != m_atomhandler.end(); it++ ) { 1335 AtomHandlerContainerIt it = find_if(m_atomhandler.begin(),
1334 if ( name == (*it).second ) 1336 m_atomhandler.end(),
1335 return (*it).first; 1337 Compose(bind2nd(equal_to<string>(), name),
1336 } 1338 Select2nd<AtomHandlerContainer::value_type>()));
1339 if (it != m_atomhandler.end())
1340 return (*it).first;
1337 } 1341 }
1338 return 0; 1342 return 0;
1339} 1343}
@@ -1342,7 +1346,6 @@ void Fluxbox::addAtomHandler(AtomHandler *atomh, const std::string &name) {
1342} 1346}
1343 1347
1344void Fluxbox::removeAtomHandler(AtomHandler *atomh) { 1348void Fluxbox::removeAtomHandler(AtomHandler *atomh) {
1345
1346 for (AtomHandlerContainerIt it= m_atomhandler.begin(); 1349 for (AtomHandlerContainerIt it= m_atomhandler.begin();
1347 it != m_atomhandler.end(); 1350 it != m_atomhandler.end();
1348 ++it) { 1351 ++it) {
@@ -1354,11 +1357,11 @@ void Fluxbox::removeAtomHandler(AtomHandler *atomh) {
1354} 1357}
1355 1358
1356WinClient *Fluxbox::searchWindow(Window window) { 1359WinClient *Fluxbox::searchWindow(Window window) {
1357 std::map<Window, WinClient *>::iterator it = m_window_search.find(window); 1360 WinClientMap::iterator it = m_window_search.find(window);
1358 if (it != m_window_search.end()) 1361 if (it != m_window_search.end())
1359 return it->second; 1362 return it->second;
1360 1363
1361 std::map<Window, FluxboxWindow *>::iterator git = m_window_search_group.find(window); 1364 WindowMap::iterator git = m_window_search_group.find(window);
1362 return git == m_window_search_group.end() ? 0 : &git->second->winClient(); 1365 return git == m_window_search_group.end() ? 0 : &git->second->winClient();
1363} 1366}
1364 1367
@@ -1806,18 +1809,13 @@ void Fluxbox::setFocusedWindow(WinClient *client) {
1806 1809
1807 if (m_focused_window != 0) { 1810 if (m_focused_window != 0) {
1808 // check if m_focused_window is valid 1811 // check if m_focused_window is valid
1809 bool found = false; 1812 WinClientMap::iterator it = find_if(m_window_search.begin(),
1810 std::map<Window, WinClient *>::iterator it = m_window_search.begin(); 1813 m_window_search.end(),
1811 std::map<Window, WinClient *>::iterator it_end = m_window_search.end(); 1814 Compose(bind2nd(equal_to<WinClient *>(), m_focused_window),
1812 for (; it != it_end; ++it) { 1815 Select2nd<WinClientMap::value_type>()));
1813 if (it->second == m_focused_window) { 1816
1814 // we found it, end loop 1817 // if not found...
1815 found = true; 1818 if (it == m_window_search.end()) {
1816 break;
1817 }
1818 }
1819
1820 if (!found) {
1821 m_focused_window = 0; 1819 m_focused_window = 0;
1822 } else { 1820 } else {
1823 old_client = m_focused_window; 1821 old_client = m_focused_window;