From 988392b1eb89deaddfddfcb37a15e8f55d58bb70 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 15 May 2003 12:00:46 +0000 Subject: minor cleaning in BScreen interface --- src/Ewmh.cc | 4 +- src/Gnome.cc | 4 +- src/IconBar.cc | 8 +-- src/Netizen.cc | 2 +- src/Remember.cc | 4 +- src/Screen.cc | 161 ++++++++++++++++++++++++-------------------------- src/Screen.hh | 34 +++++------ src/Slit.cc | 32 +++++----- src/Toolbar.cc | 50 ++++++++-------- src/ToolbarHandler.cc | 31 +++++----- src/Window.cc | 105 ++++++++++++++------------------ src/Workspace.cc | 44 +++++++------- src/fluxbox.cc | 52 ++++++++-------- 13 files changed, 253 insertions(+), 278 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 8ec768b..d96a6d3 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.25 2003/05/15 12:00:42 fluxgen Exp $ #include "Ewmh.hh" @@ -223,7 +223,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) { } void Ewmh::updateCurrentWorkspace(BScreen &screen) { - size_t workspace = screen.getCurrentWorkspaceID(); + size_t workspace = screen.currentWorkspaceID(); XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace, diff --git a/src/Gnome.cc b/src/Gnome.cc index 004e95a..bb867ac 100644 --- a/src/Gnome.cc +++ b/src/Gnome.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Gnome.cc,v 1.23 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Gnome.cc,v 1.24 2003/05/15 12:00:42 fluxgen Exp $ #include "Gnome.hh" @@ -205,7 +205,7 @@ void Gnome::updateWorkspaceNames(BScreen &screen) { } void Gnome::updateCurrentWorkspace(BScreen &screen) { - int workspace = screen.getCurrentWorkspaceID(); + int workspace = screen.currentWorkspaceID(); XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, diff --git a/src/IconBar.cc b/src/IconBar.cc index 03c8e85..266eb7c 100644 --- a/src/IconBar.cc +++ b/src/IconBar.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.cc,v 1.34 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: IconBar.cc,v 1.35 2003/05/15 12:00:43 fluxgen Exp $ #include "IconBar.hh" @@ -191,7 +191,7 @@ void IconBar::decorate(Window win) { //!! TODO iconbar border width style XSetWindowBorderWidth(m_display, win, 1); XSetWindowBorder(m_display, win, BlackPixel(FbTk::App::instance()->display(), - screen().getScreenNumber())); + screen().screenNumber())); if (m_focus_pm) XSetWindowBackgroundPixmap(m_display, win, m_focus_pm); else @@ -294,7 +294,7 @@ Window IconBar::createIconWindow(FluxboxWindow *fluxboxwin, Window parent) { attrib.background_pixmap = None; attrib.background_pixel = attrib.border_pixel = BlackPixel(m_display, - screen().getScreenNumber()); + screen().screenNumber()); // fluxboxwin->screen().getWindowStyle()->tab.border_color.pixel(); attrib.colormap = fluxboxwin->screen().rootWindow().colormap(); attrib.override_redirect = True; @@ -347,7 +347,7 @@ void IconBar::draw(const IconBarObj * const obj, int width) const { m_font.drawText( iconwin, - screen().getScreenNumber(), + screen().screenNumber(), screen().winFrameTheme().labelTextFocusGC(), fluxboxwin->iconTitle().c_str(), newlen, dx, dy, m_vertical); diff --git a/src/Netizen.cc b/src/Netizen.cc index 8d85d1e..1536be1 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc @@ -57,7 +57,7 @@ void Netizen::sendWorkspaceCount() { void Netizen::sendCurrentWorkspace() { event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom(); - event.xclient.data.l[1] = m_screen.getCurrentWorkspaceID(); + event.xclient.data.l[1] = m_screen.currentWorkspaceID(); XSendEvent(m_display, window(), False, NoEventMask, &event); } diff --git a/src/Remember.cc b/src/Remember.cc index 8a20e8e..f2e4755 100644 --- a/src/Remember.cc +++ b/src/Remember.cc @@ -21,7 +21,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Remember.cc,v 1.14 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Remember.cc,v 1.15 2003/05/15 12:00:43 fluxgen Exp $ #include "Remember.hh" #include "StringUtil.hh" @@ -99,7 +99,7 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) { // so we also create a remember menu just for it... BScreen &screen = win.screen(); FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), - screen.getScreenNumber(), + screen.screenNumber(), *screen.getImageControl(), *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); menu->disableTitle(); diff --git a/src/Screen.cc b/src/Screen.cc index e661ff4..49280e8 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.166 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Screen.cc,v 1.167 2003/05/15 12:00:44 fluxgen Exp $ #include "Screen.hh" @@ -140,9 +140,9 @@ int anotherWMRunning(Display *display, XErrorEvent *) { FbTk::Menu *createMenuFromScreen(BScreen &screen) { FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), - screen.getScreenNumber(), - *screen.getImageControl(), - *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); + screen.screenNumber(), + *screen.getImageControl(), + *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); return menu; } @@ -541,7 +541,7 @@ BScreen::BScreen(ResourceManager &rm, FBNLS::ScreenSet, FBNLS::ScreenManagingScreen, "BScreen::BScreen: managing screen %d " "using visual 0x%lx, depth %d\n"), - getScreenNumber(), XVisualIDFromVisual(rootWindow().visual()), + screenNumber(), XVisualIDFromVisual(rootWindow().visual()), rootWindow().depth()); Fluxbox * const fluxbox = Fluxbox::instance(); @@ -653,10 +653,10 @@ BScreen::BScreen(ResourceManager &rm, workspacemenu->setItemSelected(2, true); - if (getToolbar()) { - getToolbar()->setPlacement(*resource.toolbar_placement); - getToolbar()->theme().font().setAntialias(*resource.antialias); - getToolbar()->reconfigure(); + if (toolbar()) { + toolbar()->setPlacement(*resource.toolbar_placement); + toolbar()->theme().font().setAntialias(*resource.antialias); + toolbar()->reconfigure(); } initMenu(); // create and initiate rootmenu @@ -723,8 +723,8 @@ BScreen::BScreen(ResourceManager &rm, } } - if (! isSloppyFocus() && getToolbar() != 0) { - XSetInputFocus(disp, getToolbar()->window().window(), + if (! isSloppyFocus() && toolbar() != 0) { + XSetInputFocus(disp, toolbar()->window().window(), RevertToParent, CurrentTime); } @@ -777,7 +777,7 @@ FbTk::Menu &BScreen::getToolbarModemenu() { return m_toolbarhandler->getModeMenu(); } -unsigned int BScreen::getCurrentWorkspaceID() const { +unsigned int BScreen::currentWorkspaceID() const { return current_workspace->workspaceID(); } @@ -805,22 +805,22 @@ Pixmap BScreen::rootPixmap() const { } /// TODO -unsigned int BScreen::getMaxLeft() const { +unsigned int BScreen::maxLeft() const { return 0; } ///!! TODO -unsigned int BScreen::getMaxRight() const { - return getWidth(); +unsigned int BScreen::maxRight() const { + return width(); } ///!! TODO -unsigned int BScreen::getMaxTop() const { +unsigned int BScreen::maxTop() const { return 0; } ///!! TODO -unsigned int BScreen::getMaxBottom() const { - return getHeight(); +unsigned int BScreen::maxBottom() const { + return height(); } void BScreen::reconfigure() { @@ -834,8 +834,8 @@ void BScreen::reconfigure() { winFrameTheme().font().setAntialias(*resource.antialias); m_menutheme->titleFont().setAntialias(*resource.antialias); m_menutheme->frameFont().setAntialias(*resource.antialias); - if (getToolbar() && getToolbar()->theme().font().isAntialias() != *resource.antialias) - getToolbar()->theme().font().setAntialias(*resource.antialias); + if (toolbar() && toolbar()->theme().font().isAntialias() != *resource.antialias) + toolbar()->theme().font().setAntialias(*resource.antialias); // load theme std::string theme_filename(Fluxbox::instance()->getStyleFilename()); @@ -930,9 +930,9 @@ void BScreen::reconfigure() { } } - if (getToolbar()) { - getToolbar()->setPlacement(*resource.toolbar_placement); - getToolbar()->reconfigure(); + if (toolbar()) { + toolbar()->setPlacement(*resource.toolbar_placement); + toolbar()->reconfigure(); } #ifdef SLIT @@ -1054,8 +1054,8 @@ int BScreen::addWorkspace() { workspacemenu->update(); saveWorkspaces(workspacesList.size()); - if (getToolbar() != 0) - getToolbar()->reconfigure(); + if (toolbar() != 0) + toolbar()->reconfigure(); updateNetizenWorkspaceCount(); @@ -1083,8 +1083,8 @@ int BScreen::removeLastWorkspace() { workspacesList.pop_back(); delete wkspc; - if (getToolbar() != 0) - getToolbar()->reconfigure(); + if (toolbar() != 0) + toolbar()->reconfigure(); updateNetizenWorkspaceCount(); saveWorkspaces(workspacesList.size()); @@ -1112,7 +1112,7 @@ void BScreen::changeWorkspaceID(unsigned int id) { } // reassociate all windows that are stuck to the new workspace - Workspace *wksp = getCurrentWorkspace(); + Workspace *wksp = currentWorkspace(); Workspace::Windows wins = wksp->windowList(); Workspace::Windows::iterator it = wins.begin(); for (; it != wins.end(); ++it) { @@ -1129,8 +1129,8 @@ void BScreen::changeWorkspaceID(unsigned int id) { current_workspace = getWorkspace(id); workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, true); - if (getToolbar() != 0) - getToolbar()->redrawWorkspaceLabel(true); + if (toolbar() != 0) + toolbar()->redrawWorkspaceLabel(true); current_workspace->showAll(); @@ -1306,7 +1306,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { #ifdef SLIT if (win->initialState() == WithdrawnState) - getSlit()->addClient(win->clientWindow()); + slit()->addClient(win->clientWindow()); #endif // SLIT if (!win->isManaged()) { @@ -1325,7 +1325,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { setupWindowActions(*win); Fluxbox::instance()->attachSignals(*win); } - if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { + if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) { win->show(); } XSync(FbTk::App::instance()->display(), False); @@ -1338,7 +1338,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); #ifdef SLIT if (win->initialState() == WithdrawnState) - getSlit()->addClient(win->clientWindow()); + slit()->addClient(win->clientWindow()); #endif // SLIT if (!win->isManaged()) { delete win; @@ -1350,7 +1350,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { Fluxbox::instance()->saveWindowSearch(client.window(), win); setupWindowActions(*win); Fluxbox::instance()->attachSignals(*win); - if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { + if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) { win->show(); } return win; @@ -1527,11 +1527,10 @@ void BScreen::nextFocus(int opts) { bool have_focused = false; int focused_window_number = -1; FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); - const int num_windows = getCurrentWorkspace()->numberOfWindows(); + const int num_windows = currentWorkspace()->numberOfWindows(); if (focused != 0) { - if (focused->screen().getScreenNumber() == - getScreenNumber()) { + if (focused->screen().screenNumber() == screenNumber()) { have_focused = true; focused_window_number = focused->windowNumber(); } @@ -1565,7 +1564,7 @@ void BScreen::nextFocus(int opts) { FluxboxWindow *fbwin = (*it)->m_win; if (fbwin && !fbwin->isIconic() && (fbwin->isStuck() - || fbwin->workspaceNumber() == getCurrentWorkspaceID())) { + || fbwin->workspaceNumber() == currentWorkspaceID())) { // either on this workspace, or stuck // keep track of the originally selected window in a set @@ -1586,7 +1585,7 @@ void BScreen::nextFocus(int opts) { } cycling_window = it; } else { // not stacked cycling - Workspace *wksp = getCurrentWorkspace(); + Workspace *wksp = currentWorkspace(); Workspace::Windows &wins = wksp->windowList(); Workspace::Windows::iterator it = wins.begin(); @@ -1617,11 +1616,10 @@ void BScreen::prevFocus(int opts) { bool have_focused = false; int focused_window_number = -1; FluxboxWindow *focused; - int num_windows = getCurrentWorkspace()->numberOfWindows(); + int num_windows = currentWorkspace()->numberOfWindows(); if ((focused = Fluxbox::instance()->getFocusedWindow())) { - if (focused->screen().getScreenNumber() == - getScreenNumber()) { + if (focused->screen().screenNumber() == screenNumber()) { have_focused = true; focused_window_number = focused->windowNumber(); } @@ -1656,7 +1654,7 @@ void BScreen::prevFocus(int opts) { FluxboxWindow *fbwin = (*it)->m_win; if (fbwin && !fbwin->isIconic() && (fbwin->isStuck() - || fbwin->workspaceNumber() == getCurrentWorkspaceID())) { + || fbwin->workspaceNumber() == currentWorkspaceID())) { // either on this workspace, or stuck // keep track of the originally selected window in a set @@ -1679,7 +1677,7 @@ void BScreen::prevFocus(int opts) { cycling_window = it; } else { // not stacked cycling - Workspace *wksp = getCurrentWorkspace(); + Workspace *wksp = currentWorkspace(); Workspace::Windows &wins = wksp->windowList(); Workspace::Windows::iterator it = wins.begin(); @@ -1712,13 +1710,12 @@ void BScreen::raiseFocus() { Fluxbox * const fb = Fluxbox::instance(); if (fb->getFocusedWindow()) - if (fb->getFocusedWindow()->screen().getScreenNumber() == - getScreenNumber()) { + if (fb->getFocusedWindow()->screen().screenNumber() == screenNumber()) { have_focused = true; focused_window_number = fb->getFocusedWindow()->windowNumber(); } - if ((getCurrentWorkspace()->numberOfWindows() > 1) && have_focused) + if ((currentWorkspace()->numberOfWindows() > 1) && have_focused) fb->getFocusedWindow()->raise(); } @@ -1745,7 +1742,7 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) { left = win.x(), right = win.x() + win.width() + 2*borderW; - Workspace::Windows &wins = getCurrentWorkspace()->windowList(); + Workspace::Windows &wins = currentWorkspace()->windowList(); Workspace::Windows::iterator it = wins.begin(); for (; it != wins.end(); ++it) { if ((*it) == &win) continue; // skip self @@ -1883,7 +1880,7 @@ void BScreen::initMenu() { if (defaultMenu) { FbTk::RefCount restart_fb(new FbCommands::RestartFluxboxCmd()); FbTk::RefCount exit_fb(new FbCommands::ExitFluxboxCmd()); - FbTk::RefCount execute_xterm(new FbCommands::ExecuteCmd("xterm", getScreenNumber())); + FbTk::RefCount execute_xterm(new FbCommands::ExecuteCmd("xterm", screenNumber())); m_rootmenu->setInternalMenu(); m_rootmenu->insert(i18n->getMessage( FBNLS::ScreenSet, FBNLS::Screenxterm, @@ -1955,7 +1952,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { "no menu label and/or command defined\n")); cerr<<"Row: "< exec_cmd(new FbCommands::ExecuteCmd(str_cmd, getScreenNumber())); + FbTk::RefCount exec_cmd(new FbCommands::ExecuteCmd(str_cmd, screenNumber())); FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand(); exec_and_hide->add(hide_menu); exec_and_hide->add(exec_cmd); @@ -2192,9 +2189,9 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { "Focus Model"), focus_menu); #ifdef SLIT - if (getSlit() != 0) { - getSlit()->menu().setInternalMenu(); - menu.insert("Slit", &getSlit()->menu()); + if (slit() != 0) { + slit()->menu().setInternalMenu(); + menu.insert("Slit", &slit()->menu()); } #endif // SLIT menu.insert(i18n->getMessage( @@ -2346,8 +2343,8 @@ void BScreen::showPosition(int x, int y) { getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, geom_w, geom_h); #else // !XINERMA - geom_window.moveResize((getWidth() - geom_w) / 2, - (getHeight() - geom_h) / 2, geom_w, geom_h); + geom_window.moveResize((width() - geom_w) / 2, + (height() - geom_h) / 2, geom_w, geom_h); #endif // XINERAMA geom_window.show(); @@ -2358,20 +2355,18 @@ void BScreen::showPosition(int x, int y) { char label[256]; sprintf(label, - I18n::instance()->getMessage( - FBNLS::ScreenSet, FBNLS::ScreenPositionFormat, + I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionFormat, "X: %4d x Y: %4d"), x, y); geom_window.clear(); - winFrameTheme().font().drawText( - geom_window.window(), - getScreenNumber(), - winFrameTheme().labelTextFocusGC(), - label, strlen(label), - m_root_theme->bevelWidth(), - m_root_theme->bevelWidth() + - winFrameTheme().font().ascent()); + winFrameTheme().font().drawText(geom_window.window(), + screenNumber(), + winFrameTheme().labelTextFocusGC(), + label, strlen(label), + m_root_theme->bevelWidth(), + m_root_theme->bevelWidth() + + winFrameTheme().font().ascent()); } @@ -2385,8 +2380,8 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, geom_w, geom_h); #else // !XINERMA - geom_window.moveResize((getWidth() - geom_w) / 2, - (getHeight() - geom_h) / 2, geom_w, geom_h); + geom_window.moveResize((width() - geom_w) / 2, + (height() - geom_h) / 2, geom_w, geom_h); #endif // XINERAMA geom_window.show(); geom_window.raise(); @@ -2405,12 +2400,12 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { //TODO: geom window again?! repeated winFrameTheme().font().drawText(geom_window.window(), - getScreenNumber(), - winFrameTheme().labelTextFocusGC(), - label, strlen(label), - m_root_theme->bevelWidth(), - m_root_theme->bevelWidth() + - winFrameTheme().font().ascent()); + screenNumber(), + winFrameTheme().labelTextFocusGC(), + label, strlen(label), + m_root_theme->bevelWidth(), + m_root_theme->bevelWidth() + + winFrameTheme().font().ascent()); } @@ -2430,30 +2425,30 @@ void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { Goes to the workspace "right" of the current */ void BScreen::nextWorkspace(const int delta) { - changeWorkspaceID( (getCurrentWorkspaceID() + delta) % getCount()); + changeWorkspaceID( (currentWorkspaceID() + delta) % getCount()); } /** Goes to the workspace "left" of the current */ void BScreen::prevWorkspace(const int delta) { - changeWorkspaceID( (getCurrentWorkspaceID() - delta + getCount()) % getCount()); + changeWorkspaceID( (currentWorkspaceID() - delta + getCount()) % getCount()); } /** Goes to the workspace "right" of the current */ void BScreen::rightWorkspace(const int delta) { - if (getCurrentWorkspaceID()+delta < getCount()) - changeWorkspaceID(getCurrentWorkspaceID()+delta); + if (currentWorkspaceID()+delta < getCount()) + changeWorkspaceID(currentWorkspaceID()+delta); } /** Goes to the workspace "left" of the current */ void BScreen::leftWorkspace(const int delta) { - if (getCurrentWorkspaceID() >= static_cast(delta)) - changeWorkspaceID(getCurrentWorkspaceID()-delta); + if (currentWorkspaceID() >= static_cast(delta)) + changeWorkspaceID(currentWorkspaceID()-delta); } /** @@ -2521,11 +2516,11 @@ void BScreen::updateSize() { // reset background m_root_theme->reconfigTheme(); - if (getToolbar()) - getToolbar()->reconfigure(); + if (toolbar()) + toolbar()->reconfigure(); - if (getSlit()) - getSlit()->reconfigure(); + if (slit()) + slit()->reconfigure(); //!! TODO: should we re-maximize the maximized windows? diff --git a/src/Screen.hh b/src/Screen.hh index 72647a6..a5a9672 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.96 2003/05/13 21:12:17 fluxgen Exp $ +// $Id: Screen.hh,v 1.97 2003/05/15 12:00:44 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -106,8 +106,8 @@ public: inline bool &doSlitAutoHide() { return *resource.slit_auto_hide; } inline const bool &doSlitAutoHide() const { return *resource.slit_auto_hide; } - inline Slit *getSlit() { return m_slit.get(); } - inline const Slit *getSlit() const { return m_slit.get(); } + inline Slit *slit() { return m_slit.get(); } + inline const Slit *slit() const { return m_slit.get(); } inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } @@ -119,31 +119,31 @@ public: inline unsigned int getSlitOnHead() const { return resource.slit_on_head; } inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; } - inline const Toolbar *getToolbar() const { return m_toolbarhandler->getToolbar(); } - inline Toolbar *getToolbar() { return m_toolbarhandler->getToolbar(); } + inline const Toolbar *toolbar() const { return m_toolbarhandler->getToolbar(); } + inline Toolbar *toolbar() { return m_toolbarhandler->getToolbar(); } - inline const ToolbarHandler &getToolbarHandler() const { return *m_toolbarhandler; } - inline ToolbarHandler &getToolbarHandler() { return *m_toolbarhandler; } + inline const ToolbarHandler &toolbarHandler() const { return *m_toolbarhandler; } + inline ToolbarHandler &toolbarHandler() { return *m_toolbarhandler; } inline Workspace *getWorkspace(unsigned int w) { return ( w < workspacesList.size() ? workspacesList[w] : 0); } - inline Workspace *getCurrentWorkspace() { return current_workspace; } + inline Workspace *currentWorkspace() { return current_workspace; } const FbTk::Menu *getWorkspacemenu() const { return workspacemenu.get(); } FbTk::Menu *getWorkspacemenu() { return workspacemenu.get(); } - unsigned int getCurrentWorkspaceID() const; + unsigned int currentWorkspaceID() const; Pixmap rootPixmap() const; /* maximum screen surface */ - unsigned int getMaxLeft() const; - unsigned int getMaxRight() const; - unsigned int getMaxTop() const; - unsigned int getMaxBottom() const; - - inline unsigned int getWidth() const { return rootWindow().width(); } - inline unsigned int getHeight() const { return rootWindow().height(); } - inline unsigned int getScreenNumber() const { return rootWindow().screenNumber(); } + unsigned int maxLeft() const; + unsigned int maxRight() const; + unsigned int maxTop() const; + unsigned int maxBottom() const; + + inline unsigned int width() const { return rootWindow().width(); } + inline unsigned int height() const { return rootWindow().height(); } + inline unsigned int screenNumber() const { return rootWindow().screenNumber(); } typedef std::vector Icons; typedef std::list FocusedWindows; diff --git a/src/Slit.cc b/src/Slit.cc index 936815d..bcd59b3 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Slit.cc,v 1.52 2003/05/13 21:09:43 fluxgen Exp $ +// $Id: Slit.cc,v 1.53 2003/05/15 12:00:45 fluxgen Exp $ #include "Slit.hh" @@ -245,7 +245,7 @@ private: class SlitTheme:public FbTk::Theme { public: - explicit SlitTheme(Slit &slit):FbTk::Theme(slit.screen().getScreenNumber()), + explicit SlitTheme(Slit &slit):FbTk::Theme(slit.screen().screenNumber()), m_slit(slit), m_texture(*this, "slit", "Slit") { // default texture type @@ -263,19 +263,19 @@ private: Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) : m_screen(scr), m_timer(this), m_slitmenu(*scr.menuTheme(), - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_placement_menu(*scr.menuTheme(), - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_clientlist_menu(*scr.menuTheme(), - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_layermenu(new LayerMenu(*scr.menuTheme(), - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, @@ -322,7 +322,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) FbTk::EventManager::instance()->add(*this, frame.window); m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(), *screen().slitAlphaResource(), - screen().getScreenNumber())); + screen().screenNumber())); m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); @@ -387,8 +387,8 @@ void Slit::addClient(Window w) { if (wmhints != 0) { if ((wmhints->flags & IconWindowHint) && (wmhints->icon_window != None)) { - XMoveWindow(disp, client->client_window, screen().getWidth() + 10, - screen().getHeight() + 10); + XMoveWindow(disp, client->client_window, screen().width() + 10, + screen().height() + 10); XMapWindow(disp, client->client_window); client->icon_window = wmhints->icon_window; client->window = client->icon_window; @@ -790,8 +790,8 @@ void Slit::reposition() { head_w, head_h; - head_w = screen().getWidth(); - head_h = screen().getHeight(); + head_w = screen().width(); + head_h = screen().height(); int border_width = screen().rootTheme().borderWidth(); int bevel_width = screen().rootTheme().bevelWidth(); @@ -985,13 +985,13 @@ void Slit::buttonPressEvent(XButtonEvent &e) { if (x < 0) x = 0; - else if (x + m_slitmenu.width() > screen().getWidth()) - x = screen().getWidth() - m_slitmenu.width(); + else if (x + m_slitmenu.width() > screen().width()) + x = screen().width() - m_slitmenu.width(); if (y < 0) y = 0; - else if (y + m_slitmenu.height() > screen().getHeight()) - y = screen().getHeight() - m_slitmenu.height(); + else if (y + m_slitmenu.height() > screen().height()) + y = screen().height() - m_slitmenu.height(); m_slitmenu.move(x, y); m_slitmenu.show(); @@ -1077,7 +1077,7 @@ void Slit::clearWindow() { frame.window.clear(); if (frame.pixmap != 0) { if (screen().rootPixmap() != m_transp->source()) - m_transp->setSource(screen().rootPixmap(), screen().getScreenNumber()); + m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); m_transp->render(frame.window.x(), frame.window.y(), 0, 0, diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 7bf8291..3053c09 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.81 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.82 2003/05/15 12:00:45 fluxgen Exp $ #include "Toolbar.hh" @@ -250,20 +250,20 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi editing(false), hidden(scrn.doToolbarAutoHide()), do_auto_hide(scrn.doToolbarAutoHide()), - frame(*this, scrn.getScreenNumber()), + frame(*this, scrn.screenNumber()), m_screen(scrn), m_clock_timer(this), // get the clock updating every minute m_hide_timer(&hide_handler), m_toolbarmenu(menu), m_placementmenu(*scrn.menuTheme(), - scrn.getScreenNumber(), *scrn.getImageControl()), + scrn.screenNumber(), *scrn.getImageControl()), m_layermenu(*scrn.menuTheme(), - scrn.getScreenNumber(), + scrn.screenNumber(), *scrn.getImageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, true), - m_theme(scrn.getScreenNumber()), + m_theme(scrn.screenNumber()), m_place(BOTTOMCENTER), m_themelistener(*this), m_layeritem(frame.window, layer) { @@ -778,7 +778,7 @@ void Toolbar::checkClock(bool redraw, bool date) { frame.clock.clear(); m_theme.font().drawText( frame.clock.window(), - screen().getScreenNumber(), + screen().screenNumber(), m_theme.clockTextGC(), t, newlen, dx, dy); @@ -813,7 +813,7 @@ void Toolbar::redrawWindowLabel(bool redraw) { m_theme.font().drawText( frame.window_label.window(), - screen().getScreenNumber(), + screen().screenNumber(), m_theme.windowTextGC(), foc->title().c_str(), newlen, dx, dy); @@ -823,14 +823,14 @@ void Toolbar::redrawWindowLabel(bool redraw) { void Toolbar::redrawWorkspaceLabel(bool redraw) { - if (screen().getCurrentWorkspace()->name().size()==0) + if (screen().currentWorkspace()->name().size()==0) return; if (redraw) frame.workspace_label.clear(); - const char *text = screen().getCurrentWorkspace()->name().c_str(); - size_t textlen = screen().getCurrentWorkspace()->name().size(); + const char *text = screen().currentWorkspace()->name().c_str(); + size_t textlen = screen().currentWorkspace()->name().size(); unsigned int newlen = textlen; int dx = FbTk::doAlignment(frame.workspace_label_w, frame.bevel_w, m_theme.justify(), @@ -844,7 +844,7 @@ void Toolbar::redrawWorkspaceLabel(bool redraw) { } m_theme.font().drawText( frame.workspace_label.window(), - screen().getScreenNumber(), + screen().screenNumber(), m_theme.labelTextGC(), text, newlen, dx, dy); @@ -906,8 +906,8 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { } if (menu_x < 0) { menu_x = 0; - } else if (menu_x + wm.width() > screen().getWidth()) { - menu_x = screen().getWidth() - wm.width(); + } else if (menu_x + wm.width() > screen().width()) { + menu_x = screen().width() - wm.width(); } fluxboxwin->showMenu(menu_x, menu_y); @@ -919,13 +919,13 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { if (x < 0) x = 0; - else if (x + m_toolbarmenu.width() > screen().getWidth()) - x = screen().getWidth() - m_toolbarmenu.width(); + else if (x + m_toolbarmenu.width() > screen().width()) + x = screen().width() - m_toolbarmenu.width(); if (y < 0) y = 0; - else if (y + m_toolbarmenu.height() > screen().getHeight()) - y = screen().getHeight() - m_toolbarmenu.height(); + else if (y + m_toolbarmenu.height() > screen().height()) + y = screen().height() - m_toolbarmenu.height(); m_toolbarmenu.move(x, y); m_toolbarmenu.show(); @@ -949,13 +949,13 @@ void Toolbar::buttonReleaseEvent(XButtonEvent &re) { int newy = menu->y(); // new y position of menu if (menu->x() < 0) newx = 0; - else if (menu->x() + menu->width() > screen().getWidth()) - newx = screen().getWidth() - menu->width(); + else if (menu->x() + menu->width() > screen().width()) + newx = screen().width() - menu->width(); if (menu->y() < 0) newy = 0; - else if (menu->y() + menu->height() > screen().getHeight()) - newy = screen().getHeight() - menu->height(); + else if (menu->y() + menu->height() > screen().height()) + newy = screen().height() - menu->height(); // move and show menu menu->move(newx, newy); menu->show(); @@ -1029,7 +1029,7 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) { XSetInputFocus(display, PointerRoot, None, CurrentTime); if (ks == XK_Return) //change workspace name if keypress = Return - screen().getCurrentWorkspace()->setName(new_workspace_name.c_str()); + screen().currentWorkspace()->setName(new_workspace_name.c_str()); new_workspace_name.erase(); //erase temporary workspace name reconfigure(); @@ -1060,7 +1060,7 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) { } m_theme.font().drawText(frame.workspace_label.window(), - screen().getScreenNumber(), + screen().screenNumber(), screen().winFrameTheme().labelTextFocusGC(), new_workspace_name.c_str(), l, x, dy); @@ -1091,8 +1091,8 @@ void Toolbar::setPlacement(Toolbar::Placement where) { m_place = where; - head_w = screen().getWidth(); - head_h = screen().getHeight(); + head_w = screen().width(); + head_h = screen().height(); frame.width = head_w * screen().getToolbarWidthPercent() / 100; frame.height = m_theme.font().height(); diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc index 1bc13c1..174f28c 100644 --- a/src/ToolbarHandler.cc +++ b/src/ToolbarHandler.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.cc,v 1.11 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: ToolbarHandler.cc,v 1.12 2003/05/15 12:00:45 fluxgen Exp $ /** * The ToolbarHandler class acts as a rough interface to the toolbar. @@ -91,9 +91,9 @@ void setupModeMenu(FbTk::Menu &menu, ToolbarHandler &handler) { ToolbarHandler::ToolbarHandler(BScreen &screen, ToolbarMode mode) : m_screen(screen), m_mode(mode), m_toolbar(0), m_current_workspace(0), m_modemenu(*screen.menuTheme(), - screen.getScreenNumber(), *screen.getImageControl()), + screen.screenNumber(), *screen.getImageControl()), m_toolbarmenu(*screen.menuTheme(), - screen.getScreenNumber(), *screen.getImageControl()) + screen.screenNumber(), *screen.getImageControl()) { m_modemenu.setInternalMenu(); setupModeMenu(m_modemenu, *this); @@ -147,8 +147,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) { break; case NONE: break; - case ALLWINDOWS: - { + case ALLWINDOWS: { BScreen::Workspaces::const_iterator workspace_it = m_screen.getWorkspacesList().begin(); BScreen::Workspaces::const_iterator workspace_it_end = m_screen.getWorkspacesList().end(); for (; workspace_it != workspace_it_end; ++workspace_it) { @@ -168,8 +167,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) { } // fall through and add icons case LASTMODE: - case ICONS: - { + case ICONS: { BScreen::Icons &iconlist = m_screen.getIconList(); BScreen::Icons::iterator iconit = iconlist.begin(); BScreen::Icons::iterator iconit_end = iconlist.end(); @@ -178,9 +176,8 @@ void ToolbarHandler::initForScreen(BScreen &screen) { } } break; - case WORKSPACE: - { - Workspace::Windows &wins = m_screen.getCurrentWorkspace()->windowList(); + case WORKSPACE: { + Workspace::Windows &wins = m_screen.currentWorkspace()->windowList(); Workspace::Windows::iterator wit = wins.begin(); Workspace::Windows::iterator wit_end = wins.end(); for (; wit != wit_end; ++wit) { @@ -188,9 +185,8 @@ void ToolbarHandler::initForScreen(BScreen &screen) { } } // fall through and add icons for this workspace - case WORKSPACEICONS: - { - m_current_workspace = m_screen.getCurrentWorkspaceID(); + case WORKSPACEICONS: { + m_current_workspace = m_screen.currentWorkspaceID(); BScreen::Icons &wiconlist = m_screen.getIconList(); BScreen::Icons::iterator iconit = wiconlist.begin(); @@ -273,7 +269,8 @@ void ToolbarHandler::updateState(FluxboxWindow &win) { case ALLWINDOWS: break; case WORKSPACEICONS: - if (win.workspaceNumber() != m_current_workspace) break; + if (win.workspaceNumber() != m_current_workspace) + break; // else fall through and do the same as icons (knowing it is the right ws) case LASTMODE: case ICONS: @@ -313,10 +310,12 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) { } void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) { - if (&screen != &m_screen) return; + if (&screen != &m_screen) + return; // if only displaying current workspace, update list // otherwise ignore it - if (m_mode != WORKSPACE && m_mode != WORKSPACEICONS) return; + if (m_mode != WORKSPACE && m_mode != WORKSPACEICONS) + return; m_toolbar->delAllIcons(); initForScreen(m_screen); } diff --git a/src/Window.cc b/src/Window.cc index 1216d63..5c681ea 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.176 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Window.cc,v 1.177 2003/05/15 12:00:46 fluxgen Exp $ #include "Window.hh" @@ -236,16 +236,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t m_screen(scr), m_timer(this), display(0), - m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), + m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()), m_layermenu(new LayerMenu(menutheme, - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, false)), m_old_decoration(DECOR_NORMAL), m_client(&client), - m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), + m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)), m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) { @@ -269,16 +269,16 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, m_screen(scr), m_timer(this), display(0), - m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), + m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()), m_layermenu(new LayerMenu(menutheme, - scr.getScreenNumber(), + scr.screenNumber(), *scr.getImageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, false)), m_old_decoration(DECOR_NORMAL), m_client(new WinClient(w, *this)), - m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), + m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)), m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) { @@ -484,8 +484,8 @@ void FluxboxWindow::init() { if (real_x >= 0 && real_y + frame().y() >= 0 && - real_x <= (signed) screen().getWidth() && - real_y <= (signed) screen().getHeight()) + real_x <= (signed) screen().width() && + real_y <= (signed) screen().height()) place_window = false; } else @@ -500,7 +500,7 @@ void FluxboxWindow::init() { positionWindows(); if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) - m_workspace_number = screen().getCurrentWorkspaceID(); + m_workspace_number = screen().currentWorkspaceID(); restoreAttributes(); @@ -1180,23 +1180,23 @@ bool FluxboxWindow::setInputFocus() { if (((signed) (frame().y() + frame().height())) < 0) { moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), frame().width(), frame().height()); - } else if (frame().y() > (signed) screen().getHeight()) { - moveResize(screen().rootTheme().borderWidth(), screen().getHeight() - frame().height(), + } else if (frame().y() > (signed) screen().height()) { + moveResize(screen().rootTheme().borderWidth(), screen().height() - frame().height(), frame().width(), frame().height()); } else { moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), frame().width(), frame().height()); } - } else if (frame().x() > (signed) screen().getWidth()) { + } else if (frame().x() > (signed) screen().width()) { if (((signed) (frame().y() + frame().height())) < 0) { - moveResize(screen().getWidth() - frame().width(), screen().rootTheme().borderWidth(), + moveResize(screen().width() - frame().width(), screen().rootTheme().borderWidth(), frame().width(), frame().height()); - } else if (frame().y() > (signed) screen().getHeight()) { - moveResize(screen().getWidth() - frame().width(), - screen().getHeight() - frame().height(), + } else if (frame().y() > (signed) screen().height()) { + moveResize(screen().width() - frame().width(), + screen().height() - frame().height(), frame().width(), frame().height()); } else { - moveResize(screen().getWidth() - frame().width(), + moveResize(screen().width() - frame().width(), frame().y() + screen().rootTheme().borderWidth(), frame().width(), frame().height()); } @@ -1299,8 +1299,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { oplock = true; if (iconic || reassoc) { - screen().reassociateWindow(this, screen().getCurrentWorkspace()->workspaceID(), false); - } else if (moving || m_workspace_number != screen().getCurrentWorkspace()->workspaceID()) { + screen().reassociateWindow(this, screen().currentWorkspace()->workspaceID(), false); + } else if (moving || m_workspace_number != screen().currentWorkspace()->workspaceID()) { oplock = false; return; } @@ -1384,12 +1384,12 @@ void FluxboxWindow::maximize() { m_old_height = frame().height(); m_old_pos_x = frame().x(); m_old_pos_y = frame().y(); - unsigned int left_x = screen().getMaxLeft(); - unsigned int max_width = screen().getMaxRight(); - unsigned int max_top = screen().getMaxTop(); + unsigned int left_x = screen().maxLeft(); + unsigned int max_width = screen().maxRight(); + unsigned int max_top = screen().maxTop(); moveResize(left_x, max_top, max_width - left_x, - screen().getMaxBottom() - max_top - frame().window().borderWidth()); + screen().maxBottom() - max_top - frame().window().borderWidth()); } else { // demaximize, restore to old values moveResize(m_old_pos_x, m_old_pos_y, m_old_width, m_old_height); @@ -1399,8 +1399,8 @@ void FluxboxWindow::maximize() { } void FluxboxWindow::maximizeHorizontal() { - unsigned int left_x = screen().getMaxLeft(); - unsigned int max_width = screen().getMaxRight(); + unsigned int left_x = screen().maxLeft(); + unsigned int max_width = screen().maxRight(); moveResize(left_x, frame().y(), max_width - left_x, frame().height() - frame().window().borderWidth()); @@ -1410,10 +1410,10 @@ void FluxboxWindow::maximizeHorizontal() { Maximize window horizontal */ void FluxboxWindow::maximizeVertical() { - unsigned int max_top = screen().getMaxTop(); + unsigned int max_top = screen().maxTop(); moveResize(frame().x(), max_top, frame().width() - frame().window().borderWidth(), - screen().getMaxBottom() - max_top); + screen().maxBottom() - max_top); } @@ -1862,7 +1862,7 @@ void FluxboxWindow::restoreAttributes() { m_current_state = save_state; } - if (( m_blackbox_attrib.workspace != screen().getCurrentWorkspaceID()) && + if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && ( m_blackbox_attrib.workspace < screen().getCount())) { m_workspace_number = m_blackbox_attrib.workspace; @@ -2434,12 +2434,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { m_last_resize_y = me.y_root; if (moved_x && screen().isWorkspaceWarping()) { - unsigned int cur_id = screen().getCurrentWorkspaceID(); + unsigned int cur_id = screen().currentWorkspaceID(); unsigned int new_id = cur_id; const int warpPad = screen().getEdgeSnapThreshold(); // 1) if we're inside the border threshold // 2) if we moved in the right direction - if (me.x_root >= int(screen().getWidth()) - warpPad - 1 && + if (me.x_root >= int(screen().width()) - warpPad - 1 && moved_x > 0) { //warp right new_id = (cur_id + 1) % screen().getCount(); @@ -2448,7 +2448,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { moved_x < 0) { //warp left new_id = (cur_id + screen().getCount() - 1) % screen().getCount(); - dx = screen().getWidth() - me.x_root-1; // move mouse to screen width - 1 + dx = screen().width() - me.x_root-1; // move mouse to screen width - 1 } if (new_id != cur_id) { XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); @@ -2559,12 +2559,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { dy -= screen().rootTheme().borderWidth(); if (screen().getEdgeSnapThreshold()) { - int drx = screen().getWidth() - (dx + 1); + int drx = screen().width() - (dx + 1); if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold()) dx = 0; else if (drx > 0 && drx < screen().getEdgeSnapThreshold()) - dx = screen().getWidth() - 1; + dx = screen().width() - 1; int dty, dby; @@ -2821,8 +2821,8 @@ void FluxboxWindow::stopMoving() { frame().width() + 2*frame().window().borderWidth()-1, frame().height() + 2*frame().window().borderWidth()-1); moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); - if (m_workspace_number != screen().getCurrentWorkspaceID()) { - screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true); + if (m_workspace_number != screen().currentWorkspaceID()) { + screen().reassociateWindow(this, screen().currentWorkspaceID(), true); frame().show(); } fluxbox->ungrab(); @@ -2853,7 +2853,7 @@ void FluxboxWindow::resumeMoving() { return; } - if (m_workspace_number == screen().getCurrentWorkspaceID()) { + if (m_workspace_number == screen().currentWorkspaceID()) { frame().show(); } XSync(display,false); @@ -2930,13 +2930,13 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { ///////////////////////////////////// // begin by checking the screen edges - snapToWindow(dx, dy, left, right, top, bottom, 0, screen().getWidth(), 0, screen().getHeight()); + snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height()); ///////////////////////////////////// // now check window edges Workspace::Windows &wins = - screen().getCurrentWorkspace()->windowList(); + screen().currentWorkspace()->windowList(); Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it_end = wins.end(); @@ -2951,26 +2951,6 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { (*it)->y() + (*it)->height() + 2*borderW); } - ///////////////////////////////////// - // now the toolbar - - Toolbar *tbar = screen().getToolbar(); - if (tbar) - snapToWindow(dx, dy, left, right, top, bottom, - tbar->x(), tbar->x() + tbar->width() + 2*borderW, - tbar->y(), tbar->y() + tbar->height() + 2*borderW); - - ///////////////////////////////////// - // and the slit - -#ifdef SLIT - Slit *slit = screen().getSlit(); - if (slit) - snapToWindow(dx, dy, left, right, top, bottom, - slit->x(), slit->x() + slit->width() + 2*borderW, - slit->y(), slit->y() + slit->height() + 2*borderW); -#endif // SLIT - // commit if (dx <= screen().getEdgeSnapThreshold()) orig_left += dx; @@ -3066,10 +3046,11 @@ void FluxboxWindow::attachTo(int x, int y) { //finds and redraw the icon label void FluxboxWindow::updateIcon() { - if (screen().getToolbar()) { + //!! TODO we shouldn't know about the toolbar in fluxboxwindow! + if (screen().toolbar()) { const IconBar *iconbar = 0; const IconBarObj *icon = 0; - if ((iconbar = screen().getToolbar()->iconBar()) != 0) { + if ((iconbar = screen().toolbar()->iconBar()) != 0) { if ((icon = iconbar->findIcon(this)) != 0) iconbar->draw(icon, icon->width()); } @@ -3216,7 +3197,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { screen().reassociateWindow(this, net.workspace, true); - if (screen().getCurrentWorkspaceID() != net.workspace) + if (screen().currentWorkspaceID() != net.workspace) withdraw(); else deiconify(); diff --git a/src/Workspace.cc b/src/Workspace.cc index 0f89986..2b1a504 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.64 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Workspace.cc,v 1.65 2003/05/15 12:00:46 fluxgen Exp $ #include "Workspace.hh" @@ -115,7 +115,7 @@ Workspace::GroupList Workspace::m_groups; Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i): m_screen(scrn), m_lastfocus(0), - m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()), + m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), *scrn.getImageControl()), m_layermanager(layermanager), m_name(""), m_id(i), @@ -401,7 +401,7 @@ void Workspace::update() { bool Workspace::isCurrent() const{ - return (m_id == screen().getCurrentWorkspaceID()); + return (m_id == screen().currentWorkspaceID()); } @@ -440,7 +440,7 @@ void Workspace::setName(const std::string &name) { */ void Workspace::shutdown() { #ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<(cerr, " \n")); @@ -507,10 +507,10 @@ void Workspace::placeWindow(FluxboxWindow &win) { test_x = root_x - (win_w / 2); test_y = root_y - (win_h / 2); - min_x = (int) screen().getMaxLeft(); - min_y = (int) screen().getMaxTop(); - max_x = (int) screen().getMaxRight() - win_w; - max_y = (int) screen().getMaxBottom() - win_h; + min_x = (int) screen().maxLeft(); + min_y = (int) screen().maxTop(); + max_x = (int) screen().maxRight() - win_w; + max_y = (int) screen().maxBottom() - win_h; // keep the window inside the screen @@ -539,21 +539,21 @@ void Workspace::placeWindow(FluxboxWindow &win) { test_y = 0; if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) - test_y = screen().getHeight() - win_h - test_y; + test_y = screen().height() - win_h - test_y; while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? - test_y > 0 : test_y + win_h < (signed) screen().getHeight()) && + test_y > 0 : test_y + win_h < (signed) screen().height()) && ! placed) { test_x = 0; if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) - test_x = screen().getWidth() - win_w - test_x; + test_x = screen().width() - win_w - test_x; while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? - test_x > 0 : test_x + win_w < (signed) screen().getWidth()) && ! placed) { + test_x > 0 : test_x + win_w < (signed) screen().width()) && ! placed) { placed = true; @@ -599,19 +599,19 @@ void Workspace::placeWindow(FluxboxWindow &win) { if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) - test_x = screen().getWidth() - win_w - test_x; + test_x = screen().width() - win_w - test_x; while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? - test_x > 0 : test_x + win_w < (signed) screen().getWidth()) && + test_x > 0 : test_x + win_w < (signed) screen().width()) && !placed) { test_y = 0; if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) - test_y = screen().getHeight() - win_h - test_y; + test_y = screen().height() - win_h - test_y; while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? - test_y > 0 : test_y + win_h < (signed) screen().getHeight()) && + test_y > 0 : test_y + win_h < (signed) screen().height()) && !placed) { placed = True; @@ -656,8 +656,8 @@ void Workspace::placeWindow(FluxboxWindow &win) { // cascade placement or smart placement failed if (! placed) { - if (((unsigned) m_cascade_x > (screen().getWidth() / 2)) || - ((unsigned) m_cascade_y > (screen().getHeight() / 2))) + if (((unsigned) m_cascade_x > (screen().width() / 2)) || + ((unsigned) m_cascade_y > (screen().height() / 2))) m_cascade_x = m_cascade_y = 32; place_x = m_cascade_x; @@ -667,10 +667,10 @@ void Workspace::placeWindow(FluxboxWindow &win) { m_cascade_y += win.titleHeight(); } - if (place_x + win_w > (signed) screen().getWidth()) - place_x = (((signed) screen().getWidth()) - win_w) / 2; - if (place_y + win_h > (signed) screen().getHeight()) - place_y = (((signed) screen().getHeight()) - win_h) / 2; + if (place_x + win_w > (signed) screen().width()) + place_x = (((signed) screen().width()) - win_w) / 2; + if (place_y + win_h > (signed) screen().height()) + place_y = (((signed) screen().height()) - win_h) / 2; win.moveResize(place_x, place_y, win.width(), win.height()); diff --git a/src/fluxbox.cc b/src/fluxbox.cc index c67daf5..a5f9d9b 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.148 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.149 2003/05/15 12:00:46 fluxgen Exp $ #include "fluxbox.hh" @@ -523,7 +523,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile #endif // HAVE_RANDR m_screen_list.push_back(screen); - m_atomhandler.push_back(&screen->getToolbarHandler()); + m_atomhandler.push_back(&screen->toolbarHandler()); // attach screen signals to this screen->currentWorkspaceSig().attach(this); @@ -919,15 +919,15 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { if (my < 0) my = 0; if (mx + screen->getWorkspacemenu()->width() > - screen->getWidth()) { - mx = screen->getWidth() - + screen->width()) { + mx = screen->width() - screen->getWorkspacemenu()->width() - screen->getWorkspacemenu()->fbwindow().borderWidth(); } if (my + screen->getWorkspacemenu()->height() > - screen->getHeight()) { - my = screen->getHeight() - + screen->height()) { + my = screen->height() - screen->getWorkspacemenu()->height() - screen->getWorkspacemenu()->fbwindow().borderWidth(); } @@ -948,15 +948,15 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { if (mx < 0) mx = 0; if (my < 0) my = 0; - if (mx + screen->getRootmenu()->width() > screen->getWidth()) { - mx = screen->getWidth() - + if (mx + screen->getRootmenu()->width() > screen->width()) { + mx = screen->width() - screen->getRootmenu()->width() - screen->getRootmenu()->fbwindow().borderWidth(); } if (my + screen->getRootmenu()->height() > - screen->getHeight()) { - my = screen->getHeight() - + screen->height()) { + my = screen->height() - screen->getRootmenu()->height() - screen->getRootmenu()->fbwindow().borderWidth(); } @@ -1274,7 +1274,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { case Keys::ATTACHLAST: //!! just attach last window to focused window if (m_focused_window) { - Workspace *space = keyscreen->getCurrentWorkspace(); + Workspace *space = keyscreen->currentWorkspace(); Workspace::Windows &wins = space->windowList(); if (wins.size() == 1) break; @@ -1283,7 +1283,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { for (; it != fwins.end(); ++it) { if ((*it)->fbwindow() != m_focused_window && (*it)->fbwindow()->workspaceNumber() == - keyscreen->getCurrentWorkspaceID()) { + keyscreen->currentWorkspaceID()) { m_focused_window->attachClient(**it); break; } @@ -1296,7 +1296,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { } break; case Keys::EXECUTE: { //execute command on keypress - FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->getScreenNumber()); + FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber()); cmd.execute(); } break; case Keys::QUIT: @@ -1314,15 +1314,15 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { if (mx < 0) mx = 0; if (my < 0) my = 0; - if (mx + mousescreen->getRootmenu()->width() > mousescreen->getWidth()) { - mx = mousescreen->getWidth() - + if (mx + mousescreen->getRootmenu()->width() > mousescreen->width()) { + mx = mousescreen->width() - mousescreen->getRootmenu()->width() - mousescreen->getRootmenu()->fbwindow().borderWidth(); } if (my + mousescreen->getRootmenu()->height() > - mousescreen->getHeight()) { - my = mousescreen->getHeight() - + mousescreen->height()) { + my = mousescreen->height() - mousescreen->getRootmenu()->height() - mousescreen->getRootmenu()->fbwindow().borderWidth(); } @@ -1571,9 +1571,9 @@ void Fluxbox::update(FbTk::Subject *changedsub) { // if we're sticky then reassociate window // to all workspaces BScreen &scr = win.screen(); - if (scr.getCurrentWorkspaceID() != win.workspaceNumber()) { + if (scr.currentWorkspaceID() != win.workspaceNumber()) { scr.reassociateWindow(&win, - scr.getCurrentWorkspaceID(), + scr.currentWorkspaceID(), true); } } @@ -1785,7 +1785,7 @@ void Fluxbox::save_rc() { for (; it != it_end; ++it) { BScreen *screen = *it; - int screen_number = screen->getScreenNumber(); + int screen_number = screen->screenNumber(); /* #ifdef SLIT @@ -2003,7 +2003,7 @@ void Fluxbox::load_rc(BScreen &screen) { XrmValue value; char *value_type, name_lookup[1024], class_lookup[1024]; - int screen_number = screen.getScreenNumber(); + int screen_number = screen.screenNumber(); sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number); sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number); @@ -2185,8 +2185,8 @@ void Fluxbox::loadRootCommand(BScreen &screen) { XrmValue value; char *value_type, name_lookup[1024], class_lookup[1024]; - sprintf(name_lookup, "session.screen%d.rootCommand", screen.getScreenNumber()); - sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.getScreenNumber()); + sprintf(name_lookup, "session.screen%d.rootCommand", screen.screenNumber()); + sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.screenNumber()); if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, &value)) { screen.saveRootCommand(value.addr==0 ? "": value.addr); @@ -2368,7 +2368,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { old_win = m_focused_window; old_screen = &old_win->screen(); - old_tbar = old_screen->getToolbar(); + old_tbar = old_screen->toolbar(); old_wkspc = old_screen->getWorkspace(old_win->workspaceNumber()); old_win->setFocusFlag(false); @@ -2385,7 +2385,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { m_focused_window = 0; // the window pointer wasn't valid, mark no window focused } else { screen = *winscreen; - tbar = screen->getToolbar(); + tbar = screen->toolbar(); wkspc = screen->getWorkspace(win->workspaceNumber()); m_focused_window = win; // update focused window win->setFocusFlag(true); // set focus flag @@ -2419,7 +2419,7 @@ void Fluxbox::revertFocus(BScreen &screen) { // Relevant resources: // resource.focus_last = whether we focus last focused when changing workspace // Fluxbox::FocusModel = sloppy, click, whatever - WinClient *next_focus = screen.getLastFocusedWindow(screen.getCurrentWorkspaceID()); + WinClient *next_focus = screen.getLastFocusedWindow(screen.currentWorkspaceID()); // if setting focus fails, or isn't possible, fallback correctly if (!(next_focus && next_focus->fbwindow() && -- cgit v0.11.2