aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-09-21 16:02:22 (GMT)
committerfluxgen <fluxgen>2002-09-21 16:02:22 (GMT)
commit18a09c1a7ffdd0cbb9246f8f823c4426a776ba73 (patch)
tree83e2200053d91e5146d6f74b19132e824f06929b
parentb4022f90dbc4b93182597b7cf233cdea3f45c209 (diff)
downloadfluxbox-18a09c1a7ffdd0cbb9246f8f823c4426a776ba73.zip
fluxbox-18a09c1a7ffdd0cbb9246f8f823c4426a776ba73.tar.bz2
fixed check in setLastFocusedWindow
-rw-r--r--src/Workspace.cc24
-rw-r--r--src/Workspace.hh4
2 files changed, 20 insertions, 8 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 7d87a20..9319f0c 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.30 2002/09/12 14:55:11 rathnor Exp $ 25// $Id: Workspace.cc,v 1.31 2002/09/21 16:02:22 fluxgen Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -91,6 +91,13 @@ Workspace::~Workspace() {
91 91
92} 92}
93 93
94void Workspace::setLastFocusedWindow(FluxboxWindow *win) {
95 // make sure we have this window in the list
96 if (std::find(windowList.begin(), windowList.end(), win) != windowList.end())
97 lastfocus = win;
98 else
99 lastfocus = 0;
100}
94 101
95int Workspace::addWindow(FluxboxWindow *w, bool place) { 102int Workspace::addWindow(FluxboxWindow *w, bool place) {
96 if (w == 0) 103 if (w == 0)
@@ -150,6 +157,10 @@ int Workspace::removeWindow(FluxboxWindow *w) {
150 if (w == 0) 157 if (w == 0)
151 return -1; 158 return -1;
152 159
160 if (lastfocus == w) {
161 lastfocus = 0;
162 }
163
153 stackingList.remove(w); 164 stackingList.remove(w);
154 165
155 if (w->isFocused()) { 166 if (w->isFocused()) {
@@ -177,10 +188,8 @@ int Workspace::removeWindow(FluxboxWindow *w) {
177 } 188 }
178 } 189 }
179 190
180 if (lastfocus == w) 191
181 lastfocus = 0;
182 192
183 //could be faster?
184 Windows::iterator it = windowList.begin(); 193 Windows::iterator it = windowList.begin();
185 Windows::iterator it_end = windowList.end(); 194 Windows::iterator it_end = windowList.end();
186 for (; it != it_end; ++it) { 195 for (; it != it_end; ++it) {
@@ -203,7 +212,10 @@ int Workspace::removeWindow(FluxboxWindow *w) {
203 (*it)->setWindowNumber(i); 212 (*it)->setWindowNumber(i);
204 } 213 }
205 } 214 }
206 215
216 if (lastfocus == w || windowList.empty())
217 lastfocus = 0;
218
207 return windowList.size(); 219 return windowList.size();
208} 220}
209 221
@@ -411,7 +423,7 @@ bool Workspace::isLastWindow(FluxboxWindow *w) const{
411 return (w == windowList.back()); 423 return (w == windowList.back());
412} 424}
413 425
414void Workspace::setCurrent(void) { 426void Workspace::setCurrent() {
415 screen->changeWorkspaceID(m_id); 427 screen->changeWorkspaceID(m_id);
416} 428}
417 429
diff --git a/src/Workspace.hh b/src/Workspace.hh
index 0c2b1cb..18db91c 100644
--- a/src/Workspace.hh
+++ b/src/Workspace.hh
@@ -44,10 +44,10 @@ public:
44 typedef std::vector<FluxboxWindow *> Windows; 44 typedef std::vector<FluxboxWindow *> Windows;
45 typedef std::vector<Window> Stack; 45 typedef std::vector<Window> Stack;
46 46
47 Workspace(BScreen *screen, unsigned int workspaceid = 0); 47 explicit Workspace(BScreen *screen, unsigned int workspaceid = 0);
48 ~Workspace(); 48 ~Workspace();
49 49
50 inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } 50 void setLastFocusedWindow(FluxboxWindow *w);
51 /** 51 /**
52 Set workspace name 52 Set workspace name
53 */ 53 */