all repos — fluxbox @ d509be7ac9a01ad5e2de4e4de510788ada3c8a60

custom fork of the fluxbox windowmanager

cleaning
fluxgen fluxgen
commit

d509be7ac9a01ad5e2de4e4de510788ada3c8a60

parent

e405a967e2c17d8947fc80a31f211314499d5927

4 files changed, 66 insertions(+), 95 deletions(-)

jump to
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.39 2003/08/23 15:46:06 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.40 2003/08/24 11:11:07 fluxgen Exp $ #include "FbWinFrame.hh"

@@ -27,11 +27,13 @@ #include "FbTk/ImageControl.hh"

#include "FbTk/EventManager.hh" #include "FbTk/TextButton.hh" #include "FbTk/App.hh" +#include "FbTk/Compose.hh" #include "FbWinFrameTheme.hh" #ifdef SHAPE #include "Shape.hh" #endif // SHAPE + #include <algorithm> #include <iostream>

@@ -505,14 +507,13 @@

void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { // we can ignore which window the event was generated for - LabelList::iterator btn_it = m_labelbuttons.begin(); - LabelList::iterator btn_it_end = m_labelbuttons.end(); - for (; btn_it != btn_it_end; ++btn_it) { - if ((*btn_it)->window() == event.window) { - (*btn_it)->buttonReleaseEvent(event); - break; - } - } + LabelList::iterator button_it = find_if(m_labelbuttons.begin(), + m_labelbuttons.end(), + FbTk::Compose(bind2nd(equal_to<Window>(), event.window), + mem_fun(&FbTk::Button::window))); + if (button_it != m_labelbuttons.end()) + (*button_it)->buttonReleaseEvent(event); + if (event.window == m_grip_right.window() || event.window == m_grip_left.window() ||

@@ -549,35 +550,36 @@ } else if (m_grip_right == event.window) {

m_grip_right.clearArea(event.x, event.y, event.width, event.height); m_grip_right.updateTransparent(); } else { - LabelList::iterator btn_it = m_labelbuttons.begin(); - LabelList::iterator btn_it_end = m_labelbuttons.end(); - for (; btn_it != btn_it_end; ++btn_it) { - if ((*btn_it)->window() == event.window) { - (*btn_it)->exposeEvent(event); - return; - } - } + // create compare function + // that we should use with find_if + FbTk::Compose_base<std::binder2nd<std::equal_to<Window> >, + std::const_mem_fun_t<Window, FbTk::FbWindow> > + compare = FbTk::Compose(bind2nd(equal_to<Window>(), event.window), + mem_fun(&FbTk::Button::window)); - ButtonList::iterator it = m_buttons_left.begin(); - ButtonList::iterator it_end = m_buttons_left.end(); - for (; it != it_end; ++it) { - if ((*it)->window() == event.window) { - (*it)->exposeEvent(event); - return; - } + LabelList::iterator btn_it = find_if(m_labelbuttons.begin(), + m_labelbuttons.end(), + compare); + if (btn_it != m_labelbuttons.end()) { + (*btn_it)->exposeEvent(event); + return; } - it = m_buttons_right.begin(); - it_end = m_buttons_right.end(); - for (; it != it_end; ++it) { - if ((*it)->window() == event.window) { - (*it)->exposeEvent(event); - return; - } + ButtonList::iterator it = find_if(m_buttons_left.begin(), + m_buttons_left.end(), + compare); + if (it != m_buttons_left.end()) { + (*it)->exposeEvent(event); + return; } - } - + it = find_if(m_buttons_right.begin(), + m_buttons_right.end(), + compare); + + if (it != m_buttons_right.end()) + (*it)->exposeEvent(event); + } } void FbWinFrame::handleEvent(XEvent &event) {
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.223 2003/08/22 15:03:28 fluxgen Exp $ +// $Id: Screen.cc,v 1.224 2003/08/24 11:13:36 fluxgen Exp $ #include "Screen.hh"

@@ -689,7 +689,7 @@ }

void BScreen::removeWorkspaceNames() { - m_workspace_names.erase(m_workspace_names.begin(), m_workspace_names.end()); + m_workspace_names.clear(); } void BScreen::updateWorkspaceNamesAtom() {

@@ -935,7 +935,7 @@ Workspace::Windows::iterator win_it = (*it)->windowList().begin();

Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); for (; win_it != win_it_end; ++win_it) { net->sendWindowAdd((*win_it)->clientWindow(), - (*it)->workspaceID()); + (*it)->workspaceID()); } }

@@ -976,15 +976,11 @@ }

void BScreen::updateNetizenWindowFocus() { - - Netizens::iterator it = m_netizen_list.begin(); - Netizens::iterator it_end = m_netizen_list.end(); Window f = ((Fluxbox::instance()->getFocusedWindow()) ? Fluxbox::instance()->getFocusedWindow()->window() : None); - for (; it != it_end; ++it) { - (*it)->sendWindowFocus(f); - } - + for_each(m_netizen_list.begin(), + m_netizen_list.end(), + bind2nd(mem_fun(&Netizen::sendWindowFocus), f)); }

@@ -1001,40 +997,32 @@ }

