From a7ca5002293726ce3280c626a741fc9f0dd30940 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 5 Jan 2003 22:26:56 +0000 Subject: added max functions so we can determine maximum workspace area. Creation of a new FluxboxWindow object is now handled in BScreen::createWindow --- src/Screen.cc | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 126 insertions(+), 16 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index d85021a..efc5afd 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.92 2002/12/13 20:19:05 fluxgen Exp $ +// $Id: Screen.cc,v 1.93 2003/01/05 22:26:56 fluxgen Exp $ #include "Screen.hh" @@ -40,6 +40,8 @@ #include "StringUtil.hh" #include "Netizen.hh" #include "DirHelper.hh" +#include "WinButton.hh" +#include "SimpleCommand.hh" //use GNU extensions #ifndef _GNU_SOURCE @@ -270,7 +272,7 @@ BScreen::BScreen(ResourceManager &rm, m_workspacecount_sig(*this), // workspace count signal m_workspacenames_sig(*this), // workspace names signal m_currentworkspace_sig(*this), // current workspace signal - theme(0), + theme(0), m_windowtheme(scrn), resource(rm, screenname, altscreenname) { Display *disp = BaseDisplay::getXDisplay(); @@ -425,10 +427,10 @@ BScreen::BScreen(ResourceManager &rm, //update menus m_rootmenu->update(); - +#ifdef SLIT if (m_slit.get()) m_slit->reconfigure(); - +#endif // SLIT // start with workspace 0 changeWorkspaceID(0); @@ -472,20 +474,13 @@ BScreen::BScreen(ResourceManager &rm, continue; if (attrib.map_state != IsUnmapped) { - - FluxboxWindow *win = new FluxboxWindow(children[i], this); - if (!win->isManaged()) { - delete win; - win = 0; - } else { - Fluxbox::instance()->attachSignals(*win); - } - + FluxboxWindow *win = createWindow(children[i]); + if (win) { XMapRequestEvent mre; mre.window = children[i]; win->restoreAttributes(); - win->mapRequestEvent(&mre); + win->mapRequestEvent(mre); } } } @@ -543,6 +538,25 @@ BScreen::~BScreen() { } +/// TODO +unsigned int BScreen::getMaxLeft() const { + return 0; +} + +/// TODO +unsigned int BScreen::getMaxRight() const { + return getWidth(); +} + +/// TODO +unsigned int BScreen::getMaxTop() const { + return 0; +} +/// TODO +unsigned int BScreen::getMaxBottom() const { + return getHeight(); +} + void BScreen::iconUpdate() { m_iconmenu->update(); } @@ -633,10 +647,11 @@ void BScreen::reconfigure() { if (m_toolbar->theme().font().isAntialias() != *resource.antialias) m_toolbar->theme().font().setAntialias(*resource.antialias); - +#ifdef SLIT if (m_slit.get()) m_slit->reconfigure(); - +#endif // SLIT + //reconfigure workspaces Workspaces::iterator wit = workspacesList.begin(); Workspaces::iterator wit_end = workspacesList.end(); @@ -1004,7 +1019,100 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) { } } +FluxboxWindow *BScreen::createWindow(Window client) { + FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(), winFrameTheme()); + +#ifdef SLIT + if (win->initialState() == WithdrawnState) + getSlit()->addClient(win->getClientWindow()); +#endif // SLIT + + if (!win->isManaged()) { + delete win; + return 0; + } else { + Fluxbox::instance()->saveWindowSearch(client, win); + Fluxbox::instance()->attachSignals(*win); + setupWindowActions(*win); + } + return win; +} + +void BScreen::setupWindowActions(FluxboxWindow &win) { + + FbWinFrame &frame = win.frame(); + + // clear old buttons from frame + frame.removeAllButtons(); + + typedef FbTk::RefCount CommandRef; + + using namespace FbTk; + + //create new buttons + if (win.isIconifiable()) { + FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), 0, 0, 10, 10); + CommandRef iconifycmd(new SimpleCommand(win, &FluxboxWindow::iconify)); + iconifybtn->setOnClick(iconifycmd); + iconifybtn->show(); + frame.addRightButton(iconifybtn); +#ifdef DEBUG + cerr<<"Creating iconify button"<(win, &FluxboxWindow::maximize)); + CommandRef maximize_horiz_cmd(new SimpleCommand(win, &FluxboxWindow::maximizeHorizontal)); + CommandRef maximize_vert_cmd(new SimpleCommand(win, &FluxboxWindow::maximizeVertical)); + + maximizebtn->setOnClick(maximizecmd, 1); + maximizebtn->setOnClick(maximize_horiz_cmd, 3); + maximizebtn->setOnClick(maximize_vert_cmd, 2); + maximizebtn->show(); + frame.addRightButton(maximizebtn); +#ifdef DEBUG + cerr<<"Creating maximize button"<(win, &FluxboxWindow::close)); + closebtn->setOnClick(closecmd); + closebtn->show(); + frame.addRightButton(closebtn); +#ifdef DEBUG + cerr<<"Creating close button"< stickcmd(new FbTk::SimpleCommand(*this, &FluxboxWindow::stick)); + stickbtn->setOnClick(stickcmd); + stickbtn->show(); + m_frame.addLeftButton(stickbtn); +#ifdef DEBUG + cerr<<"Creating sticky button"< shadecmd(new FbTk::SimpleCommand(*this, &FluxboxWindow::shade)); + shadebtn->setOnClick(shadecmd); + shadebtn->show(); + m_frame.addRightButton(shadebtn); +#ifdef DEBUG + cerr<<"Creating shade button"<shutdown(); +#endif // SLIT } -- cgit v0.11.2