aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc87
1 files changed, 50 insertions, 37 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index efc5afd..7a8ef48 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.93 2003/01/05 22:26:56 fluxgen Exp $ 25// $Id: Screen.cc,v 1.94 2003/01/07 02:06:06 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -42,6 +42,7 @@
42#include "DirHelper.hh" 42#include "DirHelper.hh"
43#include "WinButton.hh" 43#include "WinButton.hh"
44#include "SimpleCommand.hh" 44#include "SimpleCommand.hh"
45#include "MenuTheme.hh"
45 46
46//use GNU extensions 47//use GNU extensions
47#ifndef _GNU_SOURCE 48#ifndef _GNU_SOURCE
@@ -273,6 +274,7 @@ BScreen::BScreen(ResourceManager &rm,
273 m_workspacenames_sig(*this), // workspace names signal 274 m_workspacenames_sig(*this), // workspace names signal
274 m_currentworkspace_sig(*this), // current workspace signal 275 m_currentworkspace_sig(*this), // current workspace signal
275 theme(0), m_windowtheme(scrn), 276 theme(0), m_windowtheme(scrn),
277 m_menutheme(new FbTk::MenuTheme(scrn)),
276 resource(rm, screenname, altscreenname) 278 resource(rm, screenname, altscreenname)
277{ 279{
278 Display *disp = BaseDisplay::getXDisplay(); 280 Display *disp = BaseDisplay::getXDisplay();
@@ -1020,7 +1022,8 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
1020} 1022}
1021 1023
1022FluxboxWindow *BScreen::createWindow(Window client) { 1024FluxboxWindow *BScreen::createWindow(Window client) {
1023 FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(), winFrameTheme()); 1025 FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(),
1026 winFrameTheme(), *menuTheme());
1024 1027
1025#ifdef SLIT 1028#ifdef SLIT
1026 if (win->initialState() == WithdrawnState) 1029 if (win->initialState() == WithdrawnState)
@@ -1042,18 +1045,31 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1042 1045
1043 FbWinFrame &frame = win.frame(); 1046 FbWinFrame &frame = win.frame();
1044 1047
1045 // clear old buttons from frame
1046 frame.removeAllButtons();
1047 1048
1048 typedef FbTk::RefCount<FbTk::Command> CommandRef; 1049 typedef FbTk::RefCount<FbTk::Command> CommandRef;
1049 1050
1050 using namespace FbTk; 1051 using namespace FbTk;
1052 typedef RefCount<Command> CommandRef;
1053 typedef SimpleCommand<FluxboxWindow> WindowCmd;
1054
1055 CommandRef iconify_cmd(new WindowCmd(win, &FluxboxWindow::iconify));
1056 CommandRef maximize_cmd(new WindowCmd(win, &FluxboxWindow::maximize));
1057 CommandRef maximize_vert_cmd(new WindowCmd(win, &FluxboxWindow::maximizeVertical));
1058 CommandRef maximize_horiz_cmd(new WindowCmd(win, &FluxboxWindow::maximizeHorizontal));
1059 CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close));
1060 CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade));
1061 CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise));
1062 CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::raise));
1063 CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick));
1064 CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu));
1065
1066 // clear old buttons from frame
1067 frame.removeAllButtons();
1051 1068
1052 //create new buttons 1069 //create new buttons
1053 if (win.isIconifiable()) { 1070 if (win.isIconifiable()) {
1054 FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), 0, 0, 10, 10); 1071 FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), 0, 0, 10, 10);
1055 CommandRef iconifycmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::iconify)); 1072 iconifybtn->setOnClick(iconify_cmd);
1056 iconifybtn->setOnClick(iconifycmd);
1057 iconifybtn->show(); 1073 iconifybtn->show();
1058 frame.addRightButton(iconifybtn); 1074 frame.addRightButton(iconifybtn);
1059#ifdef DEBUG 1075#ifdef DEBUG
@@ -1063,11 +1079,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1063 1079
1064 if (win.isMaximizable()) { 1080 if (win.isMaximizable()) {
1065 FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), 0, 0, 10, 10); 1081 FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), 0, 0, 10, 10);
1066 CommandRef maximizecmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximize));
1067 CommandRef maximize_horiz_cmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximizeHorizontal));
1068 CommandRef maximize_vert_cmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximizeVertical));
1069 1082
1070 maximizebtn->setOnClick(maximizecmd, 1); 1083 maximizebtn->setOnClick(maximize_cmd, 1);
1071 maximizebtn->setOnClick(maximize_horiz_cmd, 3); 1084 maximizebtn->setOnClick(maximize_horiz_cmd, 3);
1072 maximizebtn->setOnClick(maximize_vert_cmd, 2); 1085 maximizebtn->setOnClick(maximize_vert_cmd, 2);
1073 maximizebtn->show(); 1086 maximizebtn->show();
@@ -1079,39 +1092,39 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1079 1092
1080 if (win.isClosable()) { 1093 if (win.isClosable()) {
1081 Button *closebtn = new WinButton(WinButton::CLOSE, frame.titlebar(), 0, 0, 10, 10); 1094 Button *closebtn = new WinButton(WinButton::CLOSE, frame.titlebar(), 0, 0, 10, 10);
1082 CommandRef closecmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::close)); 1095
1083 closebtn->setOnClick(closecmd); 1096 closebtn->setOnClick(close_cmd);
1084 closebtn->show(); 1097 closebtn->show();
1085 frame.addRightButton(closebtn); 1098 frame.addRightButton(closebtn);
1086#ifdef DEBUG 1099#ifdef DEBUG
1087 cerr<<"Creating close button"<<endl; 1100 cerr<<"Creating close button"<<endl;
1088#endif // DEBUG 1101#endif // DEBUG
1089 } 1102 }
1090 /* 1103 // setup titlebar
1091 if (decorations.sticky) { 1104 frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1
1092 FbTk::Button *stickbtn = new WinButton(WinButton::STICK, m_frame.titlebar(), 1105 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
1093 0, 0, 10, 10); 1106 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
1094 FbTk::RefCount<FbTk::Command> stickcmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::stick)); 1107 frame.setOnClickTitlebar(lower_cmd, 3, false, true); // on press with button 3
1095 stickbtn->setOnClick(stickcmd); 1108 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
1096 stickbtn->show(); 1109 // setup menu
1097 m_frame.addLeftButton(stickbtn); 1110 FbTk::Menu &menu = win.getWindowmenu();
1098#ifdef DEBUG 1111 menu.removeAll(); // clear old items
1099 cerr<<"Creating sticky button"<<endl; 1112 menu.disableTitle();
1100#endif // DEBUG 1113
1101 } 1114 // set new menu items
1102 */ 1115 menu.insert("Shade", shade_cmd);
1103 /* if (decorations.shade) { 1116 menu.insert("Stick", stick_cmd);
1104 FbTk::Button *shadebtn = new WinButton(WinButton::SHADE, m_frame.titlebar(), 1117 menu.insert("Maximize", maximize_cmd);
1105 0, 0, 10, 10); 1118 menu.insert("Maximize Vertical", maximize_vert_cmd);
1106 FbTk::RefCount<FbTk::Command> shadecmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::shade)); 1119 menu.insert("Maximize Horizontal", maximize_horiz_cmd);
1107 shadebtn->setOnClick(shadecmd); 1120 menu.insert("Iconify", iconify_cmd);
1108 shadebtn->show(); 1121 menu.insert("Raise", raise_cmd);
1109 m_frame.addRightButton(shadebtn); 1122 menu.insert("Lower", lower_cmd);
1110#ifdef DEBUG 1123 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ");
1111 cerr<<"Creating shade button"<<endl; 1124 menu.insert("Close", close_cmd);
1112#endif // DEBUG 1125
1113 } 1126 menu.reconfigure(); // update graphics
1114 */ 1127
1115} 1128}
1116void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { 1129void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
1117 1130