aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc36
-rw-r--r--src/SendToMenu.cc15
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 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.242 2003/12/03 23:08:48 fluxgen Exp $ 25// $Id: Screen.cc,v 1.243 2003/12/04 00:08:05 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -866,8 +866,9 @@ void BScreen::changeWorkspaceID(unsigned int id) {
866 866
867 867
868void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS) { 868void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS) {
869 if (! m_current_workspace || id >= m_workspaces_list.size()) 869 if (! m_current_workspace || id >= m_workspaces_list.size()) {
870 return; 870 return;
871 }
871 872
872 if (!win) { 873 if (!win) {
873 WinClient *client = Fluxbox::instance()->getFocusedWindow(); 874 WinClient *client = Fluxbox::instance()->getFocusedWindow();
@@ -875,28 +876,33 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
875 win = client->fbwindow(); 876 win = client->fbwindow();
876 } 877 }
877 878
878 if (id != currentWorkspace()->workspaceID()) {
879 XSync(FbTk::App::instance()->display(), True);
880 879
881 if (win && &win->screen() == this && 880 XSync(FbTk::App::instance()->display(), True);
882 (! win->isStuck())) {
883 881
884 if (win->isIconic()) { 882 if (win && &win->screen() == this &&
885 win->deiconify(); 883 (! win->isStuck())) {
886 } 884
885 if (win->isIconic()) {
886 win->deiconify();
887 }
887 888
889 if (id != currentWorkspace()->workspaceID())
888 win->withdraw(); 890 win->withdraw();
889 reassociateWindow(win, id, true); 891
892
893 reassociateWindow(win, id, true);
890 894
891 // change workspace ? 895 if (id == currentWorkspace()->workspaceID())
892 if (changeWS) { 896 win->deiconify(false, false);
893 changeWorkspaceID(id);
894 win->setInputFocus();
895 }
896 897
898 // change workspace ?
899 if (changeWS && id != currentWorkspace()->workspaceID()) {
900 changeWorkspaceID(id);
901 win->setInputFocus();
897 } 902 }
898 903
899 } 904 }
905
900} 906}
901 907
902 908
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 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: SendToMenu.cc,v 1.3 2003/11/28 13:39:41 fluxgen Exp $ 23// $Id: SendToMenu.cc,v 1.4 2003/12/04 00:08:55 fluxgen Exp $
24 24
25#include "SendToMenu.hh" 25#include "SendToMenu.hh"
26 26
@@ -53,9 +53,11 @@ SendToMenu::SendToMenu(FluxboxWindow &win):
53 // workspace count signal 53 // workspace count signal
54 // workspace names signal 54 // workspace names signal
55 // current workspace signal 55 // current workspace signal
56 // and window's workspace sig
56 win.screen().workspaceCountSig().attach(this); 57 win.screen().workspaceCountSig().attach(this);
57 win.screen().workspaceNamesSig().attach(this); 58 win.screen().workspaceNamesSig().attach(this);
58 win.screen().currentWorkspaceSig().attach(this); 59 win.screen().currentWorkspaceSig().attach(this);
60 win.workspaceSig().attach(this);
59 61
60 disableTitle(); 62 disableTitle();
61 // build menu 63 // build menu
@@ -64,13 +66,15 @@ SendToMenu::SendToMenu(FluxboxWindow &win):
64 66
65void SendToMenu::update(FbTk::Subject *subj) { 67void SendToMenu::update(FbTk::Subject *subj) {
66 // if workspace changed we enable all workspaces except the current one 68 // if workspace changed we enable all workspaces except the current one
67 if (subj != 0 && subj == &(m_win.screen().currentWorkspaceSig())) { 69 if (subj != 0 && (subj == &(m_win.screen().currentWorkspaceSig()) ||
70 subj == &(m_win.workspaceSig()))) {
68 // enabled all workspaces 71 // enabled all workspaces
69 const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList(); 72 const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList();
70 for (size_t i = 0; i < wlist.size(); ++i) 73 for (size_t i = 0; i < wlist.size(); ++i)
71 setItemEnabled(i, true); 74 setItemEnabled(i, true);
72 // disable current workspace 75 // disable send to on the workspace which the window exist
73 setItemEnabled(m_win.screen().currentWorkspaceID(), false); 76 setItemEnabled(m_win.workspaceNumber(), false);
77 FbMenu::update();
74 // we're done 78 // we're done
75 return; 79 return;
76 } 80 }
@@ -83,7 +87,10 @@ void SendToMenu::update(FbTk::Subject *subj) {
83 for (size_t i = 0; i < wlist.size(); ++i) { 87 for (size_t i = 0; i < wlist.size(); ++i) {
84 FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i)); 88 FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i));
85 insert(wlist[i]->name().c_str(), sendto_cmd); 89 insert(wlist[i]->name().c_str(), sendto_cmd);
90
86 } 91 }
87 92
93 setItemEnabled(m_win.workspaceNumber(), false);
94
88 FbMenu::update(); 95 FbMenu::update();
89} 96}