all repos — fluxbox @ 0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41

custom fork of the fluxbox windowmanager

changed clientmenu to regular
fluxgen fluxgen
commit

0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41

parent

9caf24483d1ee8ea0a7a83ab65a2950af01c6765

2 files changed, 64 insertions(+), 52 deletions(-)

jump to
M src/Workspace.ccsrc/Workspace.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.18 2002/04/09 23:18:12 fluxgen Exp $ +// $Id: Workspace.cc,v 1.19 2002/05/07 13:57:09 fluxgen Exp $ // use GNU extensions #ifndef _GNU_SOURCE

@@ -43,13 +43,8 @@ #include "Workspace.hh"

#include "Windowmenu.hh" #include "StringUtil.hh" -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif // HAVE_STDIO_H - -#ifdef STDC_HEADERS -# include <string.h> -#endif // STDC_HEADERS +#include <stdio.h> +#include <string.h> #include <X11/Xlib.h> #include <X11/Xatom.h>

@@ -57,16 +52,16 @@

#include <algorithm> #include <iostream> using namespace std; + Workspace::Workspace(BScreen *scrn, unsigned int i): screen(scrn), lastfocus(0), +m_clientmenu(this), m_name(""), m_id(i), cascade_x(32), cascade_y(32) { - - clientmenu = new Clientmenu(this); char *tmp; screen->getNameOfWorkspace(m_id, &tmp);

@@ -78,7 +73,7 @@ }

Workspace::~Workspace() { - delete clientmenu; + }

@@ -96,23 +91,34 @@ stackingList.push_front(w);

//insert window after the currently focused window FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); + //if there isn't any window that's focused, just add it to the end of the list if (focused == 0) { windowList.push_back(w); + //Add client to clientmenu + m_clientmenu.insert(w->getTitle().c_str()); } else { Windows::iterator it = windowList.begin(); - for (; it != windowList.end(); ++it) { + size_t client_insertpoint=0; + for (; it != windowList.end(); ++it, ++client_insertpoint) { if (*it == focused) { - ++it; + ++it; break; } } + windowList.insert(it, w); + //Add client to clientmenu + m_clientmenu.insert(w->getTitle().c_str(), client_insertpoint); + + } - - clientmenu->insert(w->getTitle().c_str()); - clientmenu->update(); - + + + + //update menugraphics + m_clientmenu.update(); + screen->updateNetizenWindowAdd(w->getClientWindow(), m_id); raiseWindow(w);

@@ -159,8 +165,8 @@ break;

} } - clientmenu->remove(w->getWindowNumber()); - clientmenu->update(); + m_clientmenu.remove(w->getWindowNumber()); + m_clientmenu.update(); screen->updateNetizenWindowDel(w->getClientWindow());

@@ -294,7 +300,7 @@ }

void Workspace::reconfigure(void) { - clientmenu->reconfigure(); + m_clientmenu.reconfigure(); Windows::iterator it = windowList.begin(); Windows::iterator it_end = windowList.end();

@@ -305,10 +311,15 @@ }

} -FluxboxWindow *Workspace::getWindow(unsigned int index) const{ +const FluxboxWindow *Workspace::getWindow(unsigned int index) const { if (index < windowList.size()) return windowList[index]; + return 0; +} +FluxboxWindow *Workspace::getWindow(unsigned int index) { + if (index < windowList.size()) + return windowList[index]; return 0; }

@@ -319,7 +330,7 @@ }

void Workspace::update(void) { - clientmenu->update(); + m_clientmenu.update(); screen->getToolbar()->redrawWindowLabel(True); }

@@ -353,8 +364,8 @@ }

screen->updateWorkspaceNamesAtom(); - clientmenu->setLabel(m_name.c_str()); - clientmenu->update(); + m_clientmenu.setLabel(m_name.c_str()); + m_clientmenu.update(); } //------------ shutdown ---------
M src/Workspace.hhsrc/Workspace.hh

@@ -25,7 +25,9 @@

#ifndef WORKSPACE_HH #define WORKSPACE_HH +#include "Clientmenu.hh" #include "Window.hh" +#include "NotCopyable.hh" #include <X11/Xlib.h> #include <string>

@@ -33,46 +35,49 @@ #include <vector>

#include <list> class BScreen; -class Clientmenu; -class Workspace; - -class Workspace { +class Workspace:private NotCopyable { public: typedef std::vector<FluxboxWindow *> Windows; Workspace(BScreen *screen, unsigned int workspaceid= 0); - ~Workspace(void); - - inline BScreen *getScreen(void) const { return screen; } - inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; } - inline Clientmenu *menu(void) const { return clientmenu; } - inline const std::string &name(void) const { return m_name; } - inline const unsigned int workspaceID(void) const { return m_id; } + ~Workspace(); inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } - FluxboxWindow *getWindow(unsigned int id) const; - inline Windows &getWindowList() { return windowList; } - bool isCurrent(void) const; - bool isLastWindow(FluxboxWindow *window) const; - const int addWindow(FluxboxWindow *window, bool place = false); - const int removeWindow(FluxboxWindow *); - const int getCount(void) const; void setName(const char *name); - void showAll(void); - void hideAll(void); - void removeAll(void); + void showAll(); + void hideAll(); + void removeAll(); void raiseWindow(FluxboxWindow *); void lowerWindow(FluxboxWindow *); void reconfigure(); void update(); - void setCurrent(void); - void shutdown(void); + void setCurrent(); + void shutdown(); + const int addWindow(FluxboxWindow *window, bool place = false); + const int removeWindow(FluxboxWindow *); + + inline BScreen *getScreen() const { return screen; } + inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; } + inline Clientmenu *menu() { return &m_clientmenu; } + inline const Clientmenu *menu() const { return &m_clientmenu; } + inline const std::string &name() const { return m_name; } + inline const unsigned int workspaceID() const { return m_id; } + + FluxboxWindow *getWindow(unsigned int id); + const FluxboxWindow *getWindow(unsigned int id) const; + inline const Windows &getWindowList() const { return windowList; } + bool isCurrent() const; + bool isLastWindow(FluxboxWindow *window) const; + const int getCount() const; + +protected: + void placeWindow(FluxboxWindow *); private: BScreen *screen; FluxboxWindow *lastfocus; - Clientmenu *clientmenu; + Clientmenu m_clientmenu; typedef std::list<FluxboxWindow *> WindowStack;

@@ -83,10 +88,6 @@

std::string m_name; unsigned int m_id; int cascade_x, cascade_y; - - -protected: - void placeWindow(FluxboxWindow *); };