aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 3f57e37..57d3a74 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.18 2002/04/09 23:18:12 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.19 2002/05/07 13:57:09 fluxgen Exp $
26 26
27// use GNU extensions 27// use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -43,13 +43,8 @@
43#include "Windowmenu.hh" 43#include "Windowmenu.hh"
44#include "StringUtil.hh" 44#include "StringUtil.hh"
45 45
46#ifdef HAVE_STDIO_H 46#include <stdio.h>
47# include <stdio.h> 47#include <string.h>
48#endif // HAVE_STDIO_H
49
50#ifdef STDC_HEADERS
51# include <string.h>
52#endif // STDC_HEADERS
53 48
54#include <X11/Xlib.h> 49#include <X11/Xlib.h>
55#include <X11/Xatom.h> 50#include <X11/Xatom.h>
@@ -58,16 +53,16 @@
58#include <iostream> 53#include <iostream>
59using namespace std; 54using namespace std;
60 55
56
61Workspace::Workspace(BScreen *scrn, unsigned int i): 57Workspace::Workspace(BScreen *scrn, unsigned int i):
62screen(scrn), 58screen(scrn),
63lastfocus(0), 59lastfocus(0),
60m_clientmenu(this),
64m_name(""), 61m_name(""),
65m_id(i), 62m_id(i),
66cascade_x(32), cascade_y(32) 63cascade_x(32), cascade_y(32)
67{ 64{
68 65
69 clientmenu = new Clientmenu(this);
70
71 char *tmp; 66 char *tmp;
72 screen->getNameOfWorkspace(m_id, &tmp); 67 screen->getNameOfWorkspace(m_id, &tmp);
73 setName(tmp); 68 setName(tmp);
@@ -78,7 +73,7 @@ cascade_x(32), cascade_y(32)
78 73
79 74
80Workspace::~Workspace() { 75Workspace::~Workspace() {
81 delete clientmenu; 76
82} 77}
83 78
84 79
@@ -96,23 +91,34 @@ const int Workspace::addWindow(FluxboxWindow *w, bool place) {
96 91
97 //insert window after the currently focused window 92 //insert window after the currently focused window
98 FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); 93 FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow();
94
99 //if there isn't any window that's focused, just add it to the end of the list 95 //if there isn't any window that's focused, just add it to the end of the list
100 if (focused == 0) { 96 if (focused == 0) {
101 windowList.push_back(w); 97 windowList.push_back(w);
98 //Add client to clientmenu
99 m_clientmenu.insert(w->getTitle().c_str());
102 } else { 100 } else {
103 Windows::iterator it = windowList.begin(); 101 Windows::iterator it = windowList.begin();
104 for (; it != windowList.end(); ++it) { 102 size_t client_insertpoint=0;
103 for (; it != windowList.end(); ++it, ++client_insertpoint) {
105 if (*it == focused) { 104 if (*it == focused) {
106 ++it; 105 ++it;
107 break; 106 break;
108 } 107 }
109 } 108 }
110 windowList.insert(it, w);
111 }
112 109
113 clientmenu->insert(w->getTitle().c_str()); 110 windowList.insert(it, w);
114 clientmenu->update(); 111 //Add client to clientmenu
112 m_clientmenu.insert(w->getTitle().c_str(), client_insertpoint);
113
115 114
115 }
116
117
118
119 //update menugraphics
120 m_clientmenu.update();
121
116 screen->updateNetizenWindowAdd(w->getClientWindow(), m_id); 122 screen->updateNetizenWindowAdd(w->getClientWindow(), m_id);
117 123
118 raiseWindow(w); 124 raiseWindow(w);
@@ -159,8 +165,8 @@ const int Workspace::removeWindow(FluxboxWindow *w) {
159 } 165 }
160 } 166 }
161 167
162 clientmenu->remove(w->getWindowNumber()); 168 m_clientmenu.remove(w->getWindowNumber());
163 clientmenu->update(); 169 m_clientmenu.update();
164 170
165 screen->updateNetizenWindowDel(w->getClientWindow()); 171 screen->updateNetizenWindowDel(w->getClientWindow());
166 172
@@ -294,7 +300,7 @@ void Workspace::lowerWindow(FluxboxWindow *w) {
294 300
295 301
296void Workspace::reconfigure(void) { 302void Workspace::reconfigure(void) {
297 clientmenu->reconfigure(); 303 m_clientmenu.reconfigure();
298 304
299 Windows::iterator it = windowList.begin(); 305 Windows::iterator it = windowList.begin();
300 Windows::iterator it_end = windowList.end(); 306 Windows::iterator it_end = windowList.end();
@@ -305,10 +311,15 @@ void Workspace::reconfigure(void) {
305} 311}
306 312
307 313
308FluxboxWindow *Workspace::getWindow(unsigned int index) const{ 314const FluxboxWindow *Workspace::getWindow(unsigned int index) const {
309 if (index < windowList.size()) 315 if (index < windowList.size())
310 return windowList[index]; 316 return windowList[index];
317 return 0;
318}
311 319
320FluxboxWindow *Workspace::getWindow(unsigned int index) {
321 if (index < windowList.size())
322 return windowList[index];
312 return 0; 323 return 0;
313} 324}
314 325
@@ -319,7 +330,7 @@ const int Workspace::getCount(void) const {
319 330
320 331
321void Workspace::update(void) { 332void Workspace::update(void) {
322 clientmenu->update(); 333 m_clientmenu.update();
323 screen->getToolbar()->redrawWindowLabel(True); 334 screen->getToolbar()->redrawWindowLabel(True);
324} 335}
325 336
@@ -353,8 +364,8 @@ void Workspace::setName(const char *name) {
353 364
354 screen->updateWorkspaceNamesAtom(); 365 screen->updateWorkspaceNamesAtom();
355 366
356 clientmenu->setLabel(m_name.c_str()); 367 m_clientmenu.setLabel(m_name.c_str());
357 clientmenu->update(); 368 m_clientmenu.update();
358} 369}
359 370
360//------------ shutdown --------- 371//------------ shutdown ---------