diff options
author | fluxgen <fluxgen> | 2003-08-24 11:19:45 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-24 11:19:45 (GMT) |
commit | d509be7ac9a01ad5e2de4e4de510788ada3c8a60 (patch) | |
tree | e7e2317571a916a318ace7da21888f3653911cbf | |
parent | e405a967e2c17d8947fc80a31f211314499d5927 (diff) | |
download | fluxbox_lack-d509be7ac9a01ad5e2de4e4de510788ada3c8a60.zip fluxbox_lack-d509be7ac9a01ad5e2de4e4de510788ada3c8a60.tar.bz2 |
cleaning
-rw-r--r-- | src/FbWinFrame.cc | 68 | ||||
-rw-r--r-- | src/Screen.cc | 50 | ||||
-rw-r--r-- | src/Workspace.cc | 10 | ||||
-rw-r--r-- | src/fluxbox.cc | 33 |
4 files changed, 66 insertions, 95 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 7943c8a..9c8989f 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrame.cc,v 1.39 2003/08/23 15:46:06 fluxgen Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.40 2003/08/24 11:11:07 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | 25 | ||
@@ -27,12 +27,14 @@ | |||
27 | #include "FbTk/EventManager.hh" | 27 | #include "FbTk/EventManager.hh" |
28 | #include "FbTk/TextButton.hh" | 28 | #include "FbTk/TextButton.hh" |
29 | #include "FbTk/App.hh" | 29 | #include "FbTk/App.hh" |
30 | #include "FbTk/Compose.hh" | ||
30 | 31 | ||
31 | #include "FbWinFrameTheme.hh" | 32 | #include "FbWinFrameTheme.hh" |
32 | #ifdef SHAPE | 33 | #ifdef SHAPE |
33 | #include "Shape.hh" | 34 | #include "Shape.hh" |
34 | #endif // SHAPE | 35 | #endif // SHAPE |
35 | 36 | ||
37 | |||
36 | #include <algorithm> | 38 | #include <algorithm> |
37 | #include <iostream> | 39 | #include <iostream> |
38 | using namespace std; | 40 | using namespace std; |
@@ -505,14 +507,13 @@ void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | |||
505 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { | 507 | void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { |
506 | // we can ignore which window the event was generated for | 508 | // we can ignore which window the event was generated for |
507 | 509 | ||
508 | LabelList::iterator btn_it = m_labelbuttons.begin(); | 510 | LabelList::iterator button_it = find_if(m_labelbuttons.begin(), |
509 | LabelList::iterator btn_it_end = m_labelbuttons.end(); | 511 | m_labelbuttons.end(), |
510 | for (; btn_it != btn_it_end; ++btn_it) { | 512 | FbTk::Compose(bind2nd(equal_to<Window>(), event.window), |
511 | if ((*btn_it)->window() == event.window) { | 513 | mem_fun(&FbTk::Button::window))); |
512 | (*btn_it)->buttonReleaseEvent(event); | 514 | if (button_it != m_labelbuttons.end()) |
513 | break; | 515 | (*button_it)->buttonReleaseEvent(event); |
514 | } | 516 | |
515 | } | ||
516 | 517 | ||
517 | if (event.window == m_grip_right.window() || | 518 | if (event.window == m_grip_right.window() || |
518 | event.window == m_grip_left.window() || | 519 | event.window == m_grip_left.window() || |
@@ -549,35 +550,36 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) { | |||
549 | m_grip_right.clearArea(event.x, event.y, event.width, event.height); | 550 | m_grip_right.clearArea(event.x, event.y, event.width, event.height); |
550 | m_grip_right.updateTransparent(); | 551 | m_grip_right.updateTransparent(); |
551 | } else { | 552 | } else { |
552 | LabelList::iterator btn_it = m_labelbuttons.begin(); | 553 | // create compare function |
553 | LabelList::iterator btn_it_end = m_labelbuttons.end(); | 554 | // that we should use with find_if |
554 | for (; btn_it != btn_it_end; ++btn_it) { | 555 | FbTk::Compose_base<std::binder2nd<std::equal_to<Window> >, |
555 | if ((*btn_it)->window() == event.window) { | 556 | std::const_mem_fun_t<Window, FbTk::FbWindow> > |
556 | (*btn_it)->exposeEvent(event); | 557 | compare = FbTk::Compose(bind2nd(equal_to<Window>(), event.window), |
557 | return; | 558 | mem_fun(&FbTk::Button::window)); |
558 | } | 559 | |
560 | LabelList::iterator btn_it = find_if(m_labelbuttons.begin(), | ||
561 | m_labelbuttons.end(), | ||
562 | compare); | ||
563 | if (btn_it != m_labelbuttons.end()) { | ||
564 | (*btn_it)->exposeEvent(event); | ||
565 | return; | ||
559 | } | 566 | } |
560 | 567 | ||
561 | ButtonList::iterator it = m_buttons_left.begin(); | 568 | ButtonList::iterator it = find_if(m_buttons_left.begin(), |
562 | ButtonList::iterator it_end = m_buttons_left.end(); | 569 | m_buttons_left.end(), |
563 | for (; it != it_end; ++it) { | 570 | compare); |
564 | if ((*it)->window() == event.window) { | 571 | if (it != m_buttons_left.end()) { |
565 | (*it)->exposeEvent(event); | 572 | (*it)->exposeEvent(event); |
566 | return; | 573 | return; |
567 | } | ||
568 | } | 574 | } |
569 | 575 | ||
570 | it = m_buttons_right.begin(); | 576 | it = find_if(m_buttons_right.begin(), |
571 | it_end = m_buttons_right.end(); | 577 | m_buttons_right.end(), |
572 | for (; it != it_end; ++it) { | 578 | compare); |
573 | if ((*it)->window() == event.window) { | ||
574 | (*it)->exposeEvent(event); | ||
575 | return; | ||
576 | } | ||
577 | } | ||
578 | } | ||
579 | 579 | ||
580 | 580 | if (it != m_buttons_right.end()) | |
581 | (*it)->exposeEvent(event); | ||
582 | } | ||
581 | } | 583 | } |
582 | 584 | ||
583 | void FbWinFrame::handleEvent(XEvent &event) { | 585 | void FbWinFrame::handleEvent(XEvent &event) { |
diff --git a/src/Screen.cc b/src/Screen.cc index bd1a919..d5379da 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.223 2003/08/22 15:03:28 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.224 2003/08/24 11:13:36 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -689,7 +689,7 @@ void BScreen::rereadMenu() { | |||
689 | 689 | ||
690 | 690 | ||
691 | void BScreen::removeWorkspaceNames() { | 691 | void BScreen::removeWorkspaceNames() { |
692 | m_workspace_names.erase(m_workspace_names.begin(), m_workspace_names.end()); | 692 | m_workspace_names.clear(); |
693 | } | 693 | } |
694 | 694 | ||
695 | void BScreen::updateWorkspaceNamesAtom() { | 695 | void BScreen::updateWorkspaceNamesAtom() { |
@@ -935,7 +935,7 @@ void BScreen::addNetizen(Window win) { | |||
935 | Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); | 935 | Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); |
936 | for (; win_it != win_it_end; ++win_it) { | 936 | for (; win_it != win_it_end; ++win_it) { |
937 | net->sendWindowAdd((*win_it)->clientWindow(), | 937 | net->sendWindowAdd((*win_it)->clientWindow(), |
938 | (*it)->workspaceID()); | 938 | (*it)->workspaceID()); |
939 | } | 939 | } |
940 | } | 940 | } |
941 | 941 | ||
@@ -976,15 +976,11 @@ void BScreen::updateNetizenWorkspaceCount() { | |||
976 | 976 | ||
977 | 977 | ||
978 | void BScreen::updateNetizenWindowFocus() { | 978 | void BScreen::updateNetizenWindowFocus() { |
979 | |||
980 | Netizens::iterator it = m_netizen_list.begin(); | ||
981 | Netizens::iterator it_end = m_netizen_list.end(); | ||
982 | Window f = ((Fluxbox::instance()->getFocusedWindow()) ? | 979 | Window f = ((Fluxbox::instance()->getFocusedWindow()) ? |
983 | Fluxbox::instance()->getFocusedWindow()->window() : None); | 980 | Fluxbox::instance()->getFocusedWindow()->window() : None); |
984 | for (; it != it_end; ++it) { | 981 | for_each(m_netizen_list.begin(), |
985 | (*it)->sendWindowFocus(f); | 982 | m_netizen_list.end(), |
986 | } | 983 | bind2nd(mem_fun(&Netizen::sendWindowFocus), f)); |
987 | |||
988 | } | 984 | } |
989 | 985 | ||
990 | 986 | ||
@@ -1001,40 +997,32 @@ void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) { | |||
1001 | 997 | ||
1002 | 998 | ||
1003 | void BScreen::updateNetizenWindowDel(Window w) { | 999 | void BScreen::updateNetizenWindowDel(Window w) { |
1004 | Netizens::iterator it = m_netizen_list.begin(); | 1000 | for_each(m_netizen_list.begin(), |
1005 | Netizens::iterator it_end = m_netizen_list.end(); | 1001 | m_netizen_list.end(), |
1006 | for (; it != it_end; ++it) { | 1002 | bind2nd(mem_fun(&Netizen::sendWindowDel), w)); |
1007 | (*it)->sendWindowDel(w); | ||
1008 | } | ||
1009 | 1003 | ||
1010 | m_clientlist_sig.notify(); | 1004 | m_clientlist_sig.notify(); |
1011 | } | 1005 | } |
1012 | 1006 | ||
1013 | 1007 | ||
1014 | void BScreen::updateNetizenWindowRaise(Window w) { | 1008 | void BScreen::updateNetizenWindowRaise(Window w) { |
1015 | Netizens::iterator it = m_netizen_list.begin(); | 1009 | for_each(m_netizen_list.begin(), |
1016 | Netizens::iterator it_end = m_netizen_list.end(); | 1010 | m_netizen_list.end(), |
1017 | for (; it != it_end; ++it) { | 1011 | bind2nd(mem_fun(&Netizen::sendWindowRaise), w)); |
1018 | (*it)->sendWindowRaise(w); | ||
1019 | } | ||
1020 | } | 1012 | } |
1021 | 1013 | ||
1022 | 1014 | ||
1023 | void BScreen::updateNetizenWindowLower(Window w) { | 1015 | void BScreen::updateNetizenWindowLower(Window w) { |
1024 | Netizens::iterator it = m_netizen_list.begin(); | 1016 | for_each(m_netizen_list.begin(), |
1025 | Netizens::iterator it_end = m_netizen_list.end(); | 1017 | m_netizen_list.end(), |
1026 | for (; it != it_end; ++it) { | 1018 | bind2nd(mem_fun(&Netizen::sendWindowLower), w)); |
1027 | (*it)->sendWindowLower(w); | ||
1028 | } | ||
1029 | } | 1019 | } |
1030 | 1020 | ||
1031 | |||
1032 | void BScreen::updateNetizenConfigNotify(XEvent &e) { | 1021 | void BScreen::updateNetizenConfigNotify(XEvent &e) { |
1033 | Netizens::iterator it = m_netizen_list.begin(); | 1022 | Netizens::iterator it = m_netizen_list.begin(); |
1034 | Netizens::iterator it_end = m_netizen_list.end(); | 1023 | Netizens::iterator it_end = m_netizen_list.end(); |
1035 | for (; it != it_end; ++it) { | 1024 | for (; it != it_end; ++it) |
1036 | (*it)->sendConfigNotify(e); | 1025 | (*it)->sendConfigNotify(e); |
1037 | } | ||
1038 | } | 1026 | } |
1039 | 1027 | ||
1040 | FluxboxWindow *BScreen::createWindow(Window client) { | 1028 | FluxboxWindow *BScreen::createWindow(Window client) { |
@@ -1047,7 +1035,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { | |||
1047 | bool iskdedockapp = false; | 1035 | bool iskdedockapp = false; |
1048 | Atom ajunk; | 1036 | Atom ajunk; |
1049 | int ijunk; | 1037 | int ijunk; |
1050 | unsigned long *data = (unsigned long *) 0, uljunk; | 1038 | unsigned long *data = 0, uljunk; |
1051 | Display *disp = FbTk::App::instance()->display(); | 1039 | Display *disp = FbTk::App::instance()->display(); |
1052 | // Check if KDE v2.x dock applet | 1040 | // Check if KDE v2.x dock applet |
1053 | if (XGetWindowProperty(disp, client, | 1041 | if (XGetWindowProperty(disp, client, |
@@ -1185,8 +1173,8 @@ void BScreen::clearStrut(Strut *str) { | |||
1185 | return; | 1173 | return; |
1186 | // find strut and erase it | 1174 | // find strut and erase it |
1187 | std::list<Strut *>::iterator pos = find(m_strutlist.begin(), | 1175 | std::list<Strut *>::iterator pos = find(m_strutlist.begin(), |
1188 | m_strutlist.end(), | 1176 | m_strutlist.end(), |
1189 | str); | 1177 | str); |
1190 | if (pos == m_strutlist.end()) | 1178 | if (pos == m_strutlist.end()) |
1191 | return; | 1179 | return; |
1192 | m_strutlist.erase(pos); | 1180 | m_strutlist.erase(pos); |
diff --git a/src/Workspace.cc b/src/Workspace.cc index 3023994..3bec41a 100644 --- a/src/Workspace.cc +++ b/src/Workspace.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: Workspace.cc,v 1.80 2003/08/19 16:16:28 fluxgen Exp $ | 25 | // $Id: Workspace.cc,v 1.81 2003/08/24 11:16:42 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -246,9 +246,8 @@ void Workspace::removeWindow(WinClient &client) { | |||
246 | void Workspace::showAll() { | 246 | void Workspace::showAll() { |
247 | Windows::iterator it = m_windowlist.begin(); | 247 | Windows::iterator it = m_windowlist.begin(); |
248 | Windows::iterator it_end = m_windowlist.end(); | 248 | Windows::iterator it_end = m_windowlist.end(); |
249 | for (; it != it_end; ++it) { | 249 | for (; it != it_end; ++it) |
250 | (*it)->deiconify(false, false); | 250 | (*it)->deiconify(false, false); |
251 | } | ||
252 | } | 251 | } |
253 | 252 | ||
254 | 253 | ||
@@ -265,9 +264,8 @@ void Workspace::hideAll() { | |||
265 | void Workspace::removeAll() { | 264 | void Workspace::removeAll() { |
266 | Windows::iterator it = m_windowlist.begin(); | 265 | Windows::iterator it = m_windowlist.begin(); |
267 | Windows::const_iterator it_end = m_windowlist.end(); | 266 | Windows::const_iterator it_end = m_windowlist.end(); |
268 | for (; it != it_end; ++it) { | 267 | for (; it != it_end; ++it) |
269 | (*it)->iconify(); | 268 | (*it)->iconify(); |
270 | } | ||
271 | } | 269 | } |
272 | 270 | ||
273 | 271 | ||
@@ -291,7 +289,7 @@ namespace { | |||
291 | class FindInGroup { | 289 | class FindInGroup { |
292 | public: | 290 | public: |
293 | FindInGroup(const FluxboxWindow &w):m_w(w) { } | 291 | FindInGroup(const FluxboxWindow &w):m_w(w) { } |
294 | bool operator ()(const string &name) { | 292 | bool operator ()(const string &name) const { |
295 | return (name == m_w.winClient().getWMClassName()); | 293 | return (name == m_w.winClient().getWMClassName()); |
296 | } | 294 | } |
297 | private: | 295 | private: |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 370bc1d..c28a53c 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.186 2003/08/22 21:38:58 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.187 2003/08/24 11:19:45 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -1332,17 +1332,11 @@ void Fluxbox::attachSignals(WinClient &winclient) { | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | BScreen *Fluxbox::searchScreen(Window window) { | 1334 | BScreen *Fluxbox::searchScreen(Window window) { |
1335 | BScreen *screen = 0; | ||
1336 | ScreenList::iterator it = m_screen_list.begin(); | 1335 | ScreenList::iterator it = m_screen_list.begin(); |
1337 | ScreenList::iterator it_end = m_screen_list.end(); | 1336 | ScreenList::iterator it_end = m_screen_list.end(); |
1338 | |||
1339 | for (; it != it_end; ++it) { | 1337 | for (; it != it_end; ++it) { |
1340 | if (*it) { | 1338 | if (*it && (*it)->rootWindow() == window) |
1341 | if ((*it)->rootWindow() == window) { | 1339 | return (*it); |
1342 | screen = (*it); | ||
1343 | return screen; | ||
1344 | } | ||
1345 | } | ||
1346 | } | 1340 | } |
1347 | 1341 | ||
1348 | return 0; | 1342 | return 0; |
@@ -1431,12 +1425,8 @@ void Fluxbox::shutdown() { | |||
1431 | XSetInputFocus(FbTk::App::instance()->display(), PointerRoot, None, CurrentTime); | 1425 | XSetInputFocus(FbTk::App::instance()->display(), PointerRoot, None, CurrentTime); |
1432 | 1426 | ||
1433 | //send shutdown to all screens | 1427 | //send shutdown to all screens |
1434 | ScreenList::iterator it = m_screen_list.begin(); | 1428 | for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::shutdown)); |
1435 | ScreenList::iterator it_end = m_screen_list.end(); | 1429 | |
1436 | for (; it != it_end; ++it) { | ||
1437 | if(*it) | ||
1438 | (*it)->shutdown(); | ||
1439 | } | ||
1440 | m_shutdown = true; | 1430 | m_shutdown = true; |
1441 | XSync(FbTk::App::instance()->display(), False); | 1431 | XSync(FbTk::App::instance()->display(), False); |
1442 | 1432 | ||
@@ -1791,10 +1781,8 @@ void Fluxbox::real_reconfigure() { | |||
1791 | if (old_blackboxrc) | 1781 | if (old_blackboxrc) |
1792 | XrmDestroyDatabase(old_blackboxrc); | 1782 | XrmDestroyDatabase(old_blackboxrc); |
1793 | 1783 | ||
1794 | ScreenList::iterator sit = m_screen_list.begin(); | 1784 | // reconfigure all screens |
1795 | ScreenList::iterator sit_end = m_screen_list.end(); | 1785 | for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::reconfigure)); |
1796 | for (; sit != sit_end; ++sit) | ||
1797 | (*sit)->reconfigure(); | ||
1798 | 1786 | ||
1799 | //reconfigure keys | 1787 | //reconfigure keys |
1800 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); | 1788 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); |
@@ -1841,12 +1829,7 @@ void Fluxbox::real_rereadMenu() { | |||
1841 | delete *it; | 1829 | delete *it; |
1842 | 1830 | ||
1843 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); | 1831 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); |
1844 | 1832 | for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::rereadMenu)); | |
1845 | ScreenList::iterator sit = m_screen_list.begin(); | ||
1846 | ScreenList::iterator sit_end = m_screen_list.end(); | ||
1847 | for (; sit != sit_end; ++sit) { | ||
1848 | (*sit)->rereadMenu(); | ||
1849 | } | ||
1850 | } | 1833 | } |
1851 | 1834 | ||
1852 | void Fluxbox::saveMenuFilename(const char *filename) { | 1835 | void Fluxbox::saveMenuFilename(const char *filename) { |