aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc53
1 files changed, 49 insertions, 4 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