From d86785056d5f8d69cf1b0a6a0142fa7b5a3b0aba Mon Sep 17 00:00:00 2001 From: fluxgen Date: Fri, 30 Aug 2002 14:03:31 +0000 Subject: new function reassociateGroup and check moving window --- src/Screen.cc | 39 ++++++++++++++++++++++++++++++--------- src/Screen.hh | 8 ++++++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 39b15b8..60c8a63 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.64 2002/08/24 18:12:54 fluxgen Exp $ +// $Id: Screen.cc,v 1.65 2002/08/30 14:03:31 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -794,16 +794,20 @@ void BScreen::changeWorkspaceID(unsigned int id) { if (id != current_workspace->workspaceID()) { XSync(fluxbox->getXDisplay(), true); - + FluxboxWindow *focused = fluxbox->getFocusedWindow(); + + if (focused && focused->isMoving()) { + reassociateGroup(focused, id, true); + focused->pauseMoving(); + } + current_workspace->hideAll(); workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false); - if (fluxbox->getFocusedWindow() && - fluxbox->getFocusedWindow()->getScreen() == this && - (! fluxbox->getFocusedWindow()->isStuck())) { - - current_workspace->setLastFocusedWindow(fluxbox->getFocusedWindow()); + if (focused && focused->getScreen() == this && + (! focused->isStuck()) && (!focused->isMoving())) { + current_workspace->setLastFocusedWindow(focused); fluxbox->setFocusedWindow((FluxboxWindow *) 0); } @@ -815,9 +819,14 @@ void BScreen::changeWorkspaceID(unsigned int id) { current_workspace->showAll(); - if (*resource.focus_last && current_workspace->getLastFocusedWindow()) + if (*resource.focus_last && current_workspace->getLastFocusedWindow() && + !(focused && focused->isMoving())) { current_workspace->getLastFocusedWindow()->setInputFocus(); - + } + + if (focused && focused->isMoving()) { + focused->resumeMoving(); + } } updateNetizenCurrentWorkspace(); @@ -1091,6 +1100,18 @@ string BScreen::getNameOfWorkspace(unsigned int workspace) const { } +void BScreen::reassociateGroup(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { + if (w->hasTab() && (w->getTab()->next() || w->getTab()->prev())) { + Tab *tab_it = w->getTab()->first(); + for (; tab_it; tab_it = tab_it->next()) { + reassociateWindow(tab_it->getWindow(), wkspc_id, ignore_sticky); + } + } else { + // no tab, juts move this one + reassociateWindow(w, wkspc_id, ignore_sticky); + } +} + void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { if (! w) return; diff --git a/src/Screen.hh b/src/Screen.hh index b85a1b4..967804e 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.42 2002/08/11 22:11:42 fluxgen Exp $ +// $Id: Screen.hh,v 1.43 2002/08/30 14:03:31 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -126,11 +126,14 @@ public: inline unsigned int getCurrentWorkspaceID() const { return current_workspace->workspaceID(); } typedef std::vector Icons; + + /// @return number of workspaces inline unsigned int getCount() const { return workspacesList.size(); } + /// @return number of icons inline unsigned int getIconCount() const { return iconList.size(); } inline const Icons &getIconList() const { return iconList; } inline Icons &getIconList() { return iconList; } - + /// @return the resource value of number of workspace inline int getNumberOfWorkspaces() const { return *resource.workspaces; } inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; } #ifdef XINERAMA @@ -219,6 +222,7 @@ public: void changeWorkspaceID(unsigned int); void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true); void raiseWindows(Window *workspace_stack, int num); + void reassociateGroup(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void prevFocus(int = 0); void nextFocus(int = 0); -- cgit v0.11.2