From bb02a522fbc7c47ebd1ddacafd466ccf59e58915 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 18 Dec 2003 18:03:23 +0000 Subject: code cleaning --- src/Ewmh.cc | 4 +-- src/FbTk/Menu.cc | 79 +++++++++++++++++++++------------------------ src/FbTk/Menu.hh | 8 ++--- src/FbWinFrame.cc | 6 ++-- src/FbWinFrame.hh | 6 ++-- src/IconbarTool.cc | 4 +-- src/Screen.cc | 12 +++---- src/Screen.hh | 6 ++-- src/SendToMenu.cc | 4 +-- src/Slit.cc | 10 +++--- src/Toolbar.cc | 10 +++--- src/Window.cc | 94 +++++++++++++++++++++++------------------------------- src/Window.hh | 29 +++++++++-------- src/Workspace.cc | 20 ++++++------ src/Workspace.hh | 2 +- 15 files changed, 139 insertions(+), 155 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index c2b6203..80ff727 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.34 2003/12/12 15:19:22 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.35 2003/12/18 18:03:21 fluxgen Exp $ #include "Ewmh.hh" @@ -203,7 +203,7 @@ void Ewmh::updateClientList(BScreen &screen) { //number of windows to show in client list num = win; - screen.rootWindow().changeProperty(m_net_client_list, + screen.rootWindow().changeProperty(m_net_client_list, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)wl, num); diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index bb0b352..47dd372 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.50 2003/12/17 00:43:22 fluxgen Exp $ +// $Id: Menu.cc,v 1.51 2003/12/18 18:03:23 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -89,9 +89,9 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): torn = visible = false; - menu.x = - menu.y = - menu.x_shift = + + + menu.x_shift = menu.y_shift = menu.x_move = menu.y_move = 0; @@ -600,8 +600,6 @@ void Menu::internal_hide() { void Menu::move(int x, int y) { - menu.x = x; - menu.y = y; menu.window.move(x, y); if (which_sub != -1) @@ -663,47 +661,47 @@ void Menu::drawSubmenu(unsigned int index) { if (item->submenu()->m_parent != this) item->submenu()->m_parent = this; - int sbl = index / menu.persub, i = index - (sbl * menu.persub), - x = menu.x + - ((menu.item_w * (sbl + 1)) + menu.window.borderWidth()), y; + int sbl = index / menu.persub, i = index - (sbl * menu.persub); + int new_x = x() + ((menu.item_w * (sbl + 1)) + menu.window.borderWidth()); + int new_y; if (m_alignment == ALIGNTOP) { - y = (((shifted) ? menu.y_shift : menu.y) + - ((title_vis) ? menu.title_h + menu.title.borderWidth() : 0) - - ((item->submenu()->title_vis) ? - item->submenu()->menu.title_h + menu.window.borderWidth() : 0)); + new_y = (((shifted) ? menu.y_shift : y()) + + ((title_vis) ? menu.title_h + menu.title.borderWidth() : 0) - + ((item->submenu()->title_vis) ? + item->submenu()->menu.title_h + menu.window.borderWidth() : 0)); } else { - y = (((shifted) ? menu.y_shift : menu.y) + - (menu.item_h * i) + - ((title_vis) ? menu.title_h + menu.window.borderWidth() : 0) - - ((item->submenu()->title_vis) ? + new_y = (((shifted) ? menu.y_shift : y()) + + (menu.item_h * i) + + ((title_vis) ? menu.title_h + menu.window.borderWidth() : 0) - + ((item->submenu()->title_vis) ? item->submenu()->menu.title_h + menu.window.borderWidth() : 0)); } if (m_alignment == ALIGNBOTTOM && - (y + item->submenu()->height()) > ((shifted) ? menu.y_shift : - menu.y) + height()) { - y = (((shifted) ? menu.y_shift : menu.y) + - height() - item->submenu()->height()); + (new_y + item->submenu()->height()) > ((shifted) ? menu.y_shift : + y()) + height()) { + new_y = (((shifted) ? menu.y_shift : y()) + + height() - item->submenu()->height()); } - if ((x + item->submenu()->width()) > m_screen_width) { - x = ((shifted) ? menu.x_shift : menu.x) - + if ((new_x + item->submenu()->width()) > m_screen_width) { + new_x = ((shifted) ? menu.x_shift : x()) - item->submenu()->width() - menu.window.borderWidth(); } - if (x < 0) - x = 0; + if (new_x < 0) + new_x = 0; - if ((y + item->submenu()->height()) > m_screen_height) { - y = m_screen_height - item->submenu()->height() - + if ((new_y + item->submenu()->height()) > m_screen_height) { + new_y = m_screen_height - item->submenu()->height() - menu.window.borderWidth() * 2; } - if (y < 0) - y = 0; + if (new_y < 0) + new_y = 0; - item->submenu()->move(x, y); + item->submenu()->move(new_x, new_y); if (! moving) drawItem(index, true); @@ -1068,8 +1066,8 @@ void Menu::buttonPressEvent(XButtonEvent &be) { drawItem(w, item->isEnabled(), true, true); } } else { - menu.x_move = be.x_root - menu.x; - menu.y_move = be.y_root - menu.y; + menu.x_move = be.x_root - x(); + menu.y_move = be.y_root - y(); } } @@ -1133,10 +1131,7 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { if (which_sub >= 0) drawSubmenu(which_sub); } else { - menu.x = me.x_root - menu.x_move, - menu.y = me.y_root - menu.y_move; - - menu.window.move(menu.x, menu.y); + menu.window.move(me.x_root - menu.x_move, me.y_root - menu.y_move); // if (which_sub >= 0) // drawSubmenu(which_sub); @@ -1245,19 +1240,19 @@ void Menu::enterNotifyEvent(XCrossingEvent &ce) { if (menu.frame != ce.window) return; - menu.x_shift = menu.x, menu.y_shift = menu.y; - if (menu.x + width() > m_screen_width) { + menu.x_shift = x(), menu.y_shift = y(); + if (x() + width() > m_screen_width) { menu.x_shift = m_screen_width - width() - 2*m_border_width; shifted = true; - } else if (menu.x < 0) { + } else if (x() < 0) { menu.x_shift = 0; //-m_border_width; shifted = true; } - if (menu.y + height() + 2*m_border_width > m_screen_height) { + if (y() + height() + 2*m_border_width > m_screen_height) { menu.y_shift = m_screen_height - height() - 2*m_border_width; shifted = true; - } else if (menu.y + (signed) menu.title_h < 0) { + } else if (y() + (signed) menu.title_h < 0) { menu.y_shift = 0; // -m_border_width;; shifted = true; } @@ -1295,7 +1290,7 @@ void Menu::leaveNotifyEvent(XCrossingEvent &ce) { } if (shifted) { - menu.window.move(menu.x, menu.y); + // menu.window.move(menu.x, menu.y); shifted = false; } } diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index d1c6c6e..7c8b6ef 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.hh,v 1.28 2003/12/17 00:43:22 fluxgen Exp $ +// $Id: Menu.hh,v 1.29 2003/12/18 18:03:23 fluxgen Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH @@ -140,8 +140,8 @@ public: inline FbWindow &titleWindow() { return menu.title; } inline FbWindow &frameWindow() { return menu.frame; } inline const std::string &label() const { return menu.label; } - inline int x() const { return menu.x; } - inline int y() const { return menu.y; } + inline int x() const { return menu.window.x(); } + inline int y() const { return menu.window.y(); } inline unsigned int width() const { return menu.window.width(); } inline unsigned int height() const { return menu.window.height(); } inline unsigned int numberOfItems() const { return menuitems.size(); } @@ -203,7 +203,7 @@ private: FbTk::FbWindow window, frame, title; std::string label; - int x, y, x_move, y_move, x_shift, y_shift, sublevels, persub, minsub, + int x_move, y_move, x_shift, y_shift, sublevels, persub, minsub, grab_x, grab_y; unsigned int title_h, frame_h, item_w, item_h, bevel_w, bevel_h; diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 7e3af6a..ea0ae29 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.66 2003/12/16 12:46:14 rathnor Exp $ +// $Id: FbWinFrame.cc,v 1.67 2003/12/18 18:03:21 fluxgen Exp $ #include "FbWinFrame.hh" @@ -43,11 +43,11 @@ using namespace std; FbWinFrame::FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, - int screen_num, int x, int y, + int x, int y, unsigned int width, unsigned int height): m_theme(theme), m_imagectrl(imgctrl), - m_window(screen_num, x, y, width, height, ButtonPressMask | ButtonReleaseMask | + m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask, true), m_titlebar(m_window, 0, 0, 100, 16, ButtonPressMask | ButtonReleaseMask | diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index f1a7d3f..ac14b39 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.hh,v 1.26 2003/12/16 23:34:36 fluxgen Exp $ +// $Id: FbWinFrame.hh,v 1.27 2003/12/18 18:03:21 fluxgen Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH @@ -54,8 +54,8 @@ class FbWinFrame:public FbTk::EventHandler { public: /// create a top level window - FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, - int screen_num, int x, int y, + FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, + int x, int y, unsigned int width, unsigned int height); /// create a frame window inside another FbWindow, NOT IMPLEMENTED! diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index c14e056..1f6d491 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.cc,v 1.22 2003/12/12 14:36:22 fluxgen Exp $ +// $Id: IconbarTool.cc,v 1.23 2003/12/18 18:03:21 fluxgen Exp $ #include "IconbarTool.hh" @@ -245,7 +245,7 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr screen.name() + ".iconbar.clientWidth", screen.altName() + ".Iconbar.ClientWidth"), m_rc_use_pixmap(screen.resourceManager(), true, screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"), - m_menu(*screen.menuTheme(), screen.imageControl(), + m_menu(screen.menuTheme(), screen.imageControl(), *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { // setup mode menu diff --git a/src/Screen.cc b/src/Screen.cc index 474c334..7d15b20 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.250 2003/12/18 15:27:21 fluxgen Exp $ +// $Id: Screen.cc,v 1.251 2003/12/18 18:03:21 fluxgen Exp $ #include "Screen.hh" @@ -355,8 +355,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // before we load the theme winFrameTheme().font().setAntialias(*resource.antialias); - menuTheme()->titleFont().setAntialias(*resource.antialias); - menuTheme()->frameFont().setAntialias(*resource.antialias); + menuTheme().titleFont().setAntialias(*resource.antialias); + menuTheme().frameFont().setAntialias(*resource.antialias); // create geometry window @@ -600,7 +600,7 @@ void BScreen::update(FbTk::Subject *subj) { } FbTk::Menu *BScreen::createMenu(const std::string &label) { - FbTk::Menu *menu = new FbMenu(*menuTheme(), + FbTk::Menu *menu = new FbMenu(menuTheme(), imageControl(), *layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); if (!label.empty()) @@ -1142,7 +1142,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { if (winclient->fbwindow()) // may have been set in an atomhandler win = winclient->fbwindow(); else { - win = new FluxboxWindow(*winclient, *this, + win = new FluxboxWindow(*winclient, winFrameTheme(), *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); @@ -1183,7 +1183,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { } FluxboxWindow *BScreen::createWindow(WinClient &client) { - FluxboxWindow *win = new FluxboxWindow(client, *this, + FluxboxWindow *win = new FluxboxWindow(client, winFrameTheme(), *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); #ifdef SLIT diff --git a/src/Screen.hh b/src/Screen.hh index c73dead..1155998 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.127 2003/12/12 18:18:12 fluxgen Exp $ +// $Id: Screen.hh,v 1.128 2003/12/18 18:03:21 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -204,8 +204,8 @@ public: inline FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } inline const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } - inline MenuTheme *menuTheme() { return m_menutheme.get(); } - inline const MenuTheme *menuTheme() const { return m_menutheme.get(); } + inline MenuTheme &menuTheme() { return *m_menutheme.get(); } + inline const MenuTheme &menuTheme() const { return *m_menutheme.get(); } inline const RootTheme &rootTheme() const { return *m_root_theme.get(); } inline WinButtonTheme &winButtonTheme() { return *m_winbutton_theme.get(); } inline const WinButtonTheme &winButtonTheme() const { return *m_winbutton_theme.get(); } diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc index 2ab2144..825ed36 100644 --- a/src/SendToMenu.cc +++ b/src/SendToMenu.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: SendToMenu.cc,v 1.6 2003/12/17 00:45:30 fluxgen Exp $ +// $Id: SendToMenu.cc,v 1.7 2003/12/18 18:03:21 fluxgen Exp $ #include "SendToMenu.hh" @@ -45,7 +45,7 @@ private: }; SendToMenu::SendToMenu(FluxboxWindow &win): - FbMenu(*win.screen().menuTheme(), + FbMenu(win.screen().menuTheme(), win.screen().imageControl(), *win.screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_win(win) { diff --git a/src/Slit.cc b/src/Slit.cc index 73e2b3c..c32eff2 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.83 2003/12/10 23:08:03 fluxgen Exp $ +// $Id: Slit.cc,v 1.84 2003/12/18 18:03:21 fluxgen Exp $ #include "Slit.hh" @@ -235,16 +235,16 @@ unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask | Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) : m_hidden(false), m_screen(scr), - m_slitmenu(*scr.menuTheme(), + m_slitmenu(scr.menuTheme(), scr.imageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), - m_placement_menu(*scr.menuTheme(), + m_placement_menu(scr.menuTheme(), scr.imageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), - m_clientlist_menu(*scr.menuTheme(), + m_clientlist_menu(scr.menuTheme(), scr.imageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), - m_layermenu(new LayerMenu(*scr.menuTheme(), + m_layermenu(new LayerMenu(scr.menuTheme(), scr.imageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, diff --git a/src/Toolbar.cc b/src/Toolbar.cc index d2dcefc..21afd71 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.131 2003/12/10 23:08:03 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.132 2003/12/18 18:03:21 fluxgen Exp $ #include "Toolbar.hh" @@ -191,15 +191,15 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): frame(*this, scrn.screenNumber()), m_window_pm(0), m_screen(scrn), - m_layermenu(*scrn.menuTheme(), + m_layermenu(scrn.menuTheme(), scrn.imageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, true), - m_placementmenu(*scrn.menuTheme(), + m_placementmenu(scrn.menuTheme(), scrn.imageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), - m_toolbarmenu(*scrn.menuTheme(), + m_toolbarmenu(scrn.menuTheme(), scrn.imageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_theme(scrn.screenNumber()), @@ -792,7 +792,7 @@ void Toolbar::setupMenus() { if (screen().hasXinerama()) { // TODO: nls (main label plus menu heading - menu().insert("On Head...", new XineramaHeadMenu(*screen().menuTheme(), + menu().insert("On Head...", new XineramaHeadMenu(screen().menuTheme(), screen(), screen().imageControl(), *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), diff --git a/src/Window.cc b/src/Window.cc index 5adc484..edf88fc 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.253 2003/12/14 01:06:22 fluxgen Exp $ +// $Id: Window.cc,v 1.254 2003/12/18 18:03:21 fluxgen Exp $ #include "Window.hh" @@ -248,7 +248,7 @@ void LayerMenuItem::click(int button, int time) { m_object->moveToLayer(m_layernum); } -FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, +FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, FbTk::XLayer &layer): oplock(false), m_hintsig(*this), @@ -262,16 +262,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t iconic(false), focused(false), stuck(false), m_managed(false), maximized(MAX_NONE), - m_screen(scr), + m_screen(client.screen()), display(FbTk::App::instance()->display()), - m_windowmenu(*scr.menuTheme(), scr.imageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + m_windowmenu(client.screen().menuTheme(), client.screen().imageControl(), + *client.screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_old_decoration(DECOR_NORMAL), m_client(&client), - m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), - m_layeritem(m_frame->window(), layer), + m_frame(tm, client.screen().imageControl(), 0, 0, 100, 100), + m_layeritem(m_frame.window(), layer), m_layernum(layer.getLayerNum()), - m_parent(scr.rootWindow()), + m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) { init(); @@ -539,12 +539,15 @@ void FluxboxWindow::init() { setState(m_current_state); + // add extra menus + addExtraMenu("Send To...", new SendToMenu(*this)); addExtraMenu("Layer...", - new LayerMenu(*screen().menuTheme(), + new LayerMenu(screen().menuTheme(), screen().imageControl(), *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, false)); + // the layermenu will get deleted as an extra menu // don't call setupWindow here as the addExtraMenu call should @@ -3093,22 +3096,6 @@ const FbTk::FbWindow &FluxboxWindow::fbWindow() const { return frame().window(); } -int FluxboxWindow::x() const { - return frame().x(); -} - -int FluxboxWindow::y() const { - return frame().y(); -} - -unsigned int FluxboxWindow::width() const { - return frame().width(); -} - -unsigned int FluxboxWindow::height() const { - return frame().height(); -} - unsigned int FluxboxWindow::titlebarHeight() const { return frame().titlebarHeight(); } @@ -3321,7 +3308,6 @@ void FluxboxWindow::setupWindow() { // sets up our window // we allow both to be done at once to share the commands - FbWinFrame &frame = *m_frame.get(); WinButtonTheme &winbutton_theme = screen().winButtonTheme(); typedef FbTk::RefCount CommandRef; @@ -3343,7 +3329,7 @@ void FluxboxWindow::setupWindow() { CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu)); // clear old buttons from frame - frame.removeAllButtons(); + frame().removeAllButtons(); //!! TODO: fix this ugly hack // get titlebar configuration const vector *dir = &Fluxbox::instance()->getTitlebarLeft(); @@ -3354,14 +3340,14 @@ void FluxboxWindow::setupWindow() { if (isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { newbutton = new WinButton(*this, winbutton_theme, WinButton::MINIMIZE, - frame.titlebar(), + frame().titlebar(), 0, 0, 10, 10); newbutton->setOnClick(iconify_cmd); } else if (isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) { newbutton = new WinButton(*this, winbutton_theme, WinButton::MAXIMIZE, - frame.titlebar(), + frame().titlebar(), 0, 0, 10, 10); newbutton->setOnClick(maximize_cmd, 1); @@ -3371,7 +3357,7 @@ void FluxboxWindow::setupWindow() { } else if (m_client->isClosable() && (*dir)[i] == Fluxbox::CLOSE) { newbutton = new WinButton(*this, winbutton_theme, WinButton::CLOSE, - frame.titlebar(), + frame().titlebar(), 0, 0, 10, 10); newbutton->setOnClick(close_cmd); @@ -3379,7 +3365,7 @@ void FluxboxWindow::setupWindow() { } else if ((*dir)[i] == Fluxbox::STICK) { WinButton *winbtn = new WinButton(*this, winbutton_theme, WinButton::STICK, - frame.titlebar(), + frame().titlebar(), 0, 0, 10, 10); stateSig().attach(winbtn); winbtn->setOnClick(stick_cmd); @@ -3387,7 +3373,7 @@ void FluxboxWindow::setupWindow() { } else if ((*dir)[i] == Fluxbox::SHADE) { WinButton *winbtn = new WinButton(*this, winbutton_theme, WinButton::SHADE, - frame.titlebar(), + frame().titlebar(), 0, 0, 10, 10); winbtn->setOnClick(shade_cmd); } @@ -3395,33 +3381,33 @@ void FluxboxWindow::setupWindow() { if (newbutton != 0) { newbutton->show(); if (c == 0) - frame.addLeftButton(newbutton); + frame().addLeftButton(newbutton); else - frame.addRightButton(newbutton); + frame().addRightButton(newbutton); } } //end for i dir = &Fluxbox::instance()->getTitlebarRight(); } // end for c - frame.reconfigure(); + frame().reconfigure(); // setup titlebar - frame.setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1 - frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 - frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 - frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2 - frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); + frame().setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1 + frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 + frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 + frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2 + frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); // end setup frame // setup menu - FbTk::Menu &menu = m_windowmenu; - menu.removeAll(); // clear old items - menu.disableTitle(); // not titlebar + + menu().removeAll(); // clear old items + menu().disableTitle(); // not titlebar // set new menu items - menu.insert("Shade", shade_cmd); - menu.insert("Stick", stick_cmd); + menu().insert("Shade", shade_cmd); + menu().insert("Stick", stick_cmd); // create maximize item with: // button1: Maximize normal // button2: Maximize Vertical @@ -3430,23 +3416,23 @@ void FluxboxWindow::setupWindow() { maximize_item->setCommand(1, maximize_cmd); maximize_item->setCommand(2, maximize_vert_cmd); maximize_item->setCommand(3, maximize_horiz_cmd); - menu.insert(maximize_item); - menu.insert("Iconify", iconify_cmd); - menu.insert("Raise", raise_cmd); - menu.insert("Lower", lower_cmd); + menu().insert(maximize_item); + menu().insert("Iconify", iconify_cmd); + menu().insert("Raise", raise_cmd); + menu().insert("Lower", lower_cmd); + - menu.insert("Send To...", new SendToMenu(*this)); ExtraMenus::iterator it = m_extramenus.begin(); ExtraMenus::iterator it_end = m_extramenus.end(); for (; it != it_end; ++it) { it->second->disableTitle(); // be sure there is no title - menu.insert(it->first, it->second); + menu().insert(it->first, it->second); } - menu.insert("---"); - menu.insert("Close", close_cmd); + menu().insert("---"); + menu().insert("Close", close_cmd); - menu.reconfigure(); // update graphics + menu().reconfigure(); // update graphics } diff --git a/src/Window.hh b/src/Window.hh index c4a7a25..b555d6b 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.103 2003/12/17 01:21:49 fluxgen Exp $ +// $Id: Window.hh,v 1.104 2003/12/18 18:03:22 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -32,6 +32,7 @@ #include "Subject.hh" #include "EventHandler.hh" #include "XLayerItem.hh" +#include "FbWinFrame.hh" #include #include @@ -132,10 +133,10 @@ public: }; enum ResizeCorner { - LEFTTOP, - LEFTBOTTOM, - RIGHTBOTTOM, - RIGHTTOP + LEFTTOP, + LEFTBOTTOM, + RIGHTBOTTOM, + RIGHTTOP }; typedef struct _blackbox_hints { @@ -152,7 +153,7 @@ public: typedef std::list ClientList; /// create a window from a client - FluxboxWindow(WinClient &client, BScreen &scr, + FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, FbTk::XLayer &layer); @@ -312,22 +313,24 @@ public: const std::string &title() const; const std::string &iconTitle() const; - int x() const; - int y() const; + inline int x() const { return frame().x(); } + inline int y() const { return frame().y(); } + inline unsigned int width() const { return frame().width(); } + inline unsigned int height() const { return frame().height(); } + unsigned int workspaceNumber() const { return m_workspace_number; } int layerNum() const { return m_layernum; } void setLayerNum(int layernum); - unsigned int width() const; - unsigned int height() const; + unsigned int titlebarHeight() const; bool isLowerTab() const; int initialState() const; - FbWinFrame &frame() { return *m_frame.get(); } - const FbWinFrame &frame() const { return *m_frame.get(); } + inline FbWinFrame &frame() { return m_frame; } + inline const FbWinFrame &frame() const { return m_frame; } /** @name signals @@ -455,7 +458,7 @@ private: unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state int m_last_button_x, ///< last known x position of the mouse button m_last_button_y; ///< last known y position of the mouse button - std::auto_ptr m_frame; + FbWinFrame m_frame; FbTk::XLayerItem m_layeritem; int m_layernum; diff --git a/src/Workspace.cc b/src/Workspace.cc index d2ebf60..74c5850 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.87 2003/12/14 01:10:39 fluxgen Exp $ +// $Id: Workspace.cc,v 1.88 2003/12/18 18:03:22 fluxgen Exp $ #include "Workspace.hh" @@ -110,7 +110,7 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, const std::string &name, unsigned int id): m_screen(scrn), m_lastfocus(0), - m_clientmenu(*scrn.menuTheme(), scrn.imageControl(), + m_clientmenu(scrn.menuTheme(), scrn.imageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_layermanager(layermanager), m_name(name), @@ -123,7 +123,7 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, m_cascade_x[i] = 32 + scrn.getHeadX(i); m_cascade_y[i] = 32 + scrn.getHeadY(i); } - m_clientmenu.setInternalMenu(); + menu().setInternalMenu(); setName(name); } @@ -254,7 +254,7 @@ void Workspace::removeAll() { void Workspace::reconfigure() { - m_clientmenu.reconfigure(); + menu().reconfigure(); Windows::iterator it = m_windowlist.begin(); Windows::iterator it_end = m_windowlist.end(); @@ -361,7 +361,7 @@ bool Workspace::loadGroups(const std::string &filename) { } void Workspace::update(FbTk::Subject *subj) { - m_clientmenu.update(); + menu().update(); } @@ -379,8 +379,8 @@ void Workspace::setName(const std::string &name) { screen().updateWorkspaceNamesAtom(); - m_clientmenu.setLabel(m_name.c_str()); - m_clientmenu.update(); + menu().setLabel(m_name.c_str()); + menu().update(); } /** @@ -400,7 +400,7 @@ void Workspace::shutdown() { void Workspace::updateClientmenu() { // remove all items and then add them again - m_clientmenu.removeAll(); + menu().removeAll(); // for each fluxboxwindow add every client in them to our clientlist Windows::iterator win_it = m_windowlist.begin(); Windows::iterator win_it_end = m_windowlist.end(); @@ -411,10 +411,10 @@ void Workspace::updateClientmenu() { FluxboxWindow::ClientList::iterator client_it_end = (*win_it)->clientList().end(); for (; client_it != client_it_end; ++client_it) - m_clientmenu.insert(new ClientMenuItem(*(*client_it))); + menu().insert(new ClientMenuItem(*(*client_it))); } - m_clientmenu.update(); + menu().update(); } void Workspace::placeWindow(FluxboxWindow &win) { diff --git a/src/Workspace.hh b/src/Workspace.hh index bfb8bb7..b554fa7 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh @@ -71,7 +71,7 @@ public: FluxboxWindow *lastFocusedWindow() { return m_lastfocus; } const FluxboxWindow *lastFocusedWindow() const { return m_lastfocus; } - FbTk::Menu &menu() { return m_clientmenu; } + inline FbTk::Menu &menu() { return m_clientmenu; } inline const FbTk::Menu &menu() const { return m_clientmenu; } /// name of this workspace inline const std::string &name() const { return m_name; } -- cgit v0.11.2