aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-05-07 13:57:09 (GMT)
committerfluxgen <fluxgen>2002-05-07 13:57:09 (GMT)
commit0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41 (patch)
tree71178439eac65c7b690d217f5caafaa901168df5 /src
parent9caf24483d1ee8ea0a7a83ab65a2950af01c6765 (diff)
downloadfluxbox_pavel-0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41.zip
fluxbox_pavel-0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41.tar.bz2
changed clientmenu to regular
Diffstat (limited to 'src')
-rw-r--r--src/Workspace.cc59
-rw-r--r--src/Workspace.hh57
2 files changed, 64 insertions, 52 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 ---------
diff --git a/src/Workspace.hh b/src/Workspace.hh
index 5e4507b..fa7f245 100644
--- a/src/Workspace.hh
+++ b/src/Workspace.hh
@@ -25,7 +25,9 @@
25#ifndef WORKSPACE_HH 25#ifndef WORKSPACE_HH
26#define WORKSPACE_HH 26#define WORKSPACE_HH
27 27
28#include "Clientmenu.hh"
28#include "Window.hh" 29#include "Window.hh"
30#include "NotCopyable.hh"
29 31
30#include <X11/Xlib.h> 32#include <X11/Xlib.h>
31#include <string> 33#include <string>
@@ -33,46 +35,49 @@
33#include <list> 35#include <list>
34 36
35class BScreen; 37class BScreen;
36class Clientmenu;
37class Workspace;
38 38
39 39
40 40class Workspace:private NotCopyable {
41class Workspace {
42public: 41public:
43 typedef std::vector<FluxboxWindow *> Windows; 42 typedef std::vector<FluxboxWindow *> Windows;
44 43
45 Workspace(BScreen *screen, unsigned int workspaceid= 0); 44 Workspace(BScreen *screen, unsigned int workspaceid= 0);
46 ~Workspace(void); 45 ~Workspace();
47
48 inline BScreen *getScreen(void) const { return screen; }
49 inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; }
50 inline Clientmenu *menu(void) const { return clientmenu; }
51 inline const std::string &name(void) const { return m_name; }
52 inline const unsigned int workspaceID(void) const { return m_id; }
53 inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } 46 inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; }
54 FluxboxWindow *getWindow(unsigned int id) const;
55 inline Windows &getWindowList() { return windowList; }
56 bool isCurrent(void) const;
57 bool isLastWindow(FluxboxWindow *window) const;
58 const int addWindow(FluxboxWindow *window, bool place = false);
59 const int removeWindow(FluxboxWindow *);
60 const int getCount(void) const;
61 void setName(const char *name); 47 void setName(const char *name);
62 void showAll(void); 48 void showAll();
63 void hideAll(void); 49 void hideAll();
64 void removeAll(void); 50 void removeAll();
65 void raiseWindow(FluxboxWindow *); 51 void raiseWindow(FluxboxWindow *);
66 void lowerWindow(FluxboxWindow *); 52 void lowerWindow(FluxboxWindow *);
67 void reconfigure(); 53 void reconfigure();
68 void update(); 54 void update();
69 void setCurrent(void); 55 void setCurrent();
70 void shutdown(void); 56 void shutdown();
57 const int addWindow(FluxboxWindow *window, bool place = false);
58 const int removeWindow(FluxboxWindow *);
59
60 inline BScreen *getScreen() const { return screen; }
61 inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; }
62 inline Clientmenu *menu() { return &m_clientmenu; }
63 inline const Clientmenu *menu() const { return &m_clientmenu; }
64 inline const std::string &name() const { return m_name; }
65 inline const unsigned int workspaceID() const { return m_id; }
66
67 FluxboxWindow *getWindow(unsigned int id);
68 const FluxboxWindow *getWindow(unsigned int id) const;
69 inline const Windows &getWindowList() const { return windowList; }
70 bool isCurrent() const;
71 bool isLastWindow(FluxboxWindow *window) const;
72 const int getCount() const;
73
74protected:
75 void placeWindow(FluxboxWindow *);
71 76
72private: 77private:
73 BScreen *screen; 78 BScreen *screen;
74 FluxboxWindow *lastfocus; 79 FluxboxWindow *lastfocus;
75 Clientmenu *clientmenu; 80 Clientmenu m_clientmenu;
76 81
77 typedef std::list<FluxboxWindow *> WindowStack; 82 typedef std::list<FluxboxWindow *> WindowStack;
78 83
@@ -83,10 +88,6 @@ private:
83 std::string m_name; 88 std::string m_name;
84 unsigned int m_id; 89 unsigned int m_id;
85 int cascade_x, cascade_y; 90 int cascade_x, cascade_y;
86
87
88protected:
89 void placeWindow(FluxboxWindow *);
90}; 91};
91 92
92 93