From 8d911dcbddc22bea0cf453c333a9b0d7b5f3e783 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 26 Feb 2002 22:25:53 +0000 Subject: added sendToWorkspace(int id, bool changeWS) --- src/Screen.cc | 49 +++++++++++++++++++++++++++++++++++++++++-------- src/Screen.hh | 4 +++- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index f942837..d5d8ebe 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.29 2002/02/21 12:03:40 fluxgen Exp $ +// $Id: Screen.cc,v 1.30 2002/02/26 22:25:20 fluxgen Exp $ // stupid macros needed to access some functions in version 2 of the GNU C // library @@ -815,6 +815,40 @@ void BScreen::changeWorkspaceID(int id) { updateNetizenCurrentWorkspace(); } +void BScreen::sendToWorkspace(int id) { + BScreen::sendToWorkspace(id, true); +} + +void BScreen::sendToWorkspace(int id, bool changeWS) { + FluxboxWindow *win; + if (! current_workspace || id >= workspacesList.size() || id < 0) + return; + + if (id != current_workspace->getWorkspaceID()) { + XSync(fluxbox->getXDisplay(), True); + + win = fluxbox->getFocusedWindow(); + + if (win && win->getScreen() == this && + (! win->isStuck())) { + + if ( win->getTab() ) { + Tab *tab = win->getTab(); + tab->disconnect(); + tab->setPosition(); + } + + win->withdraw(); + BScreen::reassociateWindow(win, id, True); + if (changeWS) { + BScreen::changeWorkspaceID(id); + win->setInputFocus(); + } + } + + } +} + void BScreen::addNetizen(Netizen *n) { netizenList.push_back(n); @@ -967,9 +1001,9 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) { void BScreen::raiseWindows(Window *workspace_stack, int num) { - Window session_stack[(num + workspacesList.size() + rootmenuList.size() + 30)]; - int i = 0; + Window session_stack[(num + workspacesList.size() + rootmenuList.size() + 30)]; + int i = 0; XRaiseWindow(getBaseDisplay()->getXDisplay(), iconmenu->getWindowID()); session_stack[i++] = iconmenu->getWindowID(); @@ -986,11 +1020,11 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) { session_stack[i++] = configmenu->getTabmenu()->getWindowID(); session_stack[i++] = configmenu->getWindowID(); -#ifdef SLIT + #ifdef SLIT session_stack[i++] = slit->getMenu()->getDirectionmenu()->getWindowID(); session_stack[i++] = slit->getMenu()->getPlacementmenu()->getWindowID(); session_stack[i++] = slit->getMenu()->getWindowID(); -#endif // SLIT + #endif // SLIT session_stack[i++] = toolbar->getMenu()->getPlacementmenu()->getWindowID(); @@ -1006,10 +1040,10 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) { if (toolbar->isOnTop()) session_stack[i++] = toolbar->getWindowID(); -#ifdef SLIT + #ifdef SLIT if (slit->isOnTop()) session_stack[i++] = slit->getWindowID(); -#endif // SLIT + #endif // SLIT int k=num; while (k--) @@ -1019,7 +1053,6 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) { } - #ifdef HAVE_STRFTIME void BScreen::saveStrftimeFormat(char *format) { if (resource.strftime_format) diff --git a/src/Screen.hh b/src/Screen.hh index 6df6ca0..d7634a5 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.20 2002/02/20 23:04:35 fluxgen Exp $ +// $Id: Screen.hh,v 1.21 2002/02/26 22:25:53 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -199,6 +199,8 @@ public: void removeIcon(FluxboxWindow *); void getNameOfWorkspace(int, char **); void changeWorkspaceID(int); + void sendToWorkspace(int); + void sendToWorkspace(int, bool); void raiseWindows(Window *, int); void reassociateWindow(FluxboxWindow *, int, Bool); void prevFocus(void); -- cgit v0.11.2