From a8f39f0d7a97dc1a4438b7df3a667895fb23604d Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 4 Dec 2003 00:08:55 +0000 Subject: fixed send to bug --- src/Screen.cc | 36 +++++++++++++++++++++--------------- src/SendToMenu.cc | 15 +++++++++++---- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 36cc4f2..2b18447 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.242 2003/12/03 23:08:48 fluxgen Exp $ +// $Id: Screen.cc,v 1.243 2003/12/04 00:08:05 fluxgen Exp $ #include "Screen.hh" @@ -866,8 +866,9 @@ void BScreen::changeWorkspaceID(unsigned int id) { void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS) { - if (! m_current_workspace || id >= m_workspaces_list.size()) + if (! m_current_workspace || id >= m_workspaces_list.size()) { return; + } if (!win) { WinClient *client = Fluxbox::instance()->getFocusedWindow(); @@ -875,28 +876,33 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS win = client->fbwindow(); } - if (id != currentWorkspace()->workspaceID()) { - XSync(FbTk::App::instance()->display(), True); - if (win && &win->screen() == this && - (! win->isStuck())) { + XSync(FbTk::App::instance()->display(), True); - if (win->isIconic()) { - win->deiconify(); - } + if (win && &win->screen() == this && + (! win->isStuck())) { + + if (win->isIconic()) { + win->deiconify(); + } + if (id != currentWorkspace()->workspaceID()) win->withdraw(); - reassociateWindow(win, id, true); + + + reassociateWindow(win, id, true); - // change workspace ? - if (changeWS) { - changeWorkspaceID(id); - win->setInputFocus(); - } + if (id == currentWorkspace()->workspaceID()) + win->deiconify(false, false); + // change workspace ? + if (changeWS && id != currentWorkspace()->workspaceID()) { + changeWorkspaceID(id); + win->setInputFocus(); } } + } diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc index a64e594..4c154af 100644 --- a/src/SendToMenu.cc +++ b/src/SendToMenu.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: SendToMenu.cc,v 1.3 2003/11/28 13:39:41 fluxgen Exp $ +// $Id: SendToMenu.cc,v 1.4 2003/12/04 00:08:55 fluxgen Exp $ #include "SendToMenu.hh" @@ -53,9 +53,11 @@ SendToMenu::SendToMenu(FluxboxWindow &win): // workspace count signal // workspace names signal // current workspace signal + // and window's workspace sig win.screen().workspaceCountSig().attach(this); win.screen().workspaceNamesSig().attach(this); win.screen().currentWorkspaceSig().attach(this); + win.workspaceSig().attach(this); disableTitle(); // build menu @@ -64,13 +66,15 @@ SendToMenu::SendToMenu(FluxboxWindow &win): void SendToMenu::update(FbTk::Subject *subj) { // if workspace changed we enable all workspaces except the current one - if (subj != 0 && subj == &(m_win.screen().currentWorkspaceSig())) { + if (subj != 0 && (subj == &(m_win.screen().currentWorkspaceSig()) || + subj == &(m_win.workspaceSig()))) { // enabled all workspaces const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList(); for (size_t i = 0; i < wlist.size(); ++i) setItemEnabled(i, true); - // disable current workspace - setItemEnabled(m_win.screen().currentWorkspaceID(), false); + // disable send to on the workspace which the window exist + setItemEnabled(m_win.workspaceNumber(), false); + FbMenu::update(); // we're done return; } @@ -83,7 +87,10 @@ void SendToMenu::update(FbTk::Subject *subj) { for (size_t i = 0; i < wlist.size(); ++i) { FbTk::RefCount sendto_cmd(new SendToCmd(m_win, i)); insert(wlist[i]->name().c_str(), sendto_cmd); + } + setItemEnabled(m_win.workspaceNumber(), false); + FbMenu::update(); } -- cgit v0.11.2