aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-16 11:47:26 (GMT)
committerfluxgen <fluxgen>2003-08-16 11:47:26 (GMT)
commita1df5f7d15ba2c3b74f38897c8b073ac608115f5 (patch)
treeb2b0d869222aafd8bfdc58ca21af4d16f8015f5a
parent90b87d994257bc5a8a7230de9f4639006c2a4980 (diff)
downloadfluxbox-a1df5f7d15ba2c3b74f38897c8b073ac608115f5.zip
fluxbox-a1df5f7d15ba2c3b74f38897c8b073ac608115f5.tar.bz2
fixed iconified windows and minor optimization
-rw-r--r--src/IconbarTool.cc59
-rw-r--r--src/IconbarTool.hh6
2 files changed, 52 insertions, 13 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index f51cbb0..2e72d12 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: IconbarTool.cc,v 1.7 2003/08/15 17:23:23 fluxgen Exp $ 23// $Id: IconbarTool.cc,v 1.8 2003/08/16 11:47:26 fluxgen Exp $
24 24
25#include "IconbarTool.hh" 25#include "IconbarTool.hh"
26 26
@@ -31,8 +31,7 @@
31#include "IconButton.hh" 31#include "IconButton.hh"
32#include "Workspace.hh" 32#include "Workspace.hh"
33 33
34#include <iostream> 34#include <typeinfo>
35using namespace std;
36 35
37IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScreen &screen): 36IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScreen &screen):
38 ToolbarItem(ToolbarItem::RELATIVE), 37 ToolbarItem(ToolbarItem::RELATIVE),
@@ -124,6 +123,7 @@ void IconbarTool::update(FbTk::Subject *subj) {
124 // did we find it? 123 // did we find it?
125 if (it == m_icon_list.end()) 124 if (it == m_icon_list.end())
126 return; 125 return;
126
127 // remove from list and render theme again 127 // remove from list and render theme again
128 delete *it; 128 delete *it;
129 m_icon_list.erase(it); 129 m_icon_list.erase(it);
@@ -133,23 +133,62 @@ void IconbarTool::update(FbTk::Subject *subj) {
133 } 133 }
134 } 134 }
135 135
136 // ok, we got some signal that we need to update our iconbar container 136 bool remove_all = false; // if we should readd all windows
137 137
138 // remove all clients and add them again...the only way to do it now 138 if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject)) {
139 deleteIcons(); 139 BScreen::ScreenSubject *screen_subj = static_cast<BScreen::ScreenSubject *>(subj);
140 if (&screen_subj->screen().currentWorkspaceSig() == screen_subj) {
141 remove_all = true; // remove and readd all windows
142 }
143 }
144
145 // ok, we got some signal that we need to update our iconbar container
140 146
141 // get current workspace and all it's clients 147 // get current workspace and all it's clients
142 Workspace &space = *m_screen.currentWorkspace(); 148 Workspace &space = *m_screen.currentWorkspace();
143 // build a ItemList and add it (faster than adding single items) 149 // build a ItemList and add it (faster than adding single items)
144 Container::ItemList items; 150 Container::ItemList items;
145 Workspace::Windows::iterator it = space.windowList().begin(); 151 Workspace::Windows itemlist(space.windowList());
146 Workspace::Windows::iterator it_end = space.windowList().end(); 152 // add icons to the itemlist
153 {
154 BScreen::Icons::iterator icon_it = m_screen.getIconList().begin();
155 BScreen::Icons::iterator icon_it_end = m_screen.getIconList().end();
156 for (; icon_it != icon_it_end; ++icon_it) {
157 // just add the icons that are on the this workspace
158 if ((*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID())
159 itemlist.push_back(*icon_it);
160 }
161 }
162
163 // go through the current list and see if there're windows to be added
164 // (note: we dont need to check if there's one deleted since we're listening
165 // to dieSig )
166 if (!remove_all) {
167 IconList::iterator win_it = m_icon_list.begin();
168 IconList::iterator win_it_end = m_icon_list.end();
169 Workspace::Windows::iterator remove_it = itemlist.end();
170 for (; win_it != win_it_end; ++win_it)
171 remove_it = remove(itemlist.begin(), remove_it, &(*win_it)->win());
172
173 itemlist.erase(remove_it, itemlist.end());
174 // we dont need to do anything
175 // since we dont have anything to add ...
176 if (itemlist.size() == 0)
177 return;
178
179 } else {
180 deleteIcons();
181 }
182
183 // ok, now we should have a list of icons that we need to add
184 Workspace::Windows::iterator it = itemlist.begin();
185 Workspace::Windows::iterator it_end = itemlist.end();
147 for (; it != it_end; ++it) { 186 for (; it != it_end; ++it) {
148 187
149 // we just want windows that has clients 188 // we just want windows that has clients
150 if ((*it)->clientList().size() == 0) 189 if ((*it)->clientList().size() == 0)
151 continue; 190 continue;
152 191
153 IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), **it); 192 IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), **it);
154 items.push_back(button); 193 items.push_back(button);
155 m_icon_list.push_back(button); 194 m_icon_list.push_back(button);
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh
index 9cc565e..db50cd7 100644
--- a/src/IconbarTool.hh
+++ b/src/IconbarTool.hh
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: IconbarTool.hh,v 1.4 2003/08/13 10:11:14 fluxgen Exp $ 23// $Id: IconbarTool.hh,v 1.5 2003/08/16 11:47:26 fluxgen Exp $
24 24
25#ifndef ICONBARTOOL_HH 25#ifndef ICONBARTOOL_HH
26#define ICONBARTOOL_HH 26#define ICONBARTOOL_HH
@@ -30,10 +30,10 @@
30 30
31#include "FbTk/Observer.hh" 31#include "FbTk/Observer.hh"
32 32
33#include <list>
34
35#include <X11/Xlib.h> 33#include <X11/Xlib.h>
36 34
35#include <list>
36
37class IconbarTheme; 37class IconbarTheme;
38class BScreen; 38class BScreen;
39class IconButton; 39class IconButton;