all repos — fluxbox @ 553104ee1d53104fa0790a9793a7047c61dd073f

custom fork of the fluxbox windowmanager

fix all compiler warnings with -Wall
simonb simonb
commit

553104ee1d53104fa0790a9793a7047c61dd073f

parent

02aa83a59eb3d9e209449b38808635f9e293a17a

M ChangeLogChangeLog

@@ -1,6 +1,10 @@

(Format: Year/Month/Day) Changes for 0.9.16: *06/04/16: + * Fix all warnings with (gcc 3.4.6) -Wall, mainly sign comparisons (Simon) + ClientPattern.cc Container.cc FbWinFrame.cc IconButton.cc IconbarTool.cc + ScreenPlacement.hh ScreenResources.cc ToolFactory.cc Toolbar.cc + Window.cc FbTk/... FbPixmap.hh/cc Menu.hh Text.hh TextBox.hh/cc * signedness fix in Container moveItem (thanks _markt) Container.cc * Vertical toolbar (Simon)
M src/ClientPattern.ccsrc/ClientPattern.cc

@@ -137,10 +137,11 @@ // we don't care if there isn't one

// there shouldn't be anything else on the line match = str + pos; - err = match.find_first_not_of(" \t\n", pos); - if ((unsigned) err != match.npos) { + size_t uerr;// need a special type here + uerr = match.find_first_not_of(" \t\n", pos); + if (uerr != match.npos) { // found something, not good - had_error = err; + had_error++; } }
M src/Container.ccsrc/Container.cc

@@ -32,8 +32,8 @@ #include <algorithm>

Container::Container(const FbTk::FbWindow &parent): FbTk::FbWindow(parent, 0, 0, 1, 1, ExposureMask), - m_align(RELATIVE), m_orientation(FbTk::ROT0), + m_align(RELATIVE), m_max_size_per_client(60), m_max_total_size(0), m_selected(0),

@@ -479,7 +479,7 @@ case RELATIVE:

if (size() == 0) return width(); else { - int borderW = m_item_list.front()->borderWidth(); + unsigned int borderW = m_item_list.front()->borderWidth(); // there're count-1 borders to fit in with the windows // -> 1 per window plus end unsigned int w = width(), h = height();
M src/FbTk/FbPixmap.ccsrc/FbTk/FbPixmap.cc

@@ -73,7 +73,7 @@ }

FbPixmap::FbPixmap(const FbDrawable &src, unsigned int width, unsigned int height, - int depth):m_pm(0), + unsigned int depth):m_pm(0), m_width(0), m_height(0), m_depth(0) {

@@ -82,7 +82,7 @@ }

FbPixmap::FbPixmap(Drawable src, unsigned int width, unsigned int height, - int depth):m_pm(0), + unsigned int depth):m_pm(0), m_width(0), m_height(0), m_depth(0) {

@@ -157,7 +157,7 @@ }

} // screen doesn't count if depth is "zero"... -void FbPixmap::copy(Pixmap pm, int depth, int screen_num) { +void FbPixmap::copy(Pixmap pm, unsigned int depth, int screen_num) { free(); if (pm == 0) return;

@@ -248,6 +248,8 @@ starty = newh-1;

dirx = 1; diry = -1; break; + default: // kill warning + break; }

@@ -365,7 +367,6 @@ int real_format;

unsigned long items_read, items_left; unsigned long *data; - unsigned int prop = 0; if (XGetWindowProperty(display(), RootWindow(display(), i), root_prop_atoms[i],

@@ -474,7 +475,7 @@ }

void FbPixmap::create(Drawable src, unsigned int width, unsigned int height, - int depth) { + unsigned int depth) { if (src == 0) return;
M src/FbTk/FbPixmap.hhsrc/FbTk/FbPixmap.hh

@@ -41,15 +41,15 @@ /// creates a FbPixmap from X pixmap

explicit FbPixmap(Pixmap pm); FbPixmap(const FbDrawable &src, unsigned int width, unsigned int height, - int depth); + unsigned int depth); FbPixmap(Drawable src, unsigned int width, unsigned int height, - int depth); + unsigned int depth); virtual ~FbPixmap(); void copy(const FbPixmap &the_copy); - void copy(Pixmap pixmap, int depth_convert, int screen_num); + void copy(Pixmap pixmap, unsigned int depth_convert, int screen_num); /// rotates the pixmap to specified orientation (assumes ROT0 now) void rotate(FbTk::Orientation orient); /// scales the pixmap to specified size

