cleaning, change getCount to numberOfWorkspace

This commit is contained in:
fluxgen 2005-07-04 18:18:32 +00:00
parent 9049dd33d3
commit 1727656e0a
8 changed files with 46 additions and 65 deletions

View file

@ -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());
}

View file

@ -877,8 +877,8 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
void IconbarTool::updateIcons() {
std::list<FluxboxWindow *> 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);

View file

@ -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);
}

View file

@ -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<FluxboxWindow *>(), 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();

View file

@ -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; }

View file

@ -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<void>::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!"<<endl;
return true;
}
/**
Redirect any unhandled event to our handlers
@ -2754,12 +2745,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
if (me.x_root >= 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) {

View file

@ -340,7 +340,6 @@ public:
unsigned int titlebarHeight() const;
bool isLowerTab() const;
int initialState() const;
inline FbWinFrame &frame() { return m_frame; }

View file

@ -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()<<endl;
#endif // DEBUG
string values(value.addr);
BScreen::WorkspaceNames names;