diff options
Diffstat (limited to 'src/IconBar.cc')
-rw-r--r-- | src/IconBar.cc | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/IconBar.cc b/src/IconBar.cc index e24ba32..fa7478f 100644 --- a/src/IconBar.cc +++ b/src/IconBar.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: IconBar.cc,v 1.37 2003/06/13 05:02:09 fluxgen Exp $ | 22 | // $Id: IconBar.cc,v 1.38 2003/06/26 12:22:42 rathnor Exp $ |
23 | 23 | ||
24 | #include "IconBar.hh" | 24 | #include "IconBar.hh" |
25 | 25 | ||
@@ -84,7 +84,8 @@ IconBar::IconBar(BScreen &scrn, Window parent, FbTk::Font &font): | |||
84 | m_parent(parent), | 84 | m_parent(parent), |
85 | m_focus_pm(None), | 85 | m_focus_pm(None), |
86 | m_vertical(false), | 86 | m_vertical(false), |
87 | m_font(font) | 87 | m_font(font), |
88 | allow_updates(0) | ||
88 | { | 89 | { |
89 | 90 | ||
90 | } | 91 | } |
@@ -103,9 +104,10 @@ Window IconBar::addIcon(FluxboxWindow *fluxboxwin) { | |||
103 | decorate(iconwin); | 104 | decorate(iconwin); |
104 | //add window object to list | 105 | //add window object to list |
105 | m_iconlist.push_back(new IconBarObj(fluxboxwin, iconwin)); | 106 | m_iconlist.push_back(new IconBarObj(fluxboxwin, iconwin)); |
107 | |||
106 | //reposition all icons to fit windowbar | 108 | //reposition all icons to fit windowbar |
107 | repositionIcons(); | 109 | repositionIcons(); |
108 | 110 | ||
109 | XMapSubwindows(m_display, iconwin); | 111 | XMapSubwindows(m_display, iconwin); |
110 | XMapWindow(m_display, iconwin); | 112 | XMapWindow(m_display, iconwin); |
111 | 113 | ||
@@ -139,16 +141,25 @@ Window IconBar::delIcon(FluxboxWindow *fluxboxwin) { | |||
139 | * Removes all icons from list | 141 | * Removes all icons from list |
140 | * Return X Windows of the removed iconobjs | 142 | * Return X Windows of the removed iconobjs |
141 | */ | 143 | */ |
142 | IconBar::WindowList *IconBar::delAllIcons() { | 144 | IconBar::WindowList *IconBar::delAllIcons(bool ignore_stuck) { |
143 | Window retwin = None; | 145 | Window retwin = None; |
144 | WindowList *ret = new WindowList(); | 146 | WindowList *ret = new WindowList(); |
145 | while (!m_iconlist.empty()) { | 147 | IconList::iterator it = m_iconlist.begin(); |
146 | IconBarObj *obj = m_iconlist.back(); | 148 | IconList::iterator tmp = m_iconlist.end(); |
147 | m_iconlist.pop_back(); | 149 | IconList::iterator it_end = m_iconlist.end(); |
148 | retwin = obj->getIconWin(); | 150 | while (it != it_end) { |
149 | ret->push_back(retwin); | 151 | IconBarObj *obj = *it; |
150 | delete obj; | 152 | if (!ignore_stuck || !obj->getFluxboxWin()->isStuck()) { |
151 | XDestroyWindow(m_display, retwin); | 153 | retwin = obj->getIconWin(); |
154 | ret->push_back(retwin); | ||
155 | tmp = it; | ||
156 | ++it; | ||
157 | m_iconlist.erase(tmp); | ||
158 | delete obj; | ||
159 | XDestroyWindow(m_display, retwin); | ||
160 | } else { | ||
161 | ++it; | ||
162 | } | ||
152 | } | 163 | } |
153 | repositionIcons(); | 164 | repositionIcons(); |
154 | return ret; | 165 | return ret; |
@@ -243,11 +254,22 @@ void IconBar::exposeEvent(XExposeEvent *ee) { | |||
243 | } | 254 | } |
244 | } | 255 | } |
245 | 256 | ||
257 | void IconBar::enableUpdates() { | ||
258 | --allow_updates; | ||
259 | if (allow_updates <= 0) | ||
260 | repositionIcons(); | ||
261 | |||
262 | } | ||
263 | |||
264 | void IconBar::disableUpdates() { | ||
265 | ++allow_updates; | ||
266 | } | ||
267 | |||
246 | /** | 268 | /** |
247 | Calculates and moves/resizes the icons | 269 | Calculates and moves/resizes the icons |
248 | */ | 270 | */ |
249 | void IconBar::repositionIcons() { | 271 | void IconBar::repositionIcons() { |
250 | if (m_iconlist.size() == 0) | 272 | if (m_iconlist.size() == 0 || allow_updates > 0) |
251 | return; | 273 | return; |
252 | 274 | ||
253 | Window root; | 275 | Window root; |