@@ -67,7 +67,7 @@

inline Drawable drawable() const { return m_pm; } inline unsigned int width() const { return m_width; } inline unsigned int height() const { return m_height; } - inline int depth() const { return m_depth; } + inline unsigned int depth() const { return m_depth; } static Pixmap getRootPixmap(int screen_num, bool force_update=false); static void setRootPixmap(int screen_num, Pixmap pm);

@@ -75,13 +75,13 @@ static void rootwinPropertyNotify(int screen_num, Atom atom);

void create(Drawable src, unsigned int width, unsigned int height, - int depth); + unsigned int depth); private: void free(); Pixmap m_pm; unsigned int m_width, m_height; - int m_depth; + unsigned int m_depth; /// Functions relating to the maintenance of root window pixmap caching static void checkAtoms();
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -207,7 +207,7 @@ ImageControl &m_image_ctrl;

Menuitems menuitems; int m_screen_x, m_screen_y; - int m_screen_width, m_screen_height; + unsigned int m_screen_width, m_screen_height; bool m_moving; ///< if we're moving/draging or not bool m_visible; ///< menu visibility bool m_torn; ///< torn from parent
M src/FbTk/Text.hhsrc/FbTk/Text.hh

@@ -106,9 +106,6 @@ // When positioning an X11 box inside another area, we need to

// relocate the x,y coordinates inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w, unsigned int h, unsigned int bw) { - int orig_x = x; - int orig_y = y; - switch(orient) { case ROT0: break;
M src/FbTk/TextBox.ccsrc/FbTk/TextBox.cc

@@ -247,21 +247,25 @@ m_cursor_pos = 0;

