some signed/unsigned stuff
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.cc,v 1.10 2002/02/07 14:45:02 fluxgen Exp $ +// $Id: IconBar.cc,v 1.11 2002/03/23 15:14:45 fluxgen Exp $ #include "IconBar.hh" #include "i18n.hh"@@ -239,7 +239,7 @@ return;
FluxboxWindow *fluxboxwin = obj->getFluxboxWin(); Window iconwin = obj->getIconWin(); - char *title = *fluxboxwin->getIconTitle(); + const char *title = fluxboxwin->getIconTitle(); unsigned int title_len = strlen(title); unsigned int title_text_w;
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.37 2002/03/19 14:30:42 fluxgen Exp $ +// $Id: Screen.cc,v 1.38 2002/03/23 15:14:45 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -728,11 +728,11 @@ }
} -FluxboxWindow *BScreen::getIcon(int index) { - if (index >= 0 && index < iconList.size()) +FluxboxWindow *BScreen::getIcon(unsigned int index) { + if (index < iconList.size()) return iconList[index]; - return (FluxboxWindow *) 0; + return 0; }@@ -782,8 +782,8 @@ return 0;
} -void BScreen::changeWorkspaceID(int id) { - if (! current_workspace || id >= workspacesList.size() || id < 0) +void BScreen::changeWorkspaceID(unsigned int id) { + if (! current_workspace || id >= workspacesList.size()) return; if (id != current_workspace->getWorkspaceID()) {@@ -819,13 +819,10 @@
updateNetizenCurrentWorkspace(); } -void BScreen::sendToWorkspace(int id) { - BScreen::sendToWorkspace(id, true); -} -void BScreen::sendToWorkspace(int id, bool changeWS) { +void BScreen::sendToWorkspace(unsigned int id, bool changeWS) { FluxboxWindow *win; - if (! current_workspace || id >= workspacesList.size() || id < 0) + if (! current_workspace || id >= workspacesList.size()) return; if (id != current_workspace->getWorkspaceID()) {@@ -1084,9 +1081,9 @@
} -void BScreen::getNameOfWorkspace(int id, char **name) { - if (id >= 0 && id < workspaceNames.size()) { - const char *wkspc_name = workspaceNames[id].c_str(); +void BScreen::getNameOfWorkspace(unsigned int workspace, char **name) { + if (workspace < workspaceNames.size()) { + const char *wkspc_name = workspaceNames[workspace].c_str(); if (wkspc_name) *name = StringUtil::strdup(wkspc_name);@@ -1095,10 +1092,10 @@ *name = 0;
} -void BScreen::reassociateWindow(FluxboxWindow *w, int wkspc_id, Bool ignore_sticky) { +void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { if (! w) return; - if (wkspc_id == -1) + if (wkspc_id >= workspaceNames.size()) wkspc_id = current_workspace->getWorkspaceID(); if (w->getWorkspaceNumber() == wkspc_id)@@ -1807,7 +1804,7 @@ //------------- leftWorkspace ----------------
// Goes to the workspace "left" of the current //-------------------------------------------- void BScreen::leftWorkspace(const int delta) { - if (getCurrentWorkspaceID() >= delta) + if (getCurrentWorkspaceID() >= static_cast<unsigned int>(delta)) changeWorkspaceID(getCurrentWorkspaceID()-delta); }
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.24 2002/03/19 14:30:42 fluxgen Exp $ +// $Id: Screen.hh,v 1.25 2002/03/23 15:14:45 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH@@ -111,7 +111,7 @@ #endif // SLIT
inline Toolbar *getToolbar(void) { return toolbar; } - inline Workspace *getWorkspace(int w) { return workspacesList[w]; } + inline Workspace *getWorkspace(unsigned int w) { return ( w < workspacesList.size() ? workspacesList[w] : 0); } inline Workspace *getCurrentWorkspace(void) { return current_workspace; } inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; }@@ -121,10 +121,10 @@ inline const unsigned int getBevelWidth(void) const { return theme->getBevelWidth(); }
inline const unsigned int getFrameWidth(void) const { return theme->getFrameWidth(); } inline const unsigned int getBorderWidth(void) const { return theme->getBorderWidth(); } inline const unsigned int getBorderWidth2x(void) const { return theme->getBorderWidth()*2; } - inline const int getCurrentWorkspaceID() { return current_workspace->getWorkspaceID(); } + inline const unsigned int getCurrentWorkspaceID() const { return current_workspace->getWorkspaceID(); } typedef std::vector<FluxboxWindow *> Icons; - inline const int getCount(void) { return workspacesList.size(); } + inline const unsigned int getCount(void) { return workspacesList.size(); } inline const int getIconCount(void) { return iconList.size(); } inline Icons &getIconList(void) { return iconList; }@@ -191,7 +191,7 @@ inline Theme::WindowStyle *getWindowStyle(void) { return &theme->getWindowStyle(); }
inline Theme::MenuStyle *getMenuStyle(void) { return &theme->getMenuStyle(); } inline Theme::ToolbarStyle *getToolbarStyle(void) { return &theme->getToolbarStyle(); } - FluxboxWindow *getIcon(int); + FluxboxWindow *getIcon(unsigned int index); int addWorkspace(void); int removeLastWorkspace(void);@@ -209,12 +209,11 @@ void addNetizen(Netizen *);
void removeNetizen(Window); void addIcon(FluxboxWindow *); void removeIcon(FluxboxWindow *); - void getNameOfWorkspace(int, char **); - void changeWorkspaceID(int); - void sendToWorkspace(int); - void sendToWorkspace(int, bool); + void getNameOfWorkspace(unsigned int workspace, char **name); + void changeWorkspaceID(unsigned int); + void sendToWorkspace(unsigned int workspace, bool changeworkspace=true); void raiseWindows(Window *, int); - void reassociateWindow(FluxboxWindow *, int, Bool); + void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void prevFocus(int = 0); void nextFocus(int = 0); void raiseFocus(void);
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.14 2002/03/19 14:30:42 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.15 2002/03/23 15:14:45 fluxgen Exp $ // stupid macros needed to access some functions in version 2 of the GNU C // library@@ -366,7 +366,7 @@ "00:00000"))) + (frame.bevel_w * 4);
#endif // HAVE_STRFTIME - int i; + unsigned int i; unsigned int w = 0; frame.workspace_label_w = 0;@@ -727,17 +727,17 @@ FluxboxWindow *foc = Fluxbox::instance()->getFocusedWindow();
if (foc->getScreen() != screen) return; - int dx = (frame.bevel_w * 2), dlen = strlen(*foc->getTitle()); + int dx = (frame.bevel_w * 2), dlen = strlen(foc->getTitle()); unsigned int l; I18n *i18n = I18n::instance(); if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->font.set, *foc->getTitle(), dlen, + XmbTextExtents(screen->getToolbarStyle()->font.set, foc->getTitle(), dlen, &ink, &logical); l = logical.width; } else - l = XTextWidth(screen->getToolbarStyle()->font.fontstruct, *foc->getTitle(), dlen); + l = XTextWidth(screen->getToolbarStyle()->font.fontstruct, foc->getTitle(), dlen); l += (frame.bevel_w * 4);@@ -746,10 +746,10 @@ for (; dlen >= 0; dlen--) {
if (i18n->multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getToolbarStyle()->font.set, - *foc->getTitle(), dlen, &ink, &logical); + foc->getTitle(), dlen, &ink, &logical); l = logical.width; } else - l = XTextWidth(screen->getToolbarStyle()->font.fontstruct, *foc->getTitle(), dlen); + l = XTextWidth(screen->getToolbarStyle()->font.fontstruct, foc->getTitle(), dlen); l += (frame.bevel_w * 4);@@ -774,12 +774,12 @@ XmbDrawString(display, frame.window_label,
screen->getToolbarStyle()->font.set, screen->getToolbarStyle()->w_text_gc, dx, 1 - screen->getToolbarStyle()->font.set_extents->max_ink_extent.y, - *foc->getTitle(), dlen); + foc->getTitle(), dlen); else XDrawString(display, frame.window_label, - screen->getToolbarStyle()->w_text_gc, dx, - screen->getToolbarStyle()->font.fontstruct->ascent + 1, - *foc->getTitle(), dlen); + screen->getToolbarStyle()->w_text_gc, dx, + screen->getToolbarStyle()->font.fontstruct->ascent + 1, + foc->getTitle(), dlen); } else XClearWindow(display, frame.window_label); }
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.34 2002/03/19 14:30:42 fluxgen Exp $ +// $Id: Window.cc,v 1.35 2002/03/23 15:14:45 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -411,9 +411,11 @@ screen->hideGeometry();
XUngrabPointer(display, CurrentTime); } - if (workspace_number != -1 && window_number != -1) - screen->getWorkspace(workspace_number)->removeWindow(this); - else if (iconic) + if (!iconic) { + Workspace *workspace = screen->getWorkspace(workspace_number); + if (workspace) + workspace->removeWindow(this); + } else //it's iconic screen->removeIcon(this); if (windowmenu)@@ -2022,9 +2024,9 @@ }
void FluxboxWindow::deiconify(bool reassoc, bool raise) { - if (iconic || reassoc) - screen->reassociateWindow(this, -1, false); - else if (workspace_number != screen->getCurrentWorkspace()->getWorkspaceID()) + if (iconic || reassoc) { + screen->reassociateWindow(this, screen->getCurrentWorkspace()->getWorkspaceID(), false); + } else if (workspace_number != screen->getCurrentWorkspace()->getWorkspaceID()) return; setState(NormalState);@@ -2443,7 +2445,7 @@
stuck = false; if (! iconic) - screen->reassociateWindow(this, -1, true); + screen->reassociateWindow(this, screen->getCurrentWorkspace()->getWorkspaceID(), true); } else {@@ -2712,8 +2714,8 @@
current_state = save_state; } - if (((int) blackbox_attrib.workspace != screen->getCurrentWorkspaceID()) && - ((int) blackbox_attrib.workspace < screen->getCount())) { + if (( blackbox_attrib.workspace != screen->getCurrentWorkspaceID()) && + ( blackbox_attrib.workspace < screen->getCount())) { screen->reassociateWindow(this, blackbox_attrib.workspace, true); if (current_state == NormalState) current_state = WithdrawnState;@@ -3675,10 +3677,10 @@ (net->attrib & BaseDisplay::ATTRIB_OMNIPRESENT)))
stick(); if ((net->flags & BaseDisplay::ATTRIB_WORKSPACE) && - (workspace_number != (signed) net->workspace)) { + (workspace_number != net->workspace)) { screen->reassociateWindow(this, net->workspace, true); - if (screen->getCurrentWorkspaceID() != (signed) net->workspace) + if (screen->getCurrentWorkspaceID() != net->workspace) withdraw(); else deiconify();
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.13 2002/03/19 00:15:58 fluxgen Exp $ +// $Id: Window.hh,v 1.14 2002/03/23 15:14:45 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH@@ -120,55 +120,50 @@
FluxboxWindow(Window, BScreen * = 0); virtual ~FluxboxWindow(void); - inline const bool isTransient(void) const - { return ((transient) ? true : false); } - inline const bool hasTransient(void) const - { return ((client.transient) ? true : false); } + inline const bool isTransient(void) const { return ((transient) ? true : false); } + inline const bool hasTransient(void) const { return ((client.transient) ? true : false); } inline const bool isManaged() const { return managed; } - inline const bool &isFocused(void) const { return focused; } - inline const bool &isVisible(void) const { return visible; } - inline const bool &isIconic(void) const { return iconic; } - inline const bool &isShaded(void) const { return shaded; } - inline const bool &isMaximized(void) const { return maximized; } - inline const bool &isIconifiable(void) const { return functions.iconify; } - inline const bool &isMaximizable(void) const { return functions.maximize; } - inline const bool &isResizable(void) const { return functions.resize; } - inline const bool &isClosable(void) const { return functions.close; } - inline const bool &isStuck(void) const { return stuck; } - inline const bool &hasTitlebar(void) const { return decorations.titlebar; } + inline const bool isFocused(void) const { return focused; } + inline const bool isVisible(void) const { return visible; } + inline const bool isIconic(void) const { return iconic; } + inline const bool isShaded(void) const { return shaded; } + inline const bool isMaximized(void) const { return maximized; } + inline const bool isIconifiable(void) const { return functions.iconify; } + inline const bool isMaximizable(void) const { return functions.maximize; } + inline const bool isResizable(void) const { return functions.resize; } + inline const bool isClosable(void) const { return functions.close; } + inline const bool isStuck(void) const { return stuck; } + inline const bool hasTitlebar(void) const { return decorations.titlebar; } inline const bool hasTab(void) const { return (tab!=0 ? true : false); } static void showError(FluxboxWindow::Error error); - inline BScreen *getScreen(void) { return screen; } - inline Tab *getTab(void) { return tab; } - inline FluxboxWindow *getTransient(void) { return client.transient; } - inline FluxboxWindow *getTransientFor(void) { return client.transient_for; } + inline BScreen *getScreen(void) const { return screen; } + inline Tab *getTab(void) const { return tab; } + inline FluxboxWindow *getTransient(void) const { return client.transient; } + inline FluxboxWindow *getTransientFor(void) const { return client.transient_for; } inline const Window &getFrameWindow(void) const { return frame.window; } inline const Window &getClientWindow(void) const { return client.window; } inline Windowmenu *getWindowmenu(void) { return windowmenu; } - inline char **getTitle(void) { return &client.title; } - inline char **getIconTitle(void) { return &client.icon_title; } - inline const int &getXFrame(void) const { return frame.x; } - inline const int &getYFrame(void) const { return frame.y; } - inline const int &getXClient(void) const { return client.x; } - inline const int &getYClient(void) const { return client.y; } - inline const int &getWorkspaceNumber(void) const { return workspace_number; } - inline const int &getWindowNumber(void) const { return window_number; } + inline const char *getTitle(void) const { return client.title; } + inline const char *getIconTitle(void) const { return client.icon_title; } + inline const int getXFrame(void) const { return frame.x; } + inline const int getYFrame(void) const { return frame.y; } + inline const int getXClient(void) const { return client.x; } + inline const int getYClient(void) const { return client.y; } + inline const unsigned int getWorkspaceNumber(void) const { return workspace_number; } + inline const int getWindowNumber(void) const { return window_number; } inline const WinLayer getLayer(void) const { return m_layer; } - inline const unsigned int &getWidth(void) const { return frame.width; } - inline const unsigned int &getHeight(void) const { return frame.height; } - inline const unsigned int &getClientHeight(void) const - { return client.height; } - inline const unsigned int &getClientWidth(void) const - { return client.width; } - inline const unsigned int &getTitleHeight(void) const - { return frame.title_h; } + inline const unsigned int getWidth(void) const { return frame.width; } + inline const unsigned int getHeight(void) const { return frame.height; } + inline const unsigned int getClientHeight(void) const { return client.height; } + inline const unsigned int getClientWidth(void) const { return client.width; } + inline const unsigned int getTitleHeight(void) const { return frame.title_h; } inline void setWindowNumber(int n) { window_number = n; } - inline const timeval& getLastFocusTime() const {return lastFocusTime;} + inline const timeval &getLastFocusTime() const {return lastFocusTime;} bool validateClient(void); bool setInputFocus(void);@@ -232,7 +227,8 @@ Windowmenu *windowmenu;
timeval lastFocusTime; - int focus_mode, window_number, workspace_number; + int focus_mode, window_number; + unsigned int workspace_number; unsigned long current_state; WinLayer m_layer;
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.13 2002/03/19 14:30:43 fluxgen Exp $ +// $Id: Workspace.cc,v 1.14 2002/03/23 15:14:45 fluxgen Exp $ // use GNU extensions #ifndef _GNU_SOURCE@@ -63,7 +63,7 @@ #include <iostream>
using namespace std; #endif -Workspace::Workspace(BScreen *scrn, int i): +Workspace::Workspace(BScreen *scrn, unsigned int i): screen(scrn), lastfocus(0), name(""),@@ -87,7 +87,7 @@ delete clientmenu;
} -const int Workspace::addWindow(FluxboxWindow *w, Bool place) { +const int Workspace::addWindow(FluxboxWindow *w, bool place) { if (! w) return -1;@@ -100,7 +100,7 @@
stackingList.push_front(w); windowList.push_back(w); - clientmenu->insert((const char **) w->getTitle()); + clientmenu->insert(w->getTitle()); clientmenu->update(); screen->updateNetizenWindowAdd(w->getClientWindow(), id);@@ -286,11 +286,11 @@ }
} -FluxboxWindow *Workspace::getWindow(int index) { - if ((index >= 0) && (index < windowList.size())) +FluxboxWindow *Workspace::getWindow(unsigned int index) { + if (index < windowList.size()) return windowList[index]; - else - return 0; + + return 0; }
@@ -39,20 +39,20 @@ class Workspace {
public: typedef std::vector<FluxboxWindow *> Windows; - Workspace(BScreen *, int = 0); + Workspace(BScreen *, unsigned int = 0); ~Workspace(void); inline BScreen *getScreen(void) { return screen; } inline FluxboxWindow *getLastFocusedWindow(void) { return lastfocus; } inline Clientmenu *getMenu(void) { return clientmenu; } inline const char *getName(void) const { return name.c_str(); } - inline const int &getWorkspaceID(void) const { return id; } + inline const unsigned int getWorkspaceID(void) const { return id; } inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } - FluxboxWindow *getWindow(int); + FluxboxWindow *getWindow(unsigned int id); inline Windows &getWindowList() { return windowList; } bool isCurrent(void); bool isLastWindow(FluxboxWindow *); - const int addWindow(FluxboxWindow *, Bool = False); + const int addWindow(FluxboxWindow *, bool = False); const int removeWindow(FluxboxWindow *); const int getCount(void);@@ -79,7 +79,8 @@ WindowStack stackingList;
Windows windowList; std::string name; - int id, cascade_x, cascade_y; + unsigned int id; + int cascade_x, cascade_y; protected: