diff options
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r-- | src/Workspace.cc | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index ff6140d..814a0a2 100644 --- a/src/Workspace.cc +++ b/src/Workspace.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: Workspace.cc,v 1.14 2002/03/23 15:14:45 fluxgen Exp $ | 25 | // $Id: Workspace.cc,v 1.15 2002/04/02 23:14:07 fluxgen Exp $ |
26 | 26 | ||
27 | // use GNU extensions | 27 | // use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -98,7 +98,22 @@ const int Workspace::addWindow(FluxboxWindow *w, bool place) { | |||
98 | w->setWindowNumber(windowList.size()); | 98 | w->setWindowNumber(windowList.size()); |
99 | 99 | ||
100 | stackingList.push_front(w); | 100 | stackingList.push_front(w); |
101 | windowList.push_back(w); | 101 | |
102 | //insert window after the currently focused window | ||
103 | FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); | ||
104 | //if there isn't any window that's focused, just add it to the end of the list | ||
105 | if (focused == 0) { | ||
106 | windowList.push_back(w); | ||
107 | } else { | ||
108 | Windows::iterator it = windowList.begin(); | ||
109 | for (; it != windowList.end(); ++it) { | ||
110 | if (*it == focused) { | ||
111 | ++it; | ||
112 | break; | ||
113 | } | ||
114 | } | ||
115 | windowList.insert(it, w); | ||
116 | } | ||
102 | 117 | ||
103 | clientmenu->insert(w->getTitle()); | 118 | clientmenu->insert(w->getTitle()); |
104 | clientmenu->update(); | 119 | clientmenu->update(); |
@@ -139,7 +154,16 @@ const int Workspace::removeWindow(FluxboxWindow *w) { | |||
139 | if (lastfocus == w) | 154 | if (lastfocus == w) |
140 | lastfocus = (FluxboxWindow *) 0; | 155 | lastfocus = (FluxboxWindow *) 0; |
141 | 156 | ||
142 | windowList.erase(windowList.begin() + w->getWindowNumber()); | 157 | //could be faster? |
158 | Windows::iterator it = windowList.begin(); | ||
159 | Windows::iterator it_end = windowList.end(); | ||
160 | for (; it != it_end; ++it) { | ||
161 | if (*it == w) { | ||
162 | windowList.erase(it); | ||
163 | break; | ||
164 | } | ||
165 | } | ||
166 | |||
143 | clientmenu->remove(w->getWindowNumber()); | 167 | clientmenu->remove(w->getWindowNumber()); |
144 | clientmenu->update(); | 168 | clientmenu->update(); |
145 | 169 | ||