all repos — fluxbox @ e027cad57de13c089b03df53ecfb2b31edb5d437

custom fork of the fluxbox windowmanager

minor cleaning
fluxgen fluxgen
commit

e027cad57de13c089b03df53ecfb2b31edb5d437

parent

0ec9f1a21dba10a3f7dab273a0ba485d5cb9cb41

4 files changed, 62 insertions(+), 69 deletions(-)

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

@@ -1,3 +1,5 @@

+// Clientmenu.cc for Fluxbox +// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // Clientmenu.cc for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) //

@@ -19,14 +21,13 @@ // 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. -// stupid macros needed to access some functions in version 2 of the GNU C -// library -#ifndef _GNU_SOURCE -#define _GNU_SOURCE +//use GNU extensions +#ifndef _GNU_SOURCE +#define _GNU_SOURCE #endif // _GNU_SOURCE -#ifdef HAVE_CONFIG_H -# include "../config.h" +#ifdef HAVE_CONFIG_H +# include "../config.h" #endif // HAVE_CONFIG_H #include "fluxbox.hh"

@@ -37,27 +38,29 @@ #include "Workspace.hh"

#include "Workspacemenu.hh" -Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()) { - wkspc = ws; - screen = wkspc->getScreen(); - - setInternalMenu(); +Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()), +m_wkspc(ws) { + setInternalMenu(); } void Clientmenu::itemSelected(int button, unsigned int index) { - if (button > 2) return; + if (button > 2) + return; + //get the window with index of the item we selected + FluxboxWindow *win = m_wkspc->getWindow(index); + if (win) { + if (button == 1) { + if (! m_wkspc->isCurrent()) + m_wkspc->setCurrent(); + } else if (button == 2) { + if (! m_wkspc->isCurrent()) + win->deiconify(true, false); + } + m_wkspc->raiseWindow(win); + win->setInputFocus(); + } - FluxboxWindow *win = wkspc->getWindow(index); - if (win) { - if (button == 1) { - if (! wkspc->isCurrent()) wkspc->setCurrent(); - } else if (button == 2) { - if (! wkspc->isCurrent()) win->deiconify(True, False); - } - wkspc->raiseWindow(win); - win->setInputFocus(); - } - - if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) hide(); + if (! (screen()->getWorkspacemenu()->isTorn() || isTorn())) + hide(); }
M src/Clientmenu.hhsrc/Clientmenu.hh

@@ -19,29 +19,25 @@ // 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. -#ifndef CLIENTMENU_HH -#define CLIENTMENU_HH +#ifndef CLIENTMENU_HH +#define CLIENTMENU_HH -// forward declarations -class Clientmenu; -class Workspace; #include "Basemenu.hh" +// forward declarations +class Workspace; class Clientmenu : public Basemenu { -private: - BScreen *screen; - Workspace *wkspc; - - +public: + Clientmenu(Workspace *wrksp); + protected: - virtual void itemSelected(int button, unsigned int index); - - -public: - Clientmenu(Workspace *); + virtual void itemSelected(int button, unsigned int index); + +private: + Workspace *m_wkspc; };
M src/Workspacemenu.ccsrc/Workspacemenu.cc

@@ -21,28 +21,26 @@ // 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: Workspacemenu.cc,v 1.6 2002/04/09 23:19:17 fluxgen Exp $ +// $Id: Workspacemenu.cc,v 1.7 2002/05/07 14:05:00 fluxgen Exp $ //use GNU extension #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE -#ifdef HAVE_CONFIG_H -# include "../config.h" +#ifdef HAVE_CONFIG_H +#include "../config.h" #endif // HAVE_CONFIG_H + +#include "Workspacemenu.hh" #include "i18n.hh" -#include "fluxbox.hh" #include "Screen.hh" -#include "Toolbar.hh" -#include "Workspacemenu.hh" #include "Workspace.hh" #include <iostream> #include <cassert> Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { - screen = scrn; setInternalMenu(); I18n *i18n = I18n::instance();

@@ -60,17 +58,18 @@ }

void Workspacemenu::itemSelected(int button, unsigned int index) { - if (button == 1) { - if (index == 0) - screen->addWorkspace(); - else if (index == 1) - screen->removeLastWorkspace(); - else if ((screen->getCurrentWorkspace()->workspaceID() != - (index - 2)) && ((index - 2) < screen->getCount())) - screen->changeWorkspaceID(index - 2); - - if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) - hide(); - } + if (button == 1) { + if (index == 0) + screen()->addWorkspace(); + else if (index == 1) + screen()->removeLastWorkspace(); + else if ((screen()->getCurrentWorkspace()->workspaceID() != + (index - 2)) && ((index - 2) < screen()->getCount())) { + screen()->changeWorkspaceID(index - 2); + } + + if (! (screen()->getWorkspacemenu()->isTorn() || isTorn())) + hide(); + } }
M src/Workspacemenu.hhsrc/Workspacemenu.hh

@@ -15,29 +15,24 @@ // all copies or substantial portions of the Software.

// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 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. -#ifndef WORKSPACEMENU_HH -#define WORKSPACEMENU_HH +#ifndef WORKSPACEMENU_HH +#define WORKSPACEMENU_HH #include "Basemenu.hh" -class Workspace; class Workspacemenu : public Basemenu { -private: - BScreen *screen; +public: + Workspacemenu(BScreen *screen); protected: virtual void itemSelected(int button, unsigned int index); -public: - Workspacemenu(BScreen *); }; - -#endif // _WORKSPACEMENU_HH_ - +#endif // WORKSPACEMENU_HH