aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-02-16 15:12:08 (GMT)
committerrathnor <rathnor>2003-02-16 15:12:08 (GMT)
commit453e220df91fabd80a2f8e5992ad1a3a73f4efbe (patch)
tree409496e6d6614e2e7280ebd3fced26f808bd0c7b /src
parente24348aedb99bb52f350e617de469f7809a49201 (diff)
downloadfluxbox-453e220df91fabd80a2f8e5992ad1a3a73f4efbe.zip
fluxbox-453e220df91fabd80a2f8e5992ad1a3a73f4efbe.tar.bz2
Add layer menu to window menu
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc53
-rw-r--r--src/Window.cc3
-rw-r--r--src/Window.hh7
-rw-r--r--src/fluxbox.hh15
4 files changed, 64 insertions, 14 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 66512ea..ccff0d0 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.106 2003/02/16 13:55:49 fluxgen Exp $ 25// $Id: Screen.cc,v 1.107 2003/02/16 15:12:08 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -137,8 +137,24 @@ FbTk::Menu *createMenuFromScreen(BScreen &screen) {
137 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); 137 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
138 return menu; 138 return menu;
139} 139}
140
141class WindowLayerMenuItem : public FbTk::MenuItem {
142public:
143 WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum):
144 FbTk::MenuItem(label), m_window(win), m_layernum(layernum) {
145 }
146 bool isEnabled() const { return m_window.getLayerNum() != m_layernum; }
147 void click(int button, int time) {
148 m_window.moveToLayer(m_layernum);
149 }
150
151private:
152 FluxboxWindow &m_window;
153 int m_layernum;
140}; 154};
141 155
156}; // End anonymous namespace
157
142//---------- resource manipulators --------- 158//---------- resource manipulators ---------
143template<> 159template<>
144void Resource<Tab::Alignment>:: 160void Resource<Tab::Alignment>::
@@ -1107,7 +1123,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1107 CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close)); 1123 CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close));
1108 CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade)); 1124 CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade));
1109 CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise)); 1125 CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise));
1110 CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::raise)); 1126 CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::lower));
1111 CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick)); 1127 CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick));
1112 CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu)); 1128 CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu));
1113 1129
@@ -1117,7 +1133,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1117 // get titlebar configuration 1133 // get titlebar configuration
1118 const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft(); 1134 const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft();
1119 for (char c=0; c<2; c++) { 1135 for (char c=0; c<2; c++) {
1120 for (int i=0; i< dir->size(); ++i) { 1136 for (unsigned int i=0; i< dir->size(); ++i) {
1121 //create new buttons 1137 //create new buttons
1122 FbTk::Button *newbutton = 0; 1138 FbTk::Button *newbutton = 0;
1123 if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { 1139 if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {
@@ -1175,13 +1191,41 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1175 frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1 1191 frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1
1176 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 1192 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
1177 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 1193 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
1178 frame.setOnClickTitlebar(lower_cmd, 3, false, true); // on press with button 3 1194 frame.setOnClickTitlebar(lower_cmd, 2, false, true); // on press with button 2
1179 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); 1195 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
1180 // setup menu 1196 // setup menu
1181 FbTk::Menu &menu = win.getWindowmenu(); 1197 FbTk::Menu &menu = win.getWindowmenu();
1182 menu.removeAll(); // clear old items 1198 menu.removeAll(); // clear old items
1183 menu.disableTitle(); // not titlebar 1199 menu.disableTitle(); // not titlebar
1184 1200
1201 // check and setup layer menu
1202 FbTk::Menu &layer_menu = win.getLayermenu();
1203 // if it hasn't already been setup (no need to reset it)
1204 if (layer_menu.numberOfItems() == 0) {
1205 Fluxbox *fluxbox = Fluxbox::instance();
1206 struct {
1207 int set;
1208 int base;
1209 const char *default_str;
1210 int layernum;
1211 } layer_menuitems[] = {
1212 //TODO: nls
1213 {0, 0, "Above Slit", fluxbox->getAboveSlitLayer()},
1214 {0, 0, "Slit", fluxbox->getSlitLayer()},
1215 {0, 0, "Top", fluxbox->getTopLayer()},
1216 {0, 0, "Normal", fluxbox->getNormalLayer()},
1217 {0, 0, "Bottom", fluxbox->getBottomLayer()},
1218 {0, 0, "Desktop", fluxbox->getDesktopLayer()},
1219 };
1220
1221 for (size_t i=0; i < 6; ++i) {
1222 // TODO: fetch nls string
1223 layer_menu.insert(new WindowLayerMenuItem(layer_menuitems[i].default_str,
1224 win, layer_menuitems[i].layernum));
1225 };
1226 layer_menu.update();
1227 }
1228
1185 // set new menu items 1229 // set new menu items
1186 menu.insert("Shade", shade_cmd); 1230 menu.insert("Shade", shade_cmd);
1187 menu.insert("Stick", stick_cmd); 1231 menu.insert("Stick", stick_cmd);
@@ -1191,6 +1235,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1191 menu.insert("Iconify", iconify_cmd); 1235 menu.insert("Iconify", iconify_cmd);
1192 menu.insert("Raise", raise_cmd); 1236 menu.insert("Raise", raise_cmd);
1193 menu.insert("Lower", lower_cmd); 1237 menu.insert("Lower", lower_cmd);
1238 menu.insert("Layer...", &layer_menu);
1194 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"); 1239 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ");
1195 menu.insert("Close", close_cmd); 1240 menu.insert("Close", close_cmd);
1196 1241
diff --git a/src/Window.cc b/src/Window.cc
index a8be66f..a8d3f8a 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.115 2003/02/09 14:11:13 rathnor Exp $ 25// $Id: Window.cc,v 1.116 2003/02/16 15:12:07 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -112,6 +112,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num,
112 display(0), 112 display(0),
113 lastButtonPressTime(0), 113 lastButtonPressTime(0),
114 m_windowmenu(menutheme, screen_num, imgctrl), 114 m_windowmenu(menutheme, screen_num, imgctrl),
115 m_layermenu(menutheme, screen_num, imgctrl),
115 old_decoration(DECOR_NORMAL), 116 old_decoration(DECOR_NORMAL),
116 tab(0), 117 tab(0),
117 m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100), 118 m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100),
diff --git a/src/Window.hh b/src/Window.hh
index 21959d5..3a19c56 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -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: Window.hh,v 1.45 2003/02/09 14:11:13 rathnor Exp $ 25// $Id: Window.hh,v 1.46 2003/02/16 15:12:08 rathnor Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -220,6 +220,9 @@ public:
220 220
221 FbTk::Menu &getWindowmenu() { return m_windowmenu; } 221 FbTk::Menu &getWindowmenu() { return m_windowmenu; }
222 const FbTk::Menu &getWindowmenu() const { return m_windowmenu; } 222 const FbTk::Menu &getWindowmenu() const { return m_windowmenu; }
223
224 FbTk::Menu &getLayermenu() { return m_layermenu; }
225 const FbTk::Menu &getLayermenu() const { return m_layermenu; }
223 226
224 const std::string &getTitle() const { return client.title; } 227 const std::string &getTitle() const { return client.title; }
225 const std::string &getIconTitle() const { return client.icon_title; } 228 const std::string &getIconTitle() const { return client.icon_title; }
@@ -333,7 +336,7 @@ private:
333 BaseDisplay::BlackboxAttributes blackbox_attrib; 336 BaseDisplay::BlackboxAttributes blackbox_attrib;
334 337
335 Time lastButtonPressTime; 338 Time lastButtonPressTime;
336 FbTk::Menu m_windowmenu; 339 FbTk::Menu m_windowmenu, m_layermenu;
337 340
338 timeval lastFocusTime; 341 timeval lastFocusTime;
339 342
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index ea89257..7ab5428 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -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: fluxbox.hh,v 1.40 2003/02/02 16:32:40 rathnor Exp $ 25// $Id: fluxbox.hh,v 1.41 2003/02/16 15:12:08 rathnor Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -114,12 +114,13 @@ public:
114 inline int getNumberOfLayers() const { return *m_rc_numlayers; } 114 inline int getNumberOfLayers() const { return *m_rc_numlayers; }
115 115
116 // TODO there probably should be configurable 116 // TODO there probably should be configurable
117 inline int getDesktopLayer() const { return 12; } 117 inline int getDesktopLayer() const { return 12; }
118 inline int getBottomLayer() const { return 10; } 118 inline int getBottomLayer() const { return 10; }
119 inline int getNormalLayer() const { return 8; } 119 inline int getNormalLayer() const { return 8; }
120 inline int getTopLayer() const { return 2; } 120 inline int getTopLayer() const { return 6; }
121 inline int getSlitLayer() const { return 4; } 121 inline int getSlitLayer() const { return 4; }
122 inline int getMenuLayer() const { return 0; } 122 inline int getAboveSlitLayer() const { return 2; }
123 inline int getMenuLayer() const { return 0; }
123 124
124 125
125 inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; } 126 inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; }