aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SendToMenu.cc20
-rw-r--r--src/Workspace.cc12
2 files changed, 23 insertions, 9 deletions
diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc
index fee4c4d..c039f16 100644
--- a/src/SendToMenu.cc
+++ b/src/SendToMenu.cc
@@ -29,19 +29,22 @@
29#include "fluxbox.hh" 29#include "fluxbox.hh"
30#include "Workspace.hh" 30#include "Workspace.hh"
31 31
32#include "FbTk/MultiButtonMenuItem.hh"
32#include "FbTk/Command.hh" 33#include "FbTk/Command.hh"
33 34
34class SendToCmd: public FbTk::Command { 35class SendToCmd: public FbTk::Command {
35public: 36public:
36 SendToCmd(FluxboxWindow &win, int workspace): 37 SendToCmd(FluxboxWindow &win, int workspace, bool follow):
37 m_win(win), 38 m_win(win),
38 m_workspace(workspace) { } 39 m_workspace(workspace),
40 m_follow(follow) { }
39 void execute() { 41 void execute() {
40 m_win.screen().sendToWorkspace(m_workspace, &m_win, false); 42 m_win.screen().sendToWorkspace(m_workspace, &m_win, m_follow);
41 } 43 }
42private: 44private:
43 FluxboxWindow &m_win; 45 FluxboxWindow &m_win;
44 const int m_workspace; 46 const int m_workspace;
47 const bool m_follow;
45}; 48};
46 49
47SendToMenu::SendToMenu(FluxboxWindow &win): 50SendToMenu::SendToMenu(FluxboxWindow &win):
@@ -91,9 +94,14 @@ void SendToMenu::update(FbTk::Subject *subj) {
91 94
92 const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList(); 95 const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList();
93 for (size_t i = 0; i < wlist.size(); ++i) { 96 for (size_t i = 0; i < wlist.size(); ++i) {
94 FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i)); 97 FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i, false));
95 insert(wlist[i]->name().c_str(), sendto_cmd); 98 FbTk::RefCount<FbTk::Command> sendto_follow_cmd(new SendToCmd(m_win, i, true));
96 99
100 FbTk::MultiButtonMenuItem* item = new FbTk::MultiButtonMenuItem(3, wlist[i]->name().c_str());
101 item->setCommand(1, sendto_cmd);
102 item->setCommand(2, sendto_follow_cmd);
103 item->setCommand(3, sendto_cmd);
104 insert(item);
97 } 105 }
98 106
99 setItemEnabled(m_win.workspaceNumber(), false); 107 setItemEnabled(m_win.workspaceNumber(), false);
diff --git a/src/Workspace.cc b/src/Workspace.cc
index bf914fc..4985c39 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -92,9 +92,15 @@ public:
92 return; 92 return;
93 FluxboxWindow &win = *m_client.fbwindow(); 93 FluxboxWindow &win = *m_client.fbwindow();
94 94
95 win.screen().changeWorkspaceID(win.workspaceNumber()); 95 // fetch the window to the current workspace
96 win.setCurrentClient(m_client); 96 if (button == 2 && win.screen().currentWorkspaceID() != win.workspaceNumber()) {
97 win.raiseAndFocus(); 97 win.menu().hide();
98 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win, true);
99 } else { // warp to the workspace of the window
100 win.screen().changeWorkspaceID(win.workspaceNumber());
101 win.setCurrentClient(m_client);
102 win.raiseAndFocus();
103 }
98 } 104 }
99 105
100 const std::string &label() const { return m_client.title(); } 106 const std::string &label() const { return m_client.title(); }