summaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-05-23 14:27:52 +0000
committerDana Jansens <danakj@orodu.net>2002-05-23 14:27:52 +0000
commit67b4df1eff614c79bca956615a514bb5bb211af8 (patch)
tree56f72fe3bed7251558ab8bff0961acb10cecffbc /src/Workspace.cc
parenta25b213aff1ec7450b5d61c20cf3c8e0f918ee28 (diff)
merge the sticky window fix from 1.2.
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index dc7007ee..47ad3827 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -106,12 +106,21 @@ int Workspace::addWindow(OpenboxWindow *w, bool place) {
int Workspace::removeWindow(OpenboxWindow *w) {
if (! w) return -1;
- _zorder.remove(w);
+ winVect::iterator winit = std::find(_windows.begin(), _windows.end(), w);
- if (w->isFocused()) {
+ if (winit == _windows.end()) {
if (w == _last)
_last = (OpenboxWindow *) 0;
+ if (w == _focused)
+ _focused = (OpenboxWindow *) 0;
+ return _windows.size();
+ }
+
+ _zorder.remove(w);
+ if (w == _last)
+ _last = (OpenboxWindow *) 0;
+ if (w == _focused) {
OpenboxWindow *fw = (OpenboxWindow *) 0;
if (w->isTransient() && w->getTransientFor() &&
w->getTransientFor()->isVisible())
@@ -124,8 +133,8 @@ int Workspace::removeWindow(OpenboxWindow *w) {
if (!(fw != (OpenboxWindow *) 0 && fw->setInputFocus()))
screen.getOpenbox().focusWindow(0);
}
-
- _windows.erase(_windows.begin() + w->getWindowNumber());
+
+ _windows.erase(winit);
clientmenu->remove(w->getWindowNumber());
clientmenu->update();
@@ -140,11 +149,13 @@ int Workspace::removeWindow(OpenboxWindow *w) {
void Workspace::focusWindow(OpenboxWindow *win) {
- if (win != (OpenboxWindow *) 0)
- clientmenu->setItemSelected(win->getWindowNumber(), true);
if (_focused != (OpenboxWindow *) 0)
clientmenu->setItemSelected(_focused->getWindowNumber(), false);
_focused = win;
+ // make sure the focused window belongs to this workspace before highlighting
+ // it in the menu (sticky windows arent in this workspace's menu).
+ if (_focused != (OpenboxWindow *) 0 && _focused->getWorkspaceNumber() == id)
+ clientmenu->setItemSelected(_focused->getWindowNumber(), true);
if (win != (OpenboxWindow *) 0)
_last = win;
}