fixed send to bug
fluxgen fluxgen
2 files changed,
32 insertions(+),
19 deletions(-)
M
src/Screen.cc
→
src/Screen.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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::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 @@ if (client)
win = client->fbwindow(); } - if (id != currentWorkspace()->workspaceID()) { - XSync(FbTk::App::instance()->display(), True); + + XSync(FbTk::App::instance()->display(), True); - if (win && &win->screen() == this && - (! win->isStuck())) { + if (win && &win->screen() == this && + (! win->isStuck())) { - if (win->isIconic()) { - win->deiconify(); - } + 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(); } } + }
M
src/SendToMenu.cc
→
src/SendToMenu.cc
@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ // listen to:
// 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 @@ }
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 @@ const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList();
for (size_t i = 0; i < wlist.size(); ++i) { FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i)); insert(wlist[i]->name().c_str(), sendto_cmd); + } + + setItemEnabled(m_win.workspaceNumber(), false); FbMenu::update(); }