fixed send to bug

This commit is contained in:
fluxgen 2003-12-04 00:08:55 +00:00
parent f7fc364a4c
commit a8f39f0d7a
2 changed files with 33 additions and 20 deletions

View file

@ -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);
// change workspace ?
if (changeWS) {
changeWorkspaceID(id);
win->setInputFocus();
}
reassociateWindow(win, id, true);
if (id == currentWorkspace()->workspaceID())
win->deiconify(false, false);
// change workspace ?
if (changeWS && id != currentWorkspace()->workspaceID()) {
changeWorkspaceID(id);
win->setInputFocus();
}
}
}

View file

@ -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<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i));
insert(wlist[i]->name().c_str(), sendto_cmd);
}
setItemEnabled(m_win.workspaceNumber(), false);
FbMenu::update();
}