aboutsummaryrefslogtreecommitdiff
path: root/src/IconBar.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-06-26 12:22:43 (GMT)
committerrathnor <rathnor>2003-06-26 12:22:43 (GMT)
commit4993e2f36331299aba6a42df2896e49d4c98b111 (patch)
treee130579b68dbf4244913e676060d0f6fd624140b /src/IconBar.cc
parenta1eb047c00e96295e482564311db9075d05ce034 (diff)
downloadfluxbox-4993e2f36331299aba6a42df2896e49d4c98b111.zip
fluxbox-4993e2f36331299aba6a42df2896e49d4c98b111.tar.bz2
speedups for having lots of stuck windows
Diffstat (limited to 'src/IconBar.cc')
-rw-r--r--src/IconBar.cc46
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 */
142IconBar::WindowList *IconBar::delAllIcons() { 144IconBar::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
257void IconBar::enableUpdates() {
258 --allow_updates;
259 if (allow_updates <= 0)
260 repositionIcons();
261
262}
263
264void 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*/
249void IconBar::repositionIcons() { 271void 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;