From 551a17d2563679eb6ef7c650f1384ee7e48dbc29 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 20 Aug 2002 15:38:51 +0000 Subject: 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. --- src/Screen.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/Screen.cc') 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(); } -- cgit v1.2.3