void BScreen::updateNetizenWindowDel(Window w) { - Netizens::iterator it = m_netizen_list.begin(); - Netizens::iterator it_end = m_netizen_list.end(); - for (; it != it_end; ++it) { - (*it)->sendWindowDel(w); - } + for_each(m_netizen_list.begin(), + m_netizen_list.end(), + bind2nd(mem_fun(&Netizen::sendWindowDel), w)); m_clientlist_sig.notify(); } void BScreen::updateNetizenWindowRaise(Window w) { - Netizens::iterator it = m_netizen_list.begin(); - Netizens::iterator it_end = m_netizen_list.end(); - for (; it != it_end; ++it) { - (*it)->sendWindowRaise(w); - } + for_each(m_netizen_list.begin(), + m_netizen_list.end(), + bind2nd(mem_fun(&Netizen::sendWindowRaise), w)); } void BScreen::updateNetizenWindowLower(Window w) { - Netizens::iterator it = m_netizen_list.begin(); - Netizens::iterator it_end = m_netizen_list.end(); - for (; it != it_end; ++it) { - (*it)->sendWindowLower(w); - } + for_each(m_netizen_list.begin(), + m_netizen_list.end(), + bind2nd(mem_fun(&Netizen::sendWindowLower), w)); } - void BScreen::updateNetizenConfigNotify(XEvent &e) { Netizens::iterator it = m_netizen_list.begin(); Netizens::iterator it_end = m_netizen_list.end(); - for (; it != it_end; ++it) { + for (; it != it_end; ++it) (*it)->sendConfigNotify(e); - } } FluxboxWindow *BScreen::createWindow(Window client) {

@@ -1047,7 +1035,7 @@ //If so add to Slit

bool iskdedockapp = false; Atom ajunk; int ijunk; - unsigned long *data = (unsigned long *) 0, uljunk; + unsigned long *data = 0, uljunk; Display *disp = FbTk::App::instance()->display(); // Check if KDE v2.x dock applet if (XGetWindowProperty(disp, client,

@@ -1185,8 +1173,8 @@ if (str == 0)

return; // find strut and erase it std::list<Strut *>::iterator pos = find(m_strutlist.begin(), - m_strutlist.end(), - str); + m_strutlist.end(), + str); if (pos == m_strutlist.end()) return; m_strutlist.erase(pos);
M src/Workspace.ccsrc/Workspace.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.80 2003/08/19 16:16:28 fluxgen Exp $ +// $Id: Workspace.cc,v 1.81 2003/08/24 11:16:42 fluxgen Exp $ #include "Workspace.hh"

@@ -246,9 +246,8 @@

void Workspace::showAll() { Windows::iterator it = m_windowlist.begin(); Windows::iterator it_end = m_windowlist.end(); - for (; it != it_end; ++it) { + for (; it != it_end; ++it) (*it)->deiconify(false, false); - } }

@@ -265,9 +264,8 @@

void Workspace::removeAll() { Windows::iterator it = m_windowlist.begin(); Windows::const_iterator it_end = m_windowlist.end(); - for (; it != it_end; ++it) { + for (; it != it_end; ++it) (*it)->iconify(); - } }

@@ -291,7 +289,7 @@ // helper class for checkGrouping

class FindInGroup { public: FindInGroup(const FluxboxWindow &w):m_w(w) { } - bool operator ()(const string &name) { + bool operator ()(const string &name) const { return (name == m_w.winClient().getWMClassName()); } private:
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.186 2003/08/22 21:38:58 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.187 2003/08/24 11:19:45 fluxgen Exp $ #include "fluxbox.hh"

@@ -1332,17 +1332,11 @@ }

} BScreen *Fluxbox::searchScreen(Window window) { - BScreen *screen = 0; ScreenList::iterator it = m_screen_list.begin(); ScreenList::iterator it_end = m_screen_list.end(); - for (; it != it_end; ++it) { - if (*it) { - if ((*it)->rootWindow() == window) { - screen = (*it); - return screen; - } - } + if (*it && (*it)->rootWindow() == window) + return (*it); } return 0;

@@ -1431,12 +1425,8 @@

XSetInputFocus(FbTk::App::instance()->display(), PointerRoot, None, CurrentTime); //send shutdown to all screens - ScreenList::iterator it = m_screen_list.begin(); - ScreenList::iterator it_end = m_screen_list.end(); - for (; it != it_end; ++it) { - if(*it) - (*it)->shutdown(); - } + for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::shutdown)); + m_shutdown = true; XSync(FbTk::App::instance()->display(), False);

@@ -1791,10 +1781,8 @@

if (old_blackboxrc) XrmDestroyDatabase(old_blackboxrc); - ScreenList::iterator sit = m_screen_list.begin(); - ScreenList::iterator sit_end = m_screen_list.end(); - for (; sit != sit_end; ++sit) - (*sit)->reconfigure(); + // reconfigure all screens + for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::reconfigure)); //reconfigure keys m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str());

@@ -1841,12 +1829,7 @@ for (; it != it_end; ++it)

delete *it; m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); - - ScreenList::iterator sit = m_screen_list.begin(); - ScreenList::iterator sit_end = m_screen_list.end(); - for (; sit != sit_end; ++sit) { - (*sit)->rereadMenu(); - } + for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::rereadMenu)); } void Fluxbox::saveMenuFilename(const char *filename) {