aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-14 01:10:39 (GMT)
committerfluxgen <fluxgen>2003-12-14 01:10:39 (GMT)
commitbaeacf877fd4d9136a2cbc86b4c8f679727fd4b4 (patch)
tree78a8e85c89d05c2cf6369f95580f1bc0ee85de9b /src/Workspace.cc
parent49c13b9e03b97f5524acbf2b3b2a8d45ccaee8db (diff)
downloadfluxbox-baeacf877fd4d9136a2cbc86b4c8f679727fd4b4.zip
fluxbox-baeacf877fd4d9136a2cbc86b4c8f679727fd4b4.tar.bz2
no need to have Workspace instance in ClientMenuItem since it already hold the window which has workspace num
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 069c3e2..d2ebf60 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.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: Workspace.cc,v 1.86 2003/12/10 23:08:03 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.87 2003/12/14 01:10:39 fluxgen Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -35,7 +35,6 @@
35#include "MenuItem.hh" 35#include "MenuItem.hh"
36 36
37#include "FbTk/StringUtil.hh" 37#include "FbTk/StringUtil.hh"
38#include "FbTk/SimpleCommand.hh"
39 38
40// use GNU extensions 39// use GNU extensions
41#ifndef _GNU_SOURCE 40#ifndef _GNU_SOURCE
@@ -75,24 +74,17 @@ int countTransients(const WinClient &client) {
75 74
76class ClientMenuItem:public FbTk::MenuItem { 75class ClientMenuItem:public FbTk::MenuItem {
77public: 76public:
78 ClientMenuItem(WinClient &client, Workspace &space): 77 ClientMenuItem(WinClient &client):
79 FbTk::MenuItem(client.title().c_str(), client.fbwindow() ? &client.fbwindow()->menu() : 0), 78 FbTk::MenuItem(client.title().c_str(), client.fbwindow() ? &client.fbwindow()->menu() : 0),
80 m_client(client), m_space(space) { 79 m_client(client) {
81 80
82 } 81 }
83 void click(int button, int time) { 82 void click(int button, int time) {
84 if (m_client.fbwindow() == 0) 83 if (m_client.fbwindow() == 0)
85 return; 84 return;
86 FluxboxWindow &win = *m_client.fbwindow(); 85 FluxboxWindow &win = *m_client.fbwindow();
87 BScreen &scr = win.screen();
88 // determine workspace change
89 for (size_t i=0; i<scr.getCount(); i++) {
90 if (scr.getWorkspace(i) == &m_space) {
91 scr.changeWorkspaceID(i);
92 break;
93 }
94 }
95 86
87 win.screen().changeWorkspaceID(win.workspaceNumber());
96 win.setCurrentClient(m_client); 88 win.setCurrentClient(m_client);
97 win.raiseAndFocus(); 89 win.raiseAndFocus();
98 } 90 }
@@ -108,7 +100,6 @@ public:
108 } 100 }
109private: 101private:
110 WinClient &m_client; 102 WinClient &m_client;
111 Workspace &m_space;
112}; 103};
113 104
114}; 105};
@@ -116,14 +107,14 @@ private:
116Workspace::GroupList Workspace::m_groups; 107Workspace::GroupList Workspace::m_groups;
117 108
118Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, 109Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager,
119 const std::string &name, unsigned int i): 110 const std::string &name, unsigned int id):
120 m_screen(scrn), 111 m_screen(scrn),
121 m_lastfocus(0), 112 m_lastfocus(0),
122 m_clientmenu(*scrn.menuTheme(), scrn.imageControl(), 113 m_clientmenu(*scrn.menuTheme(), scrn.imageControl(),
123 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), 114 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
124 m_layermanager(layermanager), 115 m_layermanager(layermanager),
125 m_name(name), 116 m_name(name),
126 m_id(i) { 117 m_id(id) {
127 118
128 119
129 m_cascade_x = new int[scrn.numHeads() + 1]; 120 m_cascade_x = new int[scrn.numHeads() + 1];
@@ -420,7 +411,7 @@ void Workspace::updateClientmenu() {
420 FluxboxWindow::ClientList::iterator client_it_end = 411 FluxboxWindow::ClientList::iterator client_it_end =
421 (*win_it)->clientList().end(); 412 (*win_it)->clientList().end();
422 for (; client_it != client_it_end; ++client_it) 413 for (; client_it != client_it_end; ++client_it)
423 m_clientmenu.insert(new ClientMenuItem(*(*client_it), *this)); 414 m_clientmenu.insert(new ClientMenuItem(*(*client_it)));
424 } 415 }
425 416
426 m_clientmenu.update(); 417 m_clientmenu.update();