summaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-08-20 15:38:51 +0000
committerDana Jansens <danakj@orodu.net>2002-08-20 15:38:51 +0000
commit551a17d2563679eb6ef7c650f1384ee7e48dbc29 (patch)
tree0375e12f30ae6a5530df2aae74fd27b38f502554 /src/Screen.cc
parent2d114880692ce90eb5c8acdc1d07d2098cc3f1fc (diff)
Fix send to menu, having deleted workspaces in it.
Fix workspace warping, move the mouse and window the same amount. Fix workspace switching. Put old code back that worked better.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index d49e418a..31811fe6 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1186,20 +1186,38 @@ unsigned int BScreen::removeLastWorkspace(void) {
void BScreen::changeWorkspaceID(unsigned int id) {
if (! current_workspace || id == current_workspace->getID()) return;
- current_workspace->hide();
+ BlackboxWindow *focused = blackbox->getFocusedWindow();
+ if (focused && focused->getScreen() == this) {
+ assert(focused->isStuck() ||
+ focused->getWorkspaceNumber() == current_workspace->getID());
+
+ current_workspace->setLastFocusedWindow(focused);
+ } else {
+ // if no window had focus, no need to store a last focus
+ current_workspace->setLastFocusedWindow((BlackboxWindow *) 0);
+ }
+
+ // when we switch workspaces, unfocus whatever was focused
+ blackbox->setFocusedWindow((BlackboxWindow *) 0);
+ current_workspace->hideAll();
workspacemenu->setItemSelected(current_workspace->getID() + 2, False);
current_workspace = getWorkspace(id);
- current_workspace->show();
-
xatom->setValue(getRootWindow(), XAtom::net_current_desktop,
XAtom::cardinal, id);
workspacemenu->setItemSelected(current_workspace->getID() + 2, True);
toolbar->redrawWorkspaceLabel(True);
+ current_workspace->showAll();
+
+ if (resource.focus_last && current_workspace->getLastFocusedWindow()) {
+ XSync(blackbox->getXDisplay(), False);
+ current_workspace->getLastFocusedWindow()->setInputFocus();
+ }
+
updateNetizenCurrentWorkspace();
}