fixed check in setLastFocusedWindow

This commit is contained in:
fluxgen 2002-09-21 16:02:22 +00:00
parent b4022f90db
commit 18a09c1a7f
2 changed files with 20 additions and 8 deletions

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Workspace.cc,v 1.30 2002/09/12 14:55:11 rathnor Exp $
// $Id: Workspace.cc,v 1.31 2002/09/21 16:02:22 fluxgen Exp $
#include "Workspace.hh"
@ -91,6 +91,13 @@ Workspace::~Workspace() {
}
void Workspace::setLastFocusedWindow(FluxboxWindow *win) {
// make sure we have this window in the list
if (std::find(windowList.begin(), windowList.end(), win) != windowList.end())
lastfocus = win;
else
lastfocus = 0;
}
int Workspace::addWindow(FluxboxWindow *w, bool place) {
if (w == 0)
@ -150,6 +157,10 @@ int Workspace::removeWindow(FluxboxWindow *w) {
if (w == 0)
return -1;
if (lastfocus == w) {
lastfocus = 0;
}
stackingList.remove(w);
if (w->isFocused()) {
@ -177,10 +188,8 @@ int Workspace::removeWindow(FluxboxWindow *w) {
}
}
if (lastfocus == w)
lastfocus = 0;
//could be faster?
Windows::iterator it = windowList.begin();
Windows::iterator it_end = windowList.end();
for (; it != it_end; ++it) {
@ -203,7 +212,10 @@ int Workspace::removeWindow(FluxboxWindow *w) {
(*it)->setWindowNumber(i);
}
}
if (lastfocus == w || windowList.empty())
lastfocus = 0;
return windowList.size();
}
@ -411,7 +423,7 @@ bool Workspace::isLastWindow(FluxboxWindow *w) const{
return (w == windowList.back());
}
void Workspace::setCurrent(void) {
void Workspace::setCurrent() {
screen->changeWorkspaceID(m_id);
}

View file

@ -44,10 +44,10 @@ public:
typedef std::vector<FluxboxWindow *> Windows;
typedef std::vector<Window> Stack;
Workspace(BScreen *screen, unsigned int workspaceid = 0);
explicit Workspace(BScreen *screen, unsigned int workspaceid = 0);
~Workspace();
inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; }
void setLastFocusedWindow(FluxboxWindow *w);
/**
Set workspace name
*/