aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-20 08:12:36 (GMT)
committerrathnor <rathnor>2003-07-20 08:12:36 (GMT)
commit1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d (patch)
tree8dd1331222e35070a16aaae5d4bd059296dd341c /src/Screen.cc
parentace3e2e6293fa0ae5a2b9d971f24fa45b317ba2e (diff)
downloadfluxbox-1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d.zip
fluxbox-1741ac072dd6516b4dcfdf6dbe9099a335c7bc7d.tar.bz2
fix menus for "extra" things, like remember, so that they will be
added back if the menu is rebuilt.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc126
1 files changed, 1 insertions, 125 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index b3ba39a..35added 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.205 2003/07/20 02:45:57 rathnor Exp $ 25// $Id: Screen.cc,v 1.206 2003/07/20 08:12:36 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -35,7 +35,6 @@
35#include "StringUtil.hh" 35#include "StringUtil.hh"
36#include "Netizen.hh" 36#include "Netizen.hh"
37#include "Directory.hh" 37#include "Directory.hh"
38#include "WinButton.hh"
39#include "SimpleCommand.hh" 38#include "SimpleCommand.hh"
40#include "FbWinFrameTheme.hh" 39#include "FbWinFrameTheme.hh"
41#include "MenuTheme.hh" 40#include "MenuTheme.hh"
@@ -1069,7 +1068,6 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1069 focused_list.push_back(&win->winClient()); 1068 focused_list.push_back(&win->winClient());
1070 1069
1071 if (new_win) { 1070 if (new_win) {
1072 setupWindowActions(*win);
1073 Fluxbox::instance()->attachSignals(*win); 1071 Fluxbox::instance()->attachSignals(*win);
1074 } 1072 }
1075 1073
@@ -1107,7 +1105,6 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1107 // WinClient already exists). 1105 // WinClient already exists).
1108 1106
1109 Fluxbox::instance()->saveWindowSearch(client.window(), win); 1107 Fluxbox::instance()->saveWindowSearch(client.window(), win);
1110 setupWindowActions(*win);
1111 Fluxbox::instance()->attachSignals(*win); 1108 Fluxbox::instance()->attachSignals(*win);
1112 // winclient actions should have been setup when the WinClient was created 1109 // winclient actions should have been setup when the WinClient was created
1113 if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) { 1110 if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) {
@@ -1116,127 +1113,6 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1116 return win; 1113 return win;
1117} 1114}
1118 1115
1119void BScreen::setupWindowActions(FluxboxWindow &win) {
1120
1121 FbWinFrame &frame = win.frame();
1122
1123
1124 typedef FbTk::RefCount<FbTk::Command> CommandRef;
1125
1126 using namespace FbTk;
1127 typedef RefCount<Command> CommandRef;
1128 typedef SimpleCommand<FluxboxWindow> WindowCmd;
1129
1130 CommandRef iconify_cmd(new WindowCmd(win, &FluxboxWindow::iconify));
1131 CommandRef maximize_cmd(new WindowCmd(win, &FluxboxWindow::maximize));
1132 CommandRef maximize_vert_cmd(new WindowCmd(win, &FluxboxWindow::maximizeVertical));
1133 CommandRef maximize_horiz_cmd(new WindowCmd(win, &FluxboxWindow::maximizeHorizontal));
1134 CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close));
1135 CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade));
1136 CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise));
1137 CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::lower));
1138 CommandRef raise_and_focus_cmd(new WindowCmd(win, &FluxboxWindow::raiseAndFocus));
1139 CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick));
1140 CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu));
1141
1142 // clear old buttons from frame
1143 frame.removeAllButtons();
1144 //!! TODO: fix this ugly hack
1145 // get titlebar configuration
1146 const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft();
1147 for (char c=0; c<2; c++) {
1148 for (size_t i=0; i< dir->size(); ++i) {
1149 //create new buttons
1150 FbTk::Button *newbutton = 0;
1151 if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {
1152 newbutton = new WinButton(win, *m_winbutton_theme.get(),
1153 WinButton::MINIMIZE,
1154 frame.titlebar(),
1155 0, 0, 10, 10);
1156 newbutton->setOnClick(iconify_cmd);
1157
1158 } else if (win.isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) {
1159 newbutton = new WinButton(win, *m_winbutton_theme.get(),
1160 WinButton::MAXIMIZE,
1161 frame.titlebar(),
1162 0, 0, 10, 10);
1163
1164 newbutton->setOnClick(maximize_cmd, 1);
1165 newbutton->setOnClick(maximize_horiz_cmd, 3);
1166 newbutton->setOnClick(maximize_vert_cmd, 2);
1167
1168 } else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) {
1169 newbutton = new WinButton(win, *m_winbutton_theme.get(),
1170 WinButton::CLOSE,
1171 frame.titlebar(),
1172 0, 0, 10, 10);
1173
1174 newbutton->setOnClick(close_cmd);
1175#ifdef DEBUG
1176 cerr<<__FILE__<<": Creating close button"<<endl;
1177#endif // DEBUG
1178 } else if ((*dir)[i] == Fluxbox::STICK) {
1179 WinButton *winbtn = new WinButton(win, *m_winbutton_theme.get(),
1180 WinButton::STICK,
1181 frame.titlebar(),
1182 0, 0, 10, 10);
1183 win.stateSig().attach(winbtn);
1184 winbtn->setOnClick(stick_cmd);
1185 newbutton = winbtn;
1186 } else if ((*dir)[i] == Fluxbox::SHADE) {
1187 WinButton *winbtn = new WinButton(win, *m_winbutton_theme.get(),
1188 WinButton::SHADE,
1189 frame.titlebar(),
1190 0, 0, 10, 10);
1191 winbtn->setOnClick(shade_cmd);
1192 }
1193
1194 if (newbutton != 0) {
1195 newbutton->show();
1196 if (c == 0)
1197 frame.addLeftButton(newbutton);
1198 else
1199 frame.addRightButton(newbutton);
1200 }
1201 } //end for i
1202 dir = &Fluxbox::instance()->getTitlebarRight();
1203 } // end for c
1204
1205 frame.reconfigure();
1206
1207 // setup titlebar
1208 frame.setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1
1209 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
1210 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
1211 frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2
1212 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
1213 // setup menu
1214 FbTk::Menu &menu = win.menu();
1215 menu.removeAll(); // clear old items
1216 menu.disableTitle(); // not titlebar
1217
1218 // set new menu items
1219 menu.insert("Shade", shade_cmd);
1220 menu.insert("Stick", stick_cmd);
1221 menu.insert("Maximize", maximize_cmd);
1222 menu.insert("Maximize Vertical", maximize_vert_cmd);
1223 menu.insert("Maximize Horizontal", maximize_horiz_cmd);
1224 menu.insert("Iconify", iconify_cmd);
1225 menu.insert("Raise", raise_cmd);
1226 menu.insert("Lower", lower_cmd);
1227 menu.insert("Layer...", &win.layermenu());
1228 CommandRef next_client_cmd(new WindowCmd(win, &FluxboxWindow::nextClient));
1229 CommandRef prev_client_cmd(new WindowCmd(win, &FluxboxWindow::prevClient));
1230 menu.insert("Next Client", next_client_cmd);
1231 menu.insert("Prev Client", prev_client_cmd);
1232
1233 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ");
1234 menu.insert("Close", close_cmd);
1235
1236 menu.reconfigure(); // update graphics
1237
1238}
1239
1240Strut *BScreen::requestStrut(int left, int right, int top, int bottom) { 1116Strut *BScreen::requestStrut(int left, int right, int top, int bottom) {
1241 Strut *str = new Strut(left, right, top, bottom); 1117 Strut *str = new Strut(left, right, top, bottom);
1242 m_strutlist.push_back(str); 1118 m_strutlist.push_back(str);