summaryrefslogtreecommitdiff
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
parenta1eb047c00e96295e482564311db9075d05ce034 (diff)
downloadfluxbox_lack-4993e2f36331299aba6a42df2896e49d4c98b111.zip
fluxbox_lack-4993e2f36331299aba6a42df2896e49d4c98b111.tar.bz2
speedups for having lots of stuck windows
-rw-r--r--ChangeLog3
-rw-r--r--src/Gnome.cc7
-rw-r--r--src/IconBar.cc46
-rw-r--r--src/IconBar.hh9
-rw-r--r--src/Toolbar.cc16
-rw-r--r--src/Toolbar.hh9
-rw-r--r--src/ToolbarHandler.cc23
-rw-r--r--src/Window.cc12
8 files changed, 95 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index a4206cf..badc7a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.4: 2Changes for 0.9.4:
3*03/06/26:
4 * Speedups for having many (particularly stuck) windows (Simon)
5 Toolbar.hh/cc IconBar.hh/cc ToolbarHandler.cc Gnome.cc Window.cc
3*03/06/25: 6*03/06/25:
4 * Applied toggle max vertical/horizontal patch (Thanks MrChuoi mrchuoi<[aT]>yahoo.com) 7 * Applied toggle max vertical/horizontal patch (Thanks MrChuoi mrchuoi<[aT]>yahoo.com)
5 Window.hh/cc 8 Window.hh/cc
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 2b12b7f..240c691 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.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: Gnome.cc,v 1.27 2003/06/23 14:16:04 rathnor Exp $ 22// $Id: Gnome.cc,v 1.28 2003/06/26 12:22:42 rathnor Exp $
23 23
24#include "Gnome.hh" 24#include "Gnome.hh"
25 25
@@ -218,7 +218,10 @@ void Gnome::updateWorkspaceCount(BScreen &screen) {
218} 218}
219 219
220void Gnome::updateWorkspace(FluxboxWindow &win) { 220void Gnome::updateWorkspace(FluxboxWindow &win) {
221 int val = win.workspaceNumber(); 221 int val = win.workspaceNumber();
222 if (win.isStuck()) {
223 val = -1;
224 }
222#ifdef DEBUG 225#ifdef DEBUG
223 cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<<val<< 226 cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<<val<<
224 ") for window("<<&win<<")"<<endl; 227 ") for window("<<&win<<")"<<endl;
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;
diff --git a/src/IconBar.hh b/src/IconBar.hh
index ca2bd6d..7f58a12 100644
--- a/src/IconBar.hh
+++ b/src/IconBar.hh
@@ -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.hh,v 1.14 2003/04/15 12:06:11 fluxgen Exp $ 22// $Id: IconBar.hh,v 1.15 2003/06/26 12:22:42 rathnor Exp $
23 23
24#ifndef ICONBAR_HH 24#ifndef ICONBAR_HH
25#define ICONBAR_HH 25#define ICONBAR_HH
@@ -64,13 +64,16 @@ public:
64 void reconfigure(); 64 void reconfigure();
65 Window addIcon(FluxboxWindow *fluxboxwin); 65 Window addIcon(FluxboxWindow *fluxboxwin);
66 Window delIcon(FluxboxWindow *fluxboxwin); 66 Window delIcon(FluxboxWindow *fluxboxwin);
67 WindowList *delAllIcons(); 67 WindowList *delAllIcons(bool ignore_stuck = false);
68 void buttonPressEvent(XButtonEvent *be); 68 void buttonPressEvent(XButtonEvent *be);
69 FluxboxWindow *findWindow(Window w); 69 FluxboxWindow *findWindow(Window w);
70 IconBarObj *findIcon(FluxboxWindow * const fluxboxwin); 70 IconBarObj *findIcon(FluxboxWindow * const fluxboxwin);
71 const IconBarObj *findIcon(const FluxboxWindow * const fluxboxwin) const; 71 const IconBarObj *findIcon(const FluxboxWindow * const fluxboxwin) const;
72 void exposeEvent(XExposeEvent *ee); 72 void exposeEvent(XExposeEvent *ee);
73 73
74 void enableUpdates();
75 void disableUpdates();
76
74 void draw(const IconBarObj * const obj, int width) const; 77 void draw(const IconBarObj * const obj, int width) const;
75 void setVertical(bool value) { m_vertical = value; } 78 void setVertical(bool value) { m_vertical = value; }
76 BScreen &screen() { return m_screen; } 79 BScreen &screen() { return m_screen; }
@@ -90,6 +93,8 @@ private:
90 unsigned long m_focus_pixel; 93 unsigned long m_focus_pixel;
91 bool m_vertical; 94 bool m_vertical;
92 FbTk::Font &m_font; 95 FbTk::Font &m_font;
96
97 int allow_updates;
93}; 98};
94 99
95#endif // ICONBAR_HH 100#endif // ICONBAR_HH
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index a31fbaf..f97f2d2 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.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: Toolbar.cc,v 1.95 2003/06/25 12:33:28 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.96 2003/06/26 12:22:42 rathnor Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -404,11 +404,11 @@ void Toolbar::delIcon(FluxboxWindow *w) {
404 FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w)); 404 FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w));
405} 405}
406 406
407void Toolbar::delAllIcons() { 407void Toolbar::delAllIcons(bool ignore_stuck) {
408 if (m_iconbar.get() == 0) 408 if (m_iconbar.get() == 0)
409 return; 409 return;
410 410
411 IconBar::WindowList *deleted = m_iconbar->delAllIcons(); 411 IconBar::WindowList *deleted = m_iconbar->delAllIcons(ignore_stuck);
412 IconBar::WindowList::iterator it = deleted->begin(); 412 IconBar::WindowList::iterator it = deleted->begin();
413 IconBar::WindowList::iterator it_end = deleted->end(); 413 IconBar::WindowList::iterator it_end = deleted->end();
414 for (; it != it_end; ++it) { 414 for (; it != it_end; ++it) {
@@ -421,6 +421,16 @@ bool Toolbar::containsIcon(const FluxboxWindow &win) const {
421 return (m_iconbar->findIcon(&win) != 0); 421 return (m_iconbar->findIcon(&win) != 0);
422} 422}
423 423
424void Toolbar::enableUpdates() {
425 if (m_iconbar.get() != 0)
426 m_iconbar->enableUpdates();
427}
428
429void Toolbar::disableUpdates() {
430 if (m_iconbar.get() != 0)
431 m_iconbar->disableUpdates();
432}
433
424void Toolbar::enableIconBar() { 434void Toolbar::enableIconBar() {
425 if (m_iconbar.get() != 0) 435 if (m_iconbar.get() != 0)
426 return; // already on 436 return; // already on
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 87cd223..7a62c8d 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -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: Toolbar.hh,v 1.35 2003/06/23 13:16:50 fluxgen Exp $ 25// $Id: Toolbar.hh,v 1.36 2003/06/26 12:22:42 rathnor Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
@@ -71,13 +71,17 @@ public:
71 void addIcon(FluxboxWindow *w); 71 void addIcon(FluxboxWindow *w);
72 /// remove icon from iconbar 72 /// remove icon from iconbar
73 void delIcon(FluxboxWindow *w); 73 void delIcon(FluxboxWindow *w);
74 bool containsIcon(const FluxboxWindow &win) const;
74 /// remove all icons 75 /// remove all icons
75 void delAllIcons(); 76 void delAllIcons(bool ignore_stuck = false);
76 void enableIconBar(); 77 void enableIconBar();
77 void disableIconBar(); 78 void disableIconBar();
78 void raise(); 79 void raise();
79 void lower(); 80 void lower();
80 81
82 void enableUpdates();
83 void disableUpdates();
84
81 inline const FbTk::Menu &menu() const { return m_toolbarmenu; } 85 inline const FbTk::Menu &menu() const { return m_toolbarmenu; }
82 inline FbTk::Menu &menu() { return m_toolbarmenu; } 86 inline FbTk::Menu &menu() { return m_toolbarmenu; }
83 inline FbTk::Menu &placementMenu() { return m_placementmenu; } 87 inline FbTk::Menu &placementMenu() { return m_placementmenu; }
@@ -111,7 +115,6 @@ public:
111 inline const ToolbarTheme &theme() const { return m_theme; } 115 inline const ToolbarTheme &theme() const { return m_theme; }
112 inline ToolbarTheme &theme() { return m_theme; } 116 inline ToolbarTheme &theme() { return m_theme; }
113 bool isVertical() const; 117 bool isVertical() const;
114 bool containsIcon(const FluxboxWindow &win) const;
115 118
116 /** 119 /**
117 @name eventhandlers 120 @name eventhandlers
diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc
index d7cf8f0..317890a 100644
--- a/src/ToolbarHandler.cc
+++ b/src/ToolbarHandler.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: ToolbarHandler.cc,v 1.17 2003/06/24 16:27:18 fluxgen Exp $ 23// $Id: ToolbarHandler.cc,v 1.18 2003/06/26 12:22:42 rathnor Exp $
24 24
25/** 25/**
26 * The ToolbarHandler class acts as a rough interface to the toolbar. 26 * The ToolbarHandler class acts as a rough interface to the toolbar.
@@ -199,6 +199,10 @@ void ToolbarHandler::setMode(ToolbarMode newmode, bool initialise) {
199void ToolbarHandler::initForScreen(BScreen &screen) { 199void ToolbarHandler::initForScreen(BScreen &screen) {
200 if (&m_screen != &screen) 200 if (&m_screen != &screen)
201 return; 201 return;
202
203 if (m_toolbar.get() != 0)
204 m_toolbar->disableUpdates();
205
202 switch (mode()) { 206 switch (mode()) {
203 case OFF: 207 case OFF:
204 break; 208 break;
@@ -212,6 +216,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
212 Workspace::Windows::iterator wit = wins.begin(); 216 Workspace::Windows::iterator wit = wins.begin();
213 Workspace::Windows::iterator wit_end = wins.end(); 217 Workspace::Windows::iterator wit_end = wins.end();
214 for (; wit != wit_end; ++wit) { 218 for (; wit != wit_end; ++wit) {
219 if (!m_toolbar->containsIcon(**wit))
215 m_toolbar->addIcon(*wit); 220 m_toolbar->addIcon(*wit);
216/* 221/*
217 FluxboxWindow::ClientList::iterator cit = (*wit)->clientList().begin(); 222 FluxboxWindow::ClientList::iterator cit = (*wit)->clientList().begin();
@@ -238,7 +243,8 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
238 Workspace::Windows::iterator wit = wins.begin(); 243 Workspace::Windows::iterator wit = wins.begin();
239 Workspace::Windows::iterator wit_end = wins.end(); 244 Workspace::Windows::iterator wit_end = wins.end();
240 for (; wit != wit_end; ++wit) { 245 for (; wit != wit_end; ++wit) {
241 m_toolbar->addIcon(*wit); 246 if (!m_toolbar->containsIcon(**wit))
247 m_toolbar->addIcon(*wit);
242 } 248 }
243 } 249 }
244 // fall through and add icons for this workspace 250 // fall through and add icons for this workspace
@@ -255,6 +261,10 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
255 } 261 }
256 break; 262 break;
257 } 263 }
264
265 if (m_toolbar.get() != 0)
266 m_toolbar->enableUpdates();
267
258} 268}
259 269
260void ToolbarHandler::setupWindow(FluxboxWindow &win) { 270void ToolbarHandler::setupWindow(FluxboxWindow &win) {
@@ -305,7 +315,7 @@ void ToolbarHandler::updateWindowClose(FluxboxWindow &win) {
305 } 315 }
306 break; 316 break;
307 case WORKSPACE: 317 case WORKSPACE:
308 if (win.workspaceNumber() == m_current_workspace) 318 if (win.isStuck() || win.workspaceNumber() == m_current_workspace)
309 m_toolbar->delIcon(&win); 319 m_toolbar->delIcon(&win);
310 break; 320 break;
311 case ALLWINDOWS: 321 case ALLWINDOWS:
@@ -364,7 +374,8 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) {
364 m_toolbar->addIcon(&win); 374 m_toolbar->addIcon(&win);
365 } else { 375 } else {
366 // relies on the fact that this runs but does nothing if window isn't contained. 376 // relies on the fact that this runs but does nothing if window isn't contained.
367 m_toolbar->delIcon(&win); 377 if (!win.isStuck())
378 m_toolbar->delIcon(&win);
368 } 379 }
369} 380}
370 381
@@ -375,8 +386,10 @@ void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) {
375 // otherwise ignore it 386 // otherwise ignore it
376 if (mode() != WORKSPACE && mode() != WORKSPACEICONS) 387 if (mode() != WORKSPACE && mode() != WORKSPACEICONS)
377 return; 388 return;
378 m_toolbar->delAllIcons(); 389 m_toolbar->disableUpdates();
390 m_toolbar->delAllIcons(true);
379 initForScreen(m_screen); 391 initForScreen(m_screen);
392 m_toolbar->enableUpdates();
380 m_toolbar->redrawWorkspaceLabel(true); 393 m_toolbar->redrawWorkspaceLabel(true);
381} 394}
382 395
diff --git a/src/Window.cc b/src/Window.cc
index 464210c..380df19 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.198 2003/06/25 13:37:06 fluxgen Exp $ 25// $Id: Window.cc,v 1.199 2003/06/26 12:22:43 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -1286,6 +1286,7 @@ void FluxboxWindow::maximizeVertical() {
1286 1286
1287 1287
1288void FluxboxWindow::setWorkspace(int n) { 1288void FluxboxWindow::setWorkspace(int n) {
1289 unsigned int old_wkspc = m_workspace_number;
1289 1290
1290 m_workspace_number = n; 1291 m_workspace_number = n;
1291 1292
@@ -1293,10 +1294,12 @@ void FluxboxWindow::setWorkspace(int n) {
1293 m_blackbox_attrib.workspace = m_workspace_number; 1294 m_blackbox_attrib.workspace = m_workspace_number;
1294 1295
1295 // notify workspace change 1296 // notify workspace change
1297 if (!stuck && old_wkspc != m_workspace_number) {
1296#ifdef DEBUG 1298#ifdef DEBUG
1297 cerr<<this<<" notify workspace signal"<<endl; 1299 cerr<<this<<" notify workspace signal"<<endl;
1298#endif // DEBUG 1300#endif // DEBUG
1299 m_workspacesig.notify(); 1301 m_workspacesig.notify();
1302 }
1300} 1303}
1301 1304
1302void FluxboxWindow::setLayerNum(int layernum) { 1305void FluxboxWindow::setLayerNum(int layernum) {
@@ -1354,6 +1357,9 @@ void FluxboxWindow::stick() {
1354 } 1357 }
1355 1358
1356 setState(m_current_state); 1359 setState(m_current_state);
1360 // notify since some things consider "stuck" to be a pseudo-workspace
1361 m_workspacesig.notify();
1362
1357} 1363}
1358 1364
1359 1365