summaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 8862263..a98f970 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -19,8 +19,9 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// stupid macros needed to access some functions in version 2 of the GNU C 22// $Id: Workspace.cc,v 1.6 2002/01/20 02:08:12 fluxgen Exp $
23// library 23
24// use GNU extensions
24#ifndef _GNU_SOURCE 25#ifndef _GNU_SOURCE
25#define _GNU_SOURCE 26#define _GNU_SOURCE
26#endif // _GNU_SOURCE 27#endif // _GNU_SOURCE
@@ -29,9 +30,6 @@
29# include "../config.h" 30# include "../config.h"
30#endif // HAVE_CONFIG_H 31#endif // HAVE_CONFIG_H
31 32
32#include <X11/Xlib.h>
33#include <X11/Xatom.h>
34
35#include "i18n.hh" 33#include "i18n.hh"
36#include "fluxbox.hh" 34#include "fluxbox.hh"
37#include "Clientmenu.hh" 35#include "Clientmenu.hh"
@@ -50,7 +48,15 @@
50# include <string.h> 48# include <string.h>
51#endif // STDC_HEADERS 49#endif // STDC_HEADERS
52 50
53Workspace::Workspace(BScreen *scrn, int i) { 51#include <X11/Xlib.h>
52#include <X11/Xatom.h>
53
54Workspace::Workspace(BScreen *scrn, int i):
55screen(scrn),
56lastfocus(0),
57name(""),
58cascade_x(32), cascade_y(32)
59{
54 screen = scrn; 60 screen = scrn;
55 61
56 cascade_x = cascade_y = 32; 62 cascade_x = cascade_y = 32;
@@ -61,10 +67,7 @@ Workspace::Workspace(BScreen *scrn, int i) {
61 windowList = new LinkedList<FluxboxWindow>; 67 windowList = new LinkedList<FluxboxWindow>;
62 clientmenu = new Clientmenu(this); 68 clientmenu = new Clientmenu(this);
63 69
64 lastfocus = (FluxboxWindow *) 0;
65
66 char *tmp; 70 char *tmp;
67 name = (char *) 0;
68 screen->getNameOfWorkspace(id, &tmp); 71 screen->getNameOfWorkspace(id, &tmp);
69 setName(tmp); 72 setName(tmp);
70 73
@@ -73,20 +76,19 @@ Workspace::Workspace(BScreen *scrn, int i) {
73} 76}
74 77
75 78
76Workspace::~Workspace(void) { 79Workspace::~Workspace() {
77 delete stackingList; 80 delete stackingList;
78 delete windowList; 81 delete windowList;
79 delete clientmenu; 82 delete clientmenu;
80
81 if (name)
82 delete [] name;
83} 83}
84 84
85 85
86const int Workspace::addWindow(FluxboxWindow *w, Bool place) { 86const int Workspace::addWindow(FluxboxWindow *w, Bool place) {
87 if (! w) return -1; 87 if (! w)
88 return -1;
88 89
89 if (place) placeWindow(w); 90 if (place)
91 placeWindow(w);
90 92
91 w->setWorkspace(id); 93 w->setWorkspace(id);
92 w->setWindowNumber(windowList->count()); 94 w->setWindowNumber(windowList->count());
@@ -123,8 +125,8 @@ const int Workspace::removeWindow(FluxboxWindow *w) {
123 if (! top || ! top->setInputFocus()) { 125 if (! top || ! top->setInputFocus()) {
124 Fluxbox::instance()->setFocusedWindow((FluxboxWindow *) 0); 126 Fluxbox::instance()->setFocusedWindow((FluxboxWindow *) 0);
125 XSetInputFocus(Fluxbox::instance()->getXDisplay(), 127 XSetInputFocus(Fluxbox::instance()->getXDisplay(),
126 screen->getToolbar()->getWindowID(), 128 screen->getToolbar()->getWindowID(),
127 RevertToParent, CurrentTime); 129 RevertToParent, CurrentTime);
128 } 130 }
129 } 131 }
130 } 132 }
@@ -302,14 +304,12 @@ void Workspace::setCurrent(void) {
302 304
303 305
304void Workspace::setName(char *new_name) { 306void Workspace::setName(char *new_name) {
305 if (name)
306 delete [] name;
307 307
308 if (new_name) { 308 if (new_name) {
309 name = StringUtil::strdup(new_name); 309 name = new_name;
310 } else { 310 } else {
311 name = new char[128]; 311 char tname[128];
312 sprintf(name, I18n::instance()-> 312 sprintf(tname, I18n::instance()->
313 getMessage( 313 getMessage(
314#ifdef NLS 314#ifdef NLS
315 WorkspaceSet, WorkspaceDefaultNameFormat, 315 WorkspaceSet, WorkspaceDefaultNameFormat,
@@ -317,11 +317,12 @@ void Workspace::setName(char *new_name) {
317 0, 0, 317 0, 0,
318#endif // NLS 318#endif // NLS
319 "Workspace %d"), id + 1); 319 "Workspace %d"), id + 1);
320 name = tname;
320 } 321 }
321 322
322 screen->updateWorkspaceNamesAtom(); 323 screen->updateWorkspaceNamesAtom();
323 324
324 clientmenu->setLabel(name); 325 clientmenu->setLabel(name.c_str());
325 clientmenu->update(); 326 clientmenu->update();
326} 327}
327 328