From 1727656e0a36cd9095e173dfa43200ed14c178d1 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 4 Jul 2005 18:18:32 +0000 Subject: cleaning, change getCount to numberOfWorkspace --- src/CurrentWindowCmd.cc | 16 ++++++++-------- src/IconbarTool.cc | 12 ++++++------ src/Netizen.cc | 2 +- src/Screen.cc | 24 ++++++++++++------------ src/Screen.hh | 22 ++++++++-------------- src/Window.cc | 17 ++++------------- src/Window.hh | 1 - src/fluxbox.cc | 17 +++++++---------- 8 files changed, 46 insertions(+), 65 deletions(-) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 4db34c1..f6b38aa 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -47,38 +47,38 @@ void SetHeadCmd::real_execute() { } void SendToWorkspaceCmd::real_execute() { - if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces()) - fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow(), false); + fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow(), false); } void SendToNextWorkspaceCmd::real_execute() { const int ws_nr = ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % - fbwindow().screen().getNumberOfWorkspaces(); + fbwindow().screen().numberOfWorkspaces(); fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); } void SendToPrevWorkspaceCmd::real_execute() { int ws_nr = fbwindow().screen().currentWorkspaceID() - m_workspace_num; - if ( ws_nr < 0 ) ws_nr += fbwindow().screen().getNumberOfWorkspaces(); + if ( ws_nr < 0 ) + ws_nr += fbwindow().screen().numberOfWorkspaces(); fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); } void TakeToWorkspaceCmd::real_execute() { - if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces()) - fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); + fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); } void TakeToNextWorkspaceCmd::real_execute() { unsigned int workspace_num= ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % - fbwindow().screen().getNumberOfWorkspaces(); + fbwindow().screen().numberOfWorkspaces(); fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); } void TakeToPrevWorkspaceCmd::real_execute() { int workspace_num= fbwindow().screen().currentWorkspaceID() - m_workspace_num; - if ( workspace_num < 0 ) workspace_num+= fbwindow().screen().getNumberOfWorkspaces(); + if ( workspace_num < 0 ) + workspace_num += fbwindow().screen().numberOfWorkspaces(); fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); } diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index d86c7bc..c9de74c 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -877,8 +877,8 @@ void IconbarTool::addWindow(FluxboxWindow &win) { void IconbarTool::updateIcons() { std::list itemlist; // add icons to the itemlist - BScreen::Icons::iterator icon_it = m_screen.getIconList().begin(); - BScreen::Icons::iterator icon_it_end = m_screen.getIconList().end(); + BScreen::Icons::iterator icon_it = m_screen.iconList().begin(); + BScreen::Icons::iterator icon_it_end = m_screen.iconList().end(); for (; icon_it != icon_it_end; ++icon_it) { if (mode() == ICONS) itemlist.push_back(*icon_it); @@ -904,8 +904,8 @@ void IconbarTool::updateWorkspace() { // add icons from current workspace if (mode() != WORKSPACENOICONS) { - BScreen::Icons::iterator icon_it = m_screen.getIconList().begin(); - BScreen::Icons::iterator icon_it_end = m_screen.getIconList().end(); + BScreen::Icons::iterator icon_it = m_screen.iconList().begin(); + BScreen::Icons::iterator icon_it_end = m_screen.iconList().end(); for (; icon_it != icon_it_end; ++icon_it) { if ((*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID()) itemlist.push_back(*icon_it); @@ -930,8 +930,8 @@ void IconbarTool::updateAllWindows() { // add icons if(mode() != NOICONS && mode() != WORKSPACENOICONS) { full_list.insert(full_list.end(), - m_screen.getIconList().begin(), - m_screen.getIconList().end()); + m_screen.iconList().begin(), + m_screen.iconList().end()); } removeDuplicate(m_icon_list, full_list); diff --git a/src/Netizen.cc b/src/Netizen.cc index a76b001..c220a83 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc @@ -50,7 +50,7 @@ Netizen::Netizen(const BScreen &scr, Window win): void Netizen::sendWorkspaceCount() { event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWorkspaceCountAtom(); - event.xclient.data.l[1] = m_screen.getCount(); + event.xclient.data.l[1] = m_screen.numberOfWorkspaces(); XSendEvent(m_display, window(), False, NoEventMask, &event); } diff --git a/src/Screen.cc b/src/Screen.cc index 926193d..3df9266 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -650,9 +650,9 @@ void BScreen::hideMenus() { #endif // SLIT // hide icon menus - if (getIconList().size()) { - Icons::iterator it = getIconList().begin(); - const Icons::iterator it_end = getIconList().end(); + if (iconList().size()) { + Icons::iterator it = iconList().begin(); + const Icons::iterator it_end = iconList().end(); for (; it != it_end; ++it) (*it)->menu().hide(); } @@ -804,7 +804,7 @@ void BScreen::addIcon(FluxboxWindow *w) { return; // make sure we have a unique list - if (find(getIconList().begin(), getIconList().end(), w) != getIconList().end()) + if (find(iconList().begin(), iconList().end(), w) != iconList().end()) return; m_icon_list.push_back(w); @@ -818,13 +818,13 @@ void BScreen::removeIcon(FluxboxWindow *w) { if (w == 0) return; - Icons::iterator erase_it = remove_if(getIconList().begin(), - getIconList().end(), + Icons::iterator erase_it = remove_if(iconList().begin(), + iconList().end(), bind2nd(equal_to(), w)); // no need to send iconlist signal if we didn't // change the iconlist if (erase_it != m_icon_list.end()) { - getIconList().erase(erase_it); + iconList().erase(erase_it); m_iconlist_sig.notify(); } } @@ -1354,7 +1354,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, if (w == 0) return; - if (wkspc_id >= getCount()) + if (wkspc_id >= numberOfWorkspaces()) wkspc_id = currentWorkspace()->workspaceID(); if (!w->isIconic() && w->workspaceNumber() == wkspc_id) @@ -1992,21 +1992,21 @@ void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { Goes to the workspace "right" of the current */ void BScreen::nextWorkspace(const int delta) { - changeWorkspaceID( (currentWorkspaceID() + delta) % getCount()); + changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces()); } /** Goes to the workspace "left" of the current */ void BScreen::prevWorkspace(const int delta) { - changeWorkspaceID( (currentWorkspaceID() - delta + getCount()) % getCount()); + changeWorkspaceID( (currentWorkspaceID() - delta + numberOfWorkspaces()) % numberOfWorkspaces()); } /** Goes to the workspace "right" of the current */ void BScreen::rightWorkspace(const int delta) { - if (currentWorkspaceID()+delta < getCount()) + if (currentWorkspaceID()+delta < numberOfWorkspaces()) changeWorkspaceID(currentWorkspaceID()+delta); } @@ -2152,7 +2152,7 @@ void BScreen::notifyReleasedKeys(XKeyEvent &ke) { */ WinClient *BScreen::getLastFocusedWindow(int workspace) { if (focused_list.empty()) return 0; - if (workspace < 0 || workspace >= (int) getCount()) + if (workspace < 0 || workspace >= (int) numberOfWorkspaces()) return focused_list.front(); FocusedWindows::iterator it = focused_list.begin(); diff --git a/src/Screen.hh b/src/Screen.hh index abebd02..d5de5bc 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -125,17 +125,15 @@ public: inline const std::string &windowMenuFilename() const { return *resource.windowmenufile; } inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } // menus - const FbTk::Menu &getRootmenu() const { return *m_rootmenu.get(); } - FbTk::Menu &getRootmenu() { return *m_rootmenu.get(); } + const FbTk::Menu &rootMenu() const { return *m_rootmenu.get(); } + FbTk::Menu &rootMenu() { return *m_rootmenu.get(); } const FbTk::Menu &configMenu() const { return *m_configmenu.get(); } FbTk::Menu &configMenu() { return *m_configmenu.get(); } const FbTk::Menu &windowMenu() const { return *m_windowmenu.get(); } FbTk::Menu &windowMenu() { return *m_windowmenu.get(); } - ExtraMenus &extraWindowMenus() { return m_extramenus; } const ExtraMenus &extraWindowMenus() const { return m_extramenus; } - inline const std::string &getRootCommand() const { return *resource.rootcommand; } inline ResizeModel getResizeModel() const { return *resource.resize_model; } inline FocusModel getFocusModel() const { return *resource.focus_model; } inline FollowModel getFollowModel() const { return *resource.follow_model; } @@ -147,8 +145,8 @@ public: inline Workspace *currentWorkspace() { return m_current_workspace; } inline const Workspace *currentWorkspace() const { return m_current_workspace; } - const FbTk::Menu &getWorkspacemenu() const { return *m_workspacemenu.get(); } - FbTk::Menu &getWorkspacemenu() { return *m_workspacemenu.get(); } + const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); } + FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); } unsigned int currentWorkspaceID() const; @@ -169,11 +167,10 @@ public: inline int screenNumber() const { return rootWindow().screenNumber(); } /// @return number of workspaces - inline unsigned int getCount() const { return m_workspaces_list.size(); } - /// @return number of icons - inline unsigned int getIconCount() const { return m_icon_list.size(); } - inline const Icons &getIconList() const { return m_icon_list; } - inline Icons &getIconList() { return m_icon_list; } + unsigned int numberOfWorkspaces() const { return m_workspaces_list.size(); } + + inline const Icons &iconList() const { return m_icon_list; } + inline Icons &iconList() { return m_icon_list; } inline const FocusedWindows &getFocusedList() const { return focused_list; } inline FocusedWindows &getFocusedList() { return focused_list; } WinClient *getLastFocusedWindow(int workspace = -1); @@ -215,9 +212,6 @@ public: /// hide all windowmenus except the given one (if given) void hideWindowMenus(const FluxboxWindow* except= 0); - /// @return the resource value of number of workspace - inline int getNumberOfWorkspaces() const { return *resource.workspaces; } - inline PlacementPolicy getPlacementPolicy() const { return *resource.placement_policy; } inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } inline RowDirection getRowPlacementDirection() const { return *resource.row_direction; } diff --git a/src/Window.cc b/src/Window.cc index a8613c3..b7f78cf 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -503,7 +503,7 @@ void FluxboxWindow::init() { restoreAttributes(); - if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) + if (m_workspace_number < 0 || m_workspace_number >= screen().numberOfWorkspaces()) m_workspace_number = screen().currentWorkspaceID(); bool place_window = (m_old_pos_x == 0); @@ -2198,7 +2198,7 @@ void FluxboxWindow::restoreAttributes() { } if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && - ( m_blackbox_attrib.workspace < screen().getCount())) + ( m_blackbox_attrib.workspace < screen().numberOfWorkspaces())) m_workspace_number = m_blackbox_attrib.workspace; if (m_blackbox_attrib.flags & ATTRIB_OMNIPRESENT && @@ -2267,8 +2267,6 @@ void FluxboxWindow::popupMenu() { return; } - WindowCmd::setWindow(this); - menu().disableTitle(); int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); if (!decorations.titlebar) // if we don't have any titlebar @@ -2278,13 +2276,6 @@ void FluxboxWindow::popupMenu() { showMenu(m_last_button_x, menu_y + frame().y()); } -/** - Determine if this is the lowest tab of them all -*/ -bool FluxboxWindow::isLowerTab() const { - cerr<<__FILE__<<"(FluxboxWindow::isLowerTab()) TODO!"<= int(screen().width()) - warpPad - 1 && moved_x > 0) { //warp right - new_id = (cur_id + 1) % screen().getCount(); + new_id = (cur_id + 1) % screen().numberOfWorkspaces(); dx = - me.x_root; // move mouse back to x=0 } else if (me.x_root <= warpPad && moved_x < 0) { //warp left - new_id = (cur_id + screen().getCount() - 1) % screen().getCount(); + new_id = (cur_id + screen().numberOfWorkspaces() - 1) % screen().numberOfWorkspaces(); dx = screen().width() - me.x_root-1; // move mouse to screen width - 1 } if (new_id != cur_id) { diff --git a/src/Window.hh b/src/Window.hh index 6d0c77f..b4fcdfb 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -340,7 +340,6 @@ public: unsigned int titlebarHeight() const; - bool isLowerTab() const; int initialState() const; inline FbWinFrame &frame() { return m_frame; } diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 58222d7..732e8a6 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -931,10 +931,10 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { if (! screen->isRootColormapInstalled()) screen->imageControl().installRootColormap(); // hide menus - if (screen->getRootmenu().isVisible()) - screen->getRootmenu().hide(); - if (screen->getWorkspacemenu().isVisible()) - screen->getWorkspacemenu().hide(); + if (screen->rootMenu().isVisible()) + screen->rootMenu().hide(); + if (screen->workspaceMenu().isVisible()) + screen->workspaceMenu().hide(); } else if (be.button == 2) { FbCommands::ShowWorkspaceMenuCmd cmd; @@ -1033,7 +1033,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) { BScreen *screen = searchScreen(ce.window); if (screen && ce.data.l[0] >= 0 && - ce.data.l[0] < (signed)screen->getCount()) + ce.data.l[0] < (signed)screen->numberOfWorkspaces()) screen->changeWorkspaceID(ce.data.l[0]); } else if (ce.message_type == m_fbatoms->getFluxboxChangeWindowFocusAtom()) { @@ -1468,7 +1468,7 @@ void Fluxbox::save_rc() { sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number); string workspaces_string(rc_string); - for (unsigned int workspace=0; workspace < screen->getCount(); workspace++) { + for (unsigned int workspace=0; workspace < screen->numberOfWorkspaces(); workspace++) { if (screen->getWorkspace(workspace)->name().size()!=0) workspaces_string.append(screen->getWorkspace(workspace)->name()); else @@ -1575,10 +1575,7 @@ void Fluxbox::load_rc(BScreen &screen) { sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number); if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, &value)) { -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<"): Workspaces="<< - screen.getNumberOfWorkspaces()<