m_end_pos = 0; break; case XK_Left: { - int pos = findEmptySpaceLeft(); - if (pos < m_start_pos){ - m_start_pos = pos; - m_cursor_pos = 0; - } else if (m_start_pos > 0) { - m_cursor_pos = pos - m_start_pos; - } else { - m_cursor_pos = pos; - } - adjustPos(); + unsigned int pos = findEmptySpaceLeft(); + if (pos < m_start_pos){ + m_start_pos = pos; + m_cursor_pos = 0; + } else if (m_start_pos > 0) { + m_cursor_pos = pos - m_start_pos; + } else { + m_cursor_pos = pos; } + adjustPos(); + } break; case XK_Right: if (m_text.size() && m_cursor_pos < m_text.size()){ - int pos = findEmptySpaceRight() - m_start_pos; + unsigned int pos = findEmptySpaceRight(); + if (pos > m_start_pos) + pos -= m_start_pos; + else + pos = 0; if (m_start_pos + pos <= m_end_pos) m_cursor_pos = pos; else if (m_end_pos < text().size()) {

@@ -275,7 +279,7 @@ }

break; case XK_BackSpace: { - int pos = findEmptySpaceLeft(); + unsigned int pos = findEmptySpaceLeft(); m_text.erase(pos, m_cursor_pos - pos + m_start_pos); if (pos < m_start_pos){

@@ -292,7 +296,7 @@ break;

case XK_Delete: { if (!m_text.size() || m_cursor_pos >= m_text.size()) break; - int pos = findEmptySpaceRight(); + unsigned int pos = findEmptySpaceRight(); m_text.erase(m_cursor_pos + m_start_pos, pos - (m_cursor_pos + m_start_pos)); adjustPos(); }

@@ -406,7 +410,7 @@ m_cursor_pos -= start_pos - m_start_pos;

m_start_pos = start_pos; } -int TextBox::findEmptySpaceLeft(){ +unsigned int TextBox::findEmptySpaceLeft(){ // found the first left space symbol int pos = m_text.rfind(' ', (m_start_pos + m_cursor_pos) > 0 ?

@@ -425,14 +429,14 @@

return pos; } -int TextBox::findEmptySpaceRight(){ +unsigned int TextBox::findEmptySpaceRight(){ // found the first right space symbol int pos = m_text.find(' ', m_start_pos + m_cursor_pos); // do we have one more space symbol near? int next_pos = -1; - while (pos > -1 && pos < m_text.size() && (next_pos = m_text.find(' ', pos + 1)) > -1 ){ + while (pos > -1 && pos < static_cast<signed>(m_text.size()) && (next_pos = m_text.find(' ', pos + 1)) > -1 ){ if (next_pos - 1 > pos) break;
M src/FbTk/TextBox.hhsrc/FbTk/TextBox.hh

@@ -70,8 +70,8 @@ GC gc() const { return m_gc; }

int cursorPosition() const { return m_cursor_pos; } inline int textStartPos(){ return m_start_pos; } - int findEmptySpaceLeft(); - int findEmptySpaceRight(); + unsigned int findEmptySpaceLeft(); + unsigned int findEmptySpaceRight(); private: void adjustEndPos();
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -1694,6 +1694,8 @@ case LEFTBOTTOM:

case RIGHTBOTTOM: return m_tab_container.width() + m_window.borderWidth(); break; + default: // kill warning + break; } return 0; }

@@ -1708,6 +1710,8 @@ case TOPRIGHT:

case BOTTOMLEFT: case BOTTOMRIGHT: return m_tab_container.height() + m_window.borderWidth(); + break; + default: // kill warning break; } return 0;

@@ -1722,6 +1726,8 @@ case LEFTTOP:

case LEFTBOTTOM: return m_tab_container.width() + m_window.borderWidth(); break; + default: // kill warning + break; } return 0; }

@@ -1734,6 +1740,8 @@ switch (m_screen.getTabPlacement()) {

case TOPLEFT: case TOPRIGHT: return m_tab_container.height() + m_window.borderWidth(); + break; + default: // kill warning break; } return 0;
M src/IconButton.ccsrc/IconButton.cc

@@ -109,7 +109,7 @@ // if desktopwheeling is enabled

class WheelWorkspaceCmd : public FbTk::Command { public: explicit WheelWorkspaceCmd(const IconbarTool& tool, FluxboxWindow &win, const char* cmd) : - m_win(win), m_tool(tool), m_cmd(CommandParser::instance().parseLine(cmd)){ } + m_win(win), m_cmd(CommandParser::instance().parseLine(cmd)), m_tool(tool) { } void execute() { switch(m_tool.wheelMode()) {

@@ -245,7 +245,7 @@ unsigned int h = height();

FbTk::translateSize(orientation(), w, h); int iconx = 1, icony = 1; unsigned int neww = w, newh = h; - if (newh > 2*icony) + if (newh > 2*static_cast<unsigned>(icony)) newh -= 2*icony; else newh = 1;
M src/IconbarTool.ccsrc/IconbarTool.cc

@@ -99,8 +99,11 @@ break;

case IconbarTool::CURRENT: return std::string("Current"); break; + case IconbarTool::FOLLOW: + default: + return std::string("Follow"); + break; }; - return std::string("Follow"); } template<>

@@ -131,8 +134,10 @@ break;

case IconbarTool::SCREEN: return std::string("Screen"); break; + case IconbarTool::OFF: + default: + return std::string("Off"); }; - return std::string("Off"); } template<>
M src/ScreenPlacement.hhsrc/ScreenPlacement.hh

@@ -58,6 +58,8 @@ BOTTOMTOP ///< from bottom to top

}; explicit ScreenPlacement(BScreen &screen); + + virtual ~ScreenPlacement() {} /// placeWindow is guaranteed to succeed, ignore return value /// @return true bool placeWindow(const std::vector<FluxboxWindow *> &windowlist,
M src/ScreenResources.ccsrc/ScreenResources.cc

@@ -88,9 +88,12 @@ break;

case BScreen::FETCH_ACTIVE_WINDOW: return std::string("Current"); break; + case BScreen::IGNORE_OTHER_WORKSPACES: + default: + return std::string("Ignore"); + break; } - return std::string("Ignore"); } template<>
M src/ToolFactory.ccsrc/ToolFactory.cc

@@ -77,9 +77,9 @@ ToolFactory::ToolFactory(BScreen &screen):m_screen(screen),

m_clock_theme(screen.screenNumber(), "toolbar.clock", "Toolbar.Clock"), m_button_theme(new ButtonTheme(screen.screenNumber(), "toolbar.button", "Toolbar.Button", "toolbar.clock", "Toolbar.Clock")), + m_workspace_theme(new WorkspaceNameTheme(screen.screenNumber(), "toolbar.workspace", "Toolbar.Workspace")), m_systray_theme(new ButtonTheme(screen.screenNumber(), "toolbar.systray", "Toolbar.Systray", "toolbar.clock", "Toolbar.Systray")), - m_workspace_theme(new WorkspaceNameTheme(screen.screenNumber(), "toolbar.workspace", "Toolbar.Workspace")), m_iconbar_theme(screen.screenNumber(), "toolbar.iconbar", "Toolbar.Iconbar") { }
M src/Toolbar.ccsrc/Toolbar.cc

@@ -977,7 +977,6 @@ bool first = true;

unsigned int width = this->width(), height = this->height(); unsigned int tmpw, tmph; - int tmpx, tmpy; FbTk::translateSize(orient, width, height); for (; item_it != item_it_end; ++item_it) {
M src/Window.ccsrc/Window.cc

@@ -924,7 +924,7 @@

ClientList::iterator client = find(m_clientlist.begin(), m_clientlist.end(), it->first); - if (x > (*it).second->width() / 2) + if (x > static_cast<signed>((*it).second->width()) / 2) client++; return client;

@@ -960,7 +960,7 @@ frame().tabcontainer().window(), labelbutton,

dest_x, dest_y, &x, &y, &child_return)) return; - if (x > (*it).second->width() / 2) + if (x > static_cast<signed>((*it).second->width()) / 2) moveClientRightOf(win, *it->first); else moveClientLeftOf(win, *it->first);

@@ -2296,7 +2296,7 @@ menu().disableTitle();

int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); if (!decorations.titlebar) // if we don't have any titlebar menu_y = 0; - if (m_last_button_x < x() || m_last_button_x > x() + width()) + if (m_last_button_x < x() || m_last_button_x > x() + static_cast<signed>(width())) m_last_button_x = x(); showMenu(m_last_button_x, menu_y + frame().y()); }

@@ -2858,8 +2858,8 @@ } else if (resizing) {

int old_resize_x = m_last_resize_x; int old_resize_y = m_last_resize_y; - int old_resize_w = m_last_resize_w; - int old_resize_h = m_last_resize_h; + unsigned int old_resize_w = m_last_resize_w; + unsigned int old_resize_h = m_last_resize_h; // move rectangle int gx = 0, gy = 0;

@@ -2891,6 +2891,8 @@ m_last_resize_w = frame().width() + diff;

m_last_resize_x = frame().x() - diff/2; m_last_resize_y = frame().y() - diff/2; } + break; + default: // kill warning break; };

@@ -3567,7 +3569,7 @@ FluxboxWindow *attach_to_win = 0;

if (client) { inside_titlebar = client->fbwindow()->hasTitlebar() && - client->fbwindow()->y() + client->fbwindow()->titlebarHeight() > dest_y; + client->fbwindow()->y() + static_cast<signed>(client->fbwindow()->titlebarHeight()) > dest_y; Fluxbox::TabsAttachArea area= Fluxbox::instance()->getTabsAttachArea(); if (area == Fluxbox::ATTACH_AREA_WINDOW)