summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2006-07-30 20:37:12 (GMT)
committermarkt <markt>2006-07-30 20:37:12 (GMT)
commite66c3dd866bb1f7108b8dcecdc7c4dda37e95ee3 (patch)
treecdeae6e0e971aa6c78270387543cb5a9a7b2d291
parent05faf53236c3d2be113b6b17cf453a924aec335d (diff)
downloadfluxbox_lack-e66c3dd866bb1f7108b8dcecdc7c4dda37e95ee3.zip
fluxbox_lack-e66c3dd866bb1f7108b8dcecdc7c4dda37e95ee3.tar.bz2
list windows in iconbar in creation order
-rw-r--r--ChangeLog3
-rw-r--r--src/IconbarTool.cc130
-rw-r--r--src/IconbarTool.hh10
3 files changed, 31 insertions, 112 deletions
diff --git a/ChangeLog b/ChangeLog
index 37b1bc2..15f7673 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc3: 2Changes for 1.0rc3:
3*06/07/30:
4 * List windows in iconbar in creation order (Mark)
5 IconbarTool.cc/hh
3*06/07/29: 6*06/07/29:
4 * Don't jump to remembered apps on restart (Mark) 7 * Don't jump to remembered apps on restart (Mark)
5 Remember.cc 8 Remember.cc
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index 7784327..4ce600f 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -348,15 +348,14 @@ inline bool checkAddWindow(IconbarTool::Mode mode, const FluxboxWindow &win) {
348} 348}
349 349
350void removeDuplicate(const IconbarTool::IconList &iconlist, std::list<FluxboxWindow *> &windowlist) { 350void removeDuplicate(const IconbarTool::IconList &iconlist, std::list<FluxboxWindow *> &windowlist) {
351 IconbarTool::IconList::const_iterator win_it = iconlist.begin(); 351 IconbarTool::IconList::const_iterator icon_it = iconlist.begin();
352 IconbarTool::IconList::const_iterator win_it_end = iconlist.end(); 352 IconbarTool::IconList::const_iterator icon_it_end = iconlist.end();
353 std::list<FluxboxWindow *>::iterator remove_it = windowlist.end(); 353 std::list<FluxboxWindow *>::iterator remove_it = windowlist.end();
354 for (; win_it != win_it_end; ++win_it) 354 for (; icon_it != icon_it_end; ++icon_it)
355 remove_it = remove(windowlist.begin(), remove_it, &(*win_it)->win()); 355 remove_it = remove(windowlist.begin(), remove_it, &(*icon_it)->win());
356 356
357 // remove already existing windows 357 // remove already existing windows
358 windowlist.erase(remove_it, windowlist.end()); 358 windowlist.erase(remove_it, windowlist.end());
359 windowlist.unique();
360} 359}
361 360
362}; // end anonymous namespace 361}; // end anonymous namespace
@@ -486,22 +485,8 @@ void IconbarTool::setMode(Mode mode) {
486 deleteIcons(); 485 deleteIcons();
487 486
488 // update mode 487 // update mode
489 switch (mode) { 488 if (mode != NONE)
490 case NONE: // nothing 489 updateList();
491 break;
492 case ICONS: // all icons from all workspaces
493 case WORKSPACEICONS: // all icons on current workspace
494 updateIcons();
495 break;
496 case WORKSPACENOICONS:
497 case WORKSPACE: // all windows and all icons on current workspace
498 updateWorkspace();
499 break;
500 case NOICONS:
501 case ALLWINDOWS: // all windows and all icons from all workspaces
502 updateAllWindows();
503 break;
504 };
505 490
506 // unlock graphics update 491 // unlock graphics update
507 m_icon_container.setUpdateLock(false); 492 m_icon_container.setUpdateLock(false);
@@ -614,23 +599,9 @@ void IconbarTool::update(FbTk::Subject *subj) {
614 deleteIcons(); 599 deleteIcons();
615 600
616 // ok, we got some signal that we need to update our iconbar container 601 // ok, we got some signal that we need to update our iconbar container
617 switch (mode()) { 602 if (mode() == NONE)
618 case NONE:
619 return; 603 return;
620 break; 604 updateList();
621 case ICONS:
622 case WORKSPACEICONS:
623 updateIcons();
624 break;
625 case WORKSPACENOICONS:
626 case WORKSPACE:
627 updateWorkspace();
628 break;
629 case NOICONS:
630 case ALLWINDOWS:
631 updateAllWindows();
632 break;
633 }
634 605
635 // unlock container and update graphics 606 // unlock container and update graphics
636 m_icon_container.setUpdateLock(false); 607 m_icon_container.setUpdateLock(false);
@@ -894,78 +865,27 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
894 win.attentionSig().attach(this); 865 win.attentionSig().attach(this);
895} 866}
896 867
897void IconbarTool::updateIcons() { 868void IconbarTool::updateList() {
898 std::list<FluxboxWindow *> itemlist; 869 std::list<WinClient *> ordered_list =
899 // add icons to the itemlist 870 m_screen.focusControl().creationOrderList();
900 BScreen::Icons::iterator icon_it = m_screen.iconList().begin(); 871 std::list<WinClient *>::iterator it = ordered_list.begin();
901 BScreen::Icons::iterator icon_it_end = m_screen.iconList().end(); 872 std::list<WinClient *>::iterator it_end = ordered_list.end();
902 for (; icon_it != icon_it_end; ++icon_it) { 873 for (; it != it_end; ++it) {
903 if (mode() == ICONS) 874 if ((*it)->fbwindow() && checkAddWindow(mode(), *(*it)->fbwindow()) &&
904 itemlist.push_back(*icon_it); 875 !checkDuplicate(*(*it)->fbwindow()))
905 else if (mode() == WORKSPACEICONS && 876 addWindow(*(*it)->fbwindow());
906 ((*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID() ||
907 (*icon_it)->isStuck()))
908 itemlist.push_back(*icon_it);
909 }
910 removeDuplicate(m_icon_list, itemlist);
911 addList(itemlist);
912}
913
914void IconbarTool::updateWorkspace() {
915 std::list<FluxboxWindow *> itemlist;
916 // add current workspace windows
917 Workspace &space = *m_screen.currentWorkspace();
918 Workspace::Windows::iterator win_it = space.windowList().begin();
919 Workspace::Windows::iterator win_it_end = space.windowList().end();
920 for (; win_it != win_it_end; ++win_it) {
921 if (checkAddWindow(mode(), **win_it))
922 itemlist.push_back(*win_it);
923 }
924
925 // add icons from current workspace
926 if (mode() != WORKSPACENOICONS) {
927 BScreen::Icons::iterator icon_it = m_screen.iconList().begin();
928 BScreen::Icons::iterator icon_it_end = m_screen.iconList().end();
929 for (; icon_it != icon_it_end; ++icon_it) {
930 if ((*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID() ||
931 (*icon_it)->isStuck())
932 itemlist.push_back(*icon_it);
933 }
934 } 877 }
935 878 renderTheme();
936 removeDuplicate(m_icon_list, itemlist);
937 addList(itemlist);
938} 879}
939 880
940 881bool IconbarTool::checkDuplicate(FluxboxWindow &win) {
941void IconbarTool::updateAllWindows() { 882 IconList::iterator it = m_icon_list.begin();
942 std::list<FluxboxWindow *> full_list; 883 IconList::iterator it_end = m_icon_list.end();
943 // for each workspace add clients to full list 884 for (; it != it_end; ++it) {
944 BScreen::Workspaces::iterator workspace_it = m_screen.getWorkspacesList().begin(); 885 if (&win == &(*it)->win())
945 BScreen::Workspaces::iterator workspace_it_end = m_screen.getWorkspacesList().end(); 886 return true;
946 for (; workspace_it != workspace_it_end; ++workspace_it) {
947 full_list.insert(full_list.end(),
948 (*workspace_it)->windowList().begin(),
949 (*workspace_it)->windowList().end());
950 }
951 // add icons
952 if(mode() != NOICONS && mode() != WORKSPACENOICONS) {
953 full_list.insert(full_list.end(),
954 m_screen.iconList().begin(),
955 m_screen.iconList().end());
956 } 887 }
957 888 return false;
958 removeDuplicate(m_icon_list, full_list);
959 addList(full_list);
960}
961
962void IconbarTool::addList(std::list<FluxboxWindow *> &winlist) {
963 // ok, now we should have a list of icons that we need to add
964 std::list<FluxboxWindow *>::iterator it = winlist.begin();
965 std::list<FluxboxWindow *>::iterator it_end = winlist.end();
966 for (; it != it_end; ++it)
967 addWindow(**it);
968 renderTheme();
969} 889}
970 890
971void IconbarTool::timedRender() { 891void IconbarTool::timedRender() {
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh
index e39a39b..feae16a 100644
--- a/src/IconbarTool.hh
+++ b/src/IconbarTool.hh
@@ -120,13 +120,9 @@ private:
120 /// add a single window 120 /// add a single window
121 void addWindow(FluxboxWindow &win); 121 void addWindow(FluxboxWindow &win);
122 /// add icons to the list 122 /// add icons to the list
123 void updateIcons(); 123 void updateList();
124 /// add normal windows to the list 124 /// check if window is already in the list
125 void updateWorkspace(); 125 bool checkDuplicate(FluxboxWindow &win);
126 /// add all windows to the list
127 void updateAllWindows();
128 /// add a list of windows
129 void addList(std::list<FluxboxWindow *> &winlist);
130 /// so we can update current window without flicker 126 /// so we can update current window without flicker
131 void timedRender(); 127 void timedRender();
132 128