summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Clientmenu.cc53
-rw-r--r--src/Clientmenu.hh26
-rw-r--r--src/Workspacemenu.cc37
-rw-r--r--src/Workspacemenu.hh17
4 files changed, 63 insertions, 70 deletions
diff --git a/src/Clientmenu.cc b/src/Clientmenu.cc
index 68b6173..c7fe7a9 100644
--- a/src/Clientmenu.cc
+++ b/src/Clientmenu.cc
@@ -1,3 +1,5 @@
1// Clientmenu.cc for Fluxbox
2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
1// Clientmenu.cc for Blackbox - an X11 Window manager 3// Clientmenu.cc for Blackbox - an X11 Window manager
2// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 4// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
3// 5//
@@ -19,14 +21,13 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
21 23
22// stupid macros needed to access some functions in version 2 of the GNU C 24//use GNU extensions
23// library 25#ifndef _GNU_SOURCE
24#ifndef _GNU_SOURCE 26#define _GNU_SOURCE
25#define _GNU_SOURCE
26#endif // _GNU_SOURCE 27#endif // _GNU_SOURCE
27 28
28#ifdef HAVE_CONFIG_H 29#ifdef HAVE_CONFIG_H
29# include "../config.h" 30# include "../config.h"
30#endif // HAVE_CONFIG_H 31#endif // HAVE_CONFIG_H
31 32
32#include "fluxbox.hh" 33#include "fluxbox.hh"
@@ -37,27 +38,29 @@
37#include "Workspacemenu.hh" 38#include "Workspacemenu.hh"
38 39
39 40
40Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()) { 41Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()),
41 wkspc = ws; 42m_wkspc(ws) {
42 screen = wkspc->getScreen(); 43 setInternalMenu();
43
44 setInternalMenu();
45} 44}
46 45
47 46
48void Clientmenu::itemSelected(int button, unsigned int index) { 47void Clientmenu::itemSelected(int button, unsigned int index) {
49 if (button > 2) return; 48 if (button > 2)
50 49 return;
51 FluxboxWindow *win = wkspc->getWindow(index); 50 //get the window with index of the item we selected
52 if (win) { 51 FluxboxWindow *win = m_wkspc->getWindow(index);
53 if (button == 1) { 52 if (win) {
54 if (! wkspc->isCurrent()) wkspc->setCurrent(); 53 if (button == 1) {
55 } else if (button == 2) { 54 if (! m_wkspc->isCurrent())
56 if (! wkspc->isCurrent()) win->deiconify(True, False); 55 m_wkspc->setCurrent();
57 } 56 } else if (button == 2) {
58 wkspc->raiseWindow(win); 57 if (! m_wkspc->isCurrent())
59 win->setInputFocus(); 58 win->deiconify(true, false);
60 } 59 }
61 60 m_wkspc->raiseWindow(win);
62 if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) hide(); 61 win->setInputFocus();
62 }
63
64 if (! (screen()->getWorkspacemenu()->isTorn() || isTorn()))
65 hide();
63} 66}
diff --git a/src/Clientmenu.hh b/src/Clientmenu.hh
index 19a6d57..f49822a 100644
--- a/src/Clientmenu.hh
+++ b/src/Clientmenu.hh
@@ -19,29 +19,25 @@
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#ifndef CLIENTMENU_HH 22#ifndef CLIENTMENU_HH
23#define CLIENTMENU_HH 23#define CLIENTMENU_HH
24 24
25// forward declarations
26class Clientmenu;
27class Workspace;
28 25
29#include "Basemenu.hh" 26#include "Basemenu.hh"
30 27
28// forward declarations
29class Workspace;
31 30
32 31
33class Clientmenu : public Basemenu { 32class Clientmenu : public Basemenu {
34private:
35 BScreen *screen;
36 Workspace *wkspc;
37
38
39protected:
40 virtual void itemSelected(int button, unsigned int index);
41
42
43public: 33public:
44 Clientmenu(Workspace *); 34 Clientmenu(Workspace *wrksp);
35
36protected:
37 virtual void itemSelected(int button, unsigned int index);
38
39private:
40 Workspace *m_wkspc;
45}; 41};
46 42
47 43
diff --git a/src/Workspacemenu.cc b/src/Workspacemenu.cc
index a9b0b52..d13621b 100644
--- a/src/Workspacemenu.cc
+++ b/src/Workspacemenu.cc
@@ -21,28 +21,26 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Workspacemenu.cc,v 1.6 2002/04/09 23:19:17 fluxgen Exp $ 24// $Id: Workspacemenu.cc,v 1.7 2002/05/07 14:05:00 fluxgen Exp $
25 25
26//use GNU extension 26//use GNU extension
27#ifndef _GNU_SOURCE 27#ifndef _GNU_SOURCE
28#define _GNU_SOURCE 28#define _GNU_SOURCE
29#endif // _GNU_SOURCE 29#endif // _GNU_SOURCE
30 30
31#ifdef HAVE_CONFIG_H 31#ifdef HAVE_CONFIG_H
32# include "../config.h" 32#include "../config.h"
33#endif // HAVE_CONFIG_H 33#endif // HAVE_CONFIG_H
34 34
35#include "Workspacemenu.hh"
36
35#include "i18n.hh" 37#include "i18n.hh"
36#include "fluxbox.hh"
37#include "Screen.hh" 38#include "Screen.hh"
38#include "Toolbar.hh"
39#include "Workspacemenu.hh"
40#include "Workspace.hh" 39#include "Workspace.hh"
41#include <iostream> 40#include <iostream>
42#include <cassert> 41#include <cassert>
43 42
44Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { 43Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
45 screen = scrn;
46 44
47 setInternalMenu(); 45 setInternalMenu();
48 I18n *i18n = I18n::instance(); 46 I18n *i18n = I18n::instance();
@@ -60,17 +58,18 @@ Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
60 58
61 59
62void Workspacemenu::itemSelected(int button, unsigned int index) { 60void Workspacemenu::itemSelected(int button, unsigned int index) {
63 if (button == 1) { 61 if (button == 1) {
64 if (index == 0) 62 if (index == 0)
65 screen->addWorkspace(); 63 screen()->addWorkspace();
66 else if (index == 1) 64 else if (index == 1)
67 screen->removeLastWorkspace(); 65 screen()->removeLastWorkspace();
68 else if ((screen->getCurrentWorkspace()->workspaceID() != 66 else if ((screen()->getCurrentWorkspace()->workspaceID() !=
69 (index - 2)) && ((index - 2) < screen->getCount())) 67 (index - 2)) && ((index - 2) < screen()->getCount())) {
70 screen->changeWorkspaceID(index - 2); 68 screen()->changeWorkspaceID(index - 2);
71 69 }
72 if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) 70
73 hide(); 71 if (! (screen()->getWorkspacemenu()->isTorn() || isTorn()))
74 } 72 hide();
73 }
75} 74}
76 75
diff --git a/src/Workspacemenu.hh b/src/Workspacemenu.hh
index 28e1cca..e1b9996 100644
--- a/src/Workspacemenu.hh
+++ b/src/Workspacemenu.hh
@@ -15,29 +15,24 @@
15// 15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24#ifndef WORKSPACEMENU_HH 24#ifndef WORKSPACEMENU_HH
25#define WORKSPACEMENU_HH 25#define WORKSPACEMENU_HH
26 26
27#include "Basemenu.hh" 27#include "Basemenu.hh"
28class Workspace;
29 28
30class Workspacemenu : public Basemenu { 29class Workspacemenu : public Basemenu {
31private: 30public:
32 BScreen *screen; 31 Workspacemenu(BScreen *screen);
33 32
34protected: 33protected:
35 virtual void itemSelected(int button, unsigned int index); 34 virtual void itemSelected(int button, unsigned int index);
36 35
37public:
38 Workspacemenu(BScreen *);
39}; 36};
40 37
41 38#endif // WORKSPACEMENU_HH
42#endif // _WORKSPACEMENU_HH_
43