some cleanup
jump to
@@ -1251,7 +1251,7 @@ // set window state
void Ewmh::setState(FluxboxWindow &win, Atom state, bool value, WinClient &client) { if (state == m_net->wm_state_sticky) { // STICKY - if (value && !win.isStuck() || + if ((value && !win.isStuck()) || (!value && win.isStuck())) win.stick(); } else if (state == m_net->wm_state_shaded) { // SHADED
@@ -332,7 +332,8 @@ if (total_width != cur_width) {
// calling Container::resize here risks infinite loops unsigned int neww = total_width, newh = height; translateSize(m_orientation, neww, newh); - if (align == RIGHT && m_orientation != ROT270 || align == LEFT && m_orientation == ROT270) { + if ((align == RIGHT && m_orientation != ROT270) || + (align == LEFT && m_orientation == ROT270)) { int deltax = 0; int deltay = 0; if (m_orientation == ROT0 || m_orientation == ROT180)@@ -477,10 +478,10 @@ ItemList::iterator it_end = m_item_list.end();
for (; it != it_end; ++it) (*it)->setOrientation(orient); - if ((m_orientation == ROT0 || m_orientation == ROT180) && - (orient == ROT90 || orient == ROT270) || - (m_orientation == ROT90 || m_orientation == ROT270) && - (orient == ROT0 || orient == ROT180)) { + if (((m_orientation == ROT0 || m_orientation == ROT180) && + (orient == ROT90 || orient == ROT270)) || + ((m_orientation == ROT90 || m_orientation == ROT270) && + (orient == ROT0 || orient == ROT180))) { // flip width and height m_orientation = orient; resize(height(), width());
@@ -151,14 +151,6 @@ pts, 3,
Convex, CoordModePrevious); } -#ifdef NOT_USED -void FbDrawable::drawPoint(GC gc, int x, int y) { - if (drawable() == 0 || gc == 0) - return; - XDrawPoint(display(), drawable(), gc, x, y); -} -#endif - XImage *FbDrawable::image(int x, int y, unsigned int width, unsigned int height) const { return XGetImage(display(), drawable(), x, y, width, height,
@@ -61,10 +61,6 @@ // (i.e. 200 = half size, 300 = a third).
virtual void drawTriangle(GC gc, TriangleType type, int x, int y, unsigned int width, unsigned int height, int scale); -#ifdef NOT_USED - virtual void drawPoint(GC gc, int x, int y); -#endif - virtual XImage *image(int x, int y, unsigned int width, unsigned int height) const; /// X drawable
@@ -283,7 +283,8 @@
if (width() == 0 || height() == 0) return; - if (!dest_override && (the_width == 0 && the_height == 0 || the_width == width() && the_height == height()) && + if (!dest_override && ((the_width == 0 && the_height == 0) || + (the_width == width() && the_height == height())) && the_x <= 0 && the_y <= 0) { // do the whole thing updateBackground(true);@@ -452,12 +453,6 @@
void FbWindow::setCursor(Cursor cur) { XDefineCursor(display(), window(), cur); } - -#ifdef NOT_USED -void FbWindow::unsetCursor() { - XUndefineCursor(display(), window()); -} -#endif void FbWindow::reparent(const FbWindow &parent, int x, int y, bool continuing) { XReparentWindow(display(), window(), parent.window(), x, y);
@@ -137,10 +137,7 @@ virtual void raise();
void setInputFocus(int revert_to, int time); /// defines a cursor for this window void setCursor(Cursor cur); -#ifdef NOT_USED - /// uses the parents cursor instead - void unsetCursor(); -#endif + void reparent(const FbWindow &parent, int x, int y, bool continuing = true); bool property(Atom property,
@@ -89,15 +89,7 @@ /// set font id
void setFont(int fid) { XSetFont(m_display, m_gc, fid); } -#ifdef NOT_USED - void setClipMask(const FbTk::FbPixmap &mask) { - XSetClipMask(m_display, m_gc, mask.drawable()); - } - void setClipOrigin(int x, int y) { - XSetClipOrigin(m_display, m_gc, x, y); - } -#endif void setGraphicsExposure(bool value) { XSetGraphicsExposures(m_display, m_gc, value); }@@ -112,11 +104,7 @@ }
void setFillStyle(int style) { XSetFillStyle(m_display, m_gc, style); } -#ifdef NOT_USED - void setFillRule(int rule) { - XSetFillRule(m_display, m_gc, rule); - } -#endif + void setLineAttributes(unsigned int width, int line_style, int cap_style,
@@ -39,22 +39,10 @@ /// insert in top by default
virtual iterator insert(ItemType &item, unsigned int pos=0); /// remove item from list virtual void remove(ItemType &item); -#ifdef NOT_USED - /// cycle all item upwards - virtual void cycleUp(); - /// cycle all items downwards - virtual void cycleDown(); -#endif // NOT_USED /// move item to top virtual void raise(ItemType &item); /// move item to bottom virtual void lower(ItemType &item); -#ifdef NOT_USED - /// raise a specific item one step - virtual void stepUp(ItemType &item); - /// lower a specific item one step - virtual void stepDown(ItemType &item); -#endif // NOT_USED virtual void restack(); /// @return layer item on specific position, on failure 0 ItemType *getItem(unsigned int position);@@ -94,73 +82,6 @@ iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end()) m_list.erase(it); } - -#ifdef NOT_USED -template <typename ItemType, typename Container> -void Layer<ItemType, Container>::cycleUp() { - if (size() == 0) - return; - iterator it = itemList().begin(); - it++; - rotate(itemList().begin(), it, itemList().end()); - restack(); -} - - -template <typename ItemType, typename Container> -void Layer<ItemType, Container>::cycleDown() { - if (size() == 0) - return; - // save last item and remove it from list - ItemType *last_item = itemList().back(); - itemList().pop_back(); - // add last item to front - itemList().insert(itemList().begin(), last_item); - restack(); -} - -template <typename ItemType, typename Container> -void Layer<ItemType, Container>::stepUp(ItemType &item) { - iterator it = - find(itemList().begin(), itemList().end(), &item); - - if (it == itemList().end()) - return; - - if (it == itemList().begin()) // we can't raise it more - return; - - iterator new_pos = it; - new_pos--; - ItemType *textitem = *it; - // remove item from list - itemList().erase(it); - // insert above last pos - itemList().insert(new_pos, textitem); - restack(); -} - -template <typename ItemType, typename Container> -void Layer<ItemType, Container>::stepDown(ItemType &item) { - iterator it = - find(itemList().begin(), itemList().end(), &item); - - if (it == itemList().end()) // we didn't find the item in our list - return; - - if (*it == itemList().back()) // it's already at the bottom - return; - - iterator new_pos = it; - new_pos++; - ItemType *textitem = *it; - // remove from list - itemList().erase(it); - // insert on the new place - itemList().insert(new_pos, textitem); - restack(); -} -#endif // NOT_USED template <typename ItemType, typename Container> void Layer<ItemType, Container>::raise(ItemType &item) {
@@ -32,11 +32,6 @@ virtual ~LayerItem() { }
virtual void raise() = 0; virtual void lower() = 0; - -#ifdef NOT_USED - virtual void stepUp() = 0; - virtual void stepDown() = 0; -#endif // NOT_USED }; } // end namespace FbTk
@@ -1136,7 +1136,7 @@ void Menu::openSubmenu() {
int item = m_active_index; if (!isVisible() || !validIndex(item) || !menuitems[item]->isEnabled() || - s_focused != this && s_focused && s_focused->isVisible()) + (s_focused != this && s_focused && s_focused->isVisible())) return; clearItem(item);
@@ -76,10 +76,7 @@ /// remove all items
void removeAll(); void setInternalMenu(bool val = true) { m_internal_menu = val; } void setAlignment(Alignment a) { m_alignment = a; } -#ifdef NOT_USED - void setTorn() { m_torn = true; } - void removeParent() { if (m_internal_menu) m_parent = 0; } -#endif + /// raise this window virtual void raise(); /// lower this window@@ -122,16 +119,12 @@ virtual void show();
/// hide menu virtual void hide(bool force = false); virtual void clearWindow(); -#ifdef NOT_USED - void setActiveIndex(int index) { m_active_index = index; } /*@}*/ /** @name accessors */ //@{ - int activeIndex() const { return m_active_index; } -#endif bool isTorn() const { return m_torn; } bool isVisible() const { return m_visible; } bool isMoving() const { return m_moving; }
@@ -38,10 +38,7 @@ RefCount<Pointer> &operator = (Pointer *p);
Pointer *operator * () const { return get(); } Pointer *operator -> () const { return get(); } Pointer *get() const { return m_data; } -#ifdef NOT_USED - /// @return number of references - unsigned int usedBy() const { return (m_refcount != 0 ? *m_refcount : 0); } -#endif + private: /// increase reference count void incRefCount();
@@ -60,13 +60,6 @@
return true; } -#ifdef NOT_USED -void SignalHandler::removeHandler(int signum) { - if (signum < NSIG) - s_signal_handler[signum] = 0; // clear handler pointer -} -#endif - void SignalHandler::handleSignal(int signum) { if (signum >= NSIG) return;
@@ -52,13 +52,7 @@ @param eh event handler
@param oldhandler_ret return handler to old sighandler */ bool registerHandler(int signum, SignalEventHandler *eh, SignalEventHandler **oldhandler_ret = 0); -#ifdef NOT_USED - /** - removes the signum handler - @param signum signal number - */ - void removeHandler(int signum); -#endif + private: SignalHandler();
@@ -97,15 +97,6 @@ m_font = &font;
font.validOrientation(m_orientation); // load the orientation! } -#ifdef NOT_USED -/// set bevel and redraw text -void TextButton::setBevel(int bevel) { - if (m_bevel == bevel) - return; - m_bevel = bevel; -} -#endif - void TextButton::setTextPaddingLeft(unsigned int leftpadding) { m_left_padding = leftpadding; }@@ -137,13 +128,6 @@
unsigned int TextButton::textWidth() const { return font().textWidth(text().data(), text().size()); } - -#ifdef NOT_USED -unsigned int TextButton::textHeight() const { - return font().height(); - -} -#endif void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { // (win should always be *this, no need to check)
@@ -40,9 +40,6 @@ void setJustify(FbTk::Justify just);
bool setOrientation(FbTk::Orientation orient); void setText(const std::string &text); void setFont(FbTk::Font &font); -#ifdef NOT_USED - void setBevel(int bevel); -#endif void setTextPadding(unsigned int padding); void setTextPaddingLeft(unsigned int leftpadding); void setTextPaddingRight(unsigned int rightpadding);@@ -67,14 +64,7 @@ const std::string &text() const { return m_text; }
FbTk::Font &font() const { return *m_font; } FbTk::Orientation orientation() const { return m_orientation; } unsigned int textWidth() const; -#ifdef NOT_USED - unsigned int textHeight() const; -#endif int bevel() const { return m_bevel; } -#ifdef NOT_USED - unsigned int leftPadding() const { return m_left_padding; } - unsigned int rightPadding() const { return m_right_padding; } -#endif void renderForeground(FbWindow &win, FbDrawable &drawable);
@@ -89,11 +89,12 @@ addType(Texture::FLAT);
else addType(Texture::DEFAULT_BEVEL); - if (! (type() & Texture::FLAT)) + if (! (type() & Texture::FLAT)) { if (strstr(ts, "bevel2")) addType(Texture::BEVEL2); else addType(Texture::BEVEL1); + } if (strstr(ts, "invert")) addType(Texture::INVERT);
@@ -174,100 +174,6 @@ }
} } -#ifdef NOT_USED -void XLayer::cycleUp() { - // need to find highest visible window, and move it to bottom - iterator it = itemList().begin(); - iterator it_end = itemList().end(); - while (it != it_end && !(*it)->visible()) - ++it; - - // if there is something to do - if (it != it_end) - lower(**it); - -} - -void XLayer::cycleDown() { - // need to find lowest visible window, and move it to top - // so use a reverse iterator, and the same logic as cycleUp() - reverse_iterator it = itemList().rbegin(); - reverse_iterator it_end = itemList().rend(); - while (it != it_end && !(*it)->visible()) - ++it; - - // if there is something to do - if (it != it_end) - raise(**it); - -} - -void XLayer::stepUp(XLayerItem &item) { - // need to find next visible window upwards, and put it above that - - if (&item == itemList().front()) - return; // nothing to do - - // TODO: is there a better way of doing this? - - // get our item - iterator myit = find(itemList().begin(), itemList().end(), &item); - iterator it = myit; - - // go to the one above it in our layer (top is front, so we decrement) - --it; - - // keep going until we find one that is currently visible to the user - while (it != itemList().begin() && !(*it)->visible()) - --it; - - if (it == itemList().begin() && !(*it)->visible()) { - // reached front item, but it wasn't visible, therefore it was already raised - } else { - // it is the next visible item down, we need to be above it. - // remove that item from the list and add it back to before it (the one we want to go above) - - itemList().erase(myit); - itemList().insert(it, &item); - - // if we've reached the top of the layer, we need to stack below the next one up - if (it == itemList().begin()) { - stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); - } else { - // otherwise go up one in this layer (i.e. above the one we want to go above) - --it; - // and stack below that. - stackBelowItem(&item, *it); - } - } -} - -void XLayer::stepDown(XLayerItem &item) { - // need to find next visible window down, and put it below that - - // if we're already the bottom of the layer - if (&item == itemList().back()) - return; // nothing to do - - // get our position - iterator it = find(itemList().begin(), itemList().end(), &item); - - // go one below it (top is front, so we must increment) - it++; - iterator it_end = itemList().end(); - - // keep going down until we find a visible one - while (it != it_end && !(*it)->visible()) - it++; - - // if we didn't reach the end, then stack below the - // item that we found. - if (it != it_end) - stackBelowItem(&item, *it); - // if we did reach the end, then there are no visible windows, so we don't do anything -} -#endif // NOT_USED - void XLayer::raise(XLayerItem &item) { // assume it is already in this layer
@@ -60,15 +60,6 @@ // we redefine these as XLayer has special optimisations, and X restacking needs
iterator insert(XLayerItem &item, unsigned int pos=0); void remove(XLayerItem &item); -#ifdef NOT_USED - // move highest to bottom - void cycleUp(); - void cycleDown(); - // just go above the next window up in the current layer (not all the way to the top) - void stepUp(XLayerItem &item); - void stepDown(XLayerItem &item); -#endif // NOT_USED - // bring to top of layer void raise(XLayerItem &item); void lower(XLayerItem &item);
@@ -58,16 +58,6 @@ void XLayerItem::tempRaise() {
m_layer->tempRaise(*this); } -#ifdef NOT_USED -void XLayerItem::stepUp() { - m_layer->stepUp(*this); -} - -void XLayerItem::stepDown() { - m_layer->stepDown(*this); -} -#endif // NOT_USED - void XLayerItem::raiseLayer() { m_layer->raiseLayer(*this); }
@@ -44,12 +44,6 @@ void raise();
void lower(); void tempRaise(); // this raise gets reverted by a restack() -#ifdef NOT_USED - // go above the next item visible in this layer - void stepUp(); - void stepDown(); -#endif // NOT_USED - // send to next layer up void raiseLayer(); void lowerLayer();
@@ -247,8 +247,8 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height, bool move, bool resize) {
if (move && x == window().x() && y == window().y()) move = false; - if (resize && (m_state.shaded || width == FbWinFrame::width() && - height == FbWinFrame::height())) + if (resize && (m_state.shaded || (width == FbWinFrame::width() && + height == FbWinFrame::height()))) resize = false; if (!move && !resize)@@ -265,7 +265,7 @@ } else {
m_window.resize(width, height); } - if (move || resize && m_screen.getTabPlacement() != TOPLEFT) + if (move || (resize && m_screen.getTabPlacement() != TOPLEFT)) alignTabs(); if (resize) {@@ -413,7 +413,7 @@ unsigned char alpha = getAlpha(m_state.focused);
if (alpha == 255) return; - if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) { + if ((m_tabmode == EXTERNAL && m_use_tabs) || m_use_titlebar) { m_tab_container.parentMoved(); m_tab_container.for_each(mem_fun(&FbTk::Button::parentMoved)); }@@ -1430,8 +1430,8 @@ return DECOR_BORDER;
if (label == "tab") return DECOR_TAB; int mask = -1; - if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' || - str_label.size() > 0 && isdigit(str_label[0])) + if ((str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x') || + (str_label.size() > 0 && isdigit(str_label[0]))) mask = strtol(str_label.c_str(), NULL, 0); return mask; }
@@ -1310,8 +1310,8 @@ }
if (app->shadedstate_remember) // if inconsistent... - if (win.isShaded() && !app->shadedstate || - !win.isShaded() && app->shadedstate) + if ((win.isShaded() && !app->shadedstate) || + (!win.isShaded() && app->shadedstate)) win.shade(); // toggles // external tabs aren't available atm...@@ -1319,8 +1319,8 @@ //if (app->tabstate_remember) ...
if (app->stuckstate_remember) // if inconsistent... - if (win.isStuck() && !app->stuckstate || - !win.isStuck() && app->stuckstate) + if ((win.isStuck() && !app->stuckstate) || + (!win.isStuck() && app->stuckstate)) win.stick(); // toggles if (app->minimizedstate_remember) {
@@ -1277,9 +1277,9 @@
for (; it != it_end; ++it) { // special case for max height/width == 0 // 0 indicates unlimited size, so we skip them - if (h || (*it)->maxHeight() && h > (*it)->maxHeight()) + if (!h || ((*it)->maxHeight() && h > (*it)->maxHeight())) h = (*it)->maxHeight(); - if (!w || (*it)->maxWidth() && w > (*it)->maxWidth()) + if (!w || ((*it)->maxWidth() && w > (*it)->maxWidth())) w = (*it)->maxWidth(); }@@ -1876,7 +1876,7 @@
if (!m_initialized) m_layernum = layernum; - if (m_layernum == layernum && !force || !m_client) + if ((m_layernum == layernum && !force) || !m_client) return; // get root window@@ -2475,9 +2475,9 @@ }
} // don't allow moving/resizing fullscreen or maximized windows - if (isFullscreen() || isMaximizedHorz() && screen().getMaxIgnoreIncrement()) + if (isFullscreen() || (isMaximizedHorz() && screen().getMaxIgnoreIncrement())) cr.value_mask = cr.value_mask & ~(CWWidth | CWX); - if (isFullscreen() || isMaximizedVert() && screen().getMaxIgnoreIncrement()) + if (isFullscreen() || (isMaximizedVert() && screen().getMaxIgnoreIncrement())) cr.value_mask = cr.value_mask & ~(CWHeight | CWY); #ifdef REMEMBER@@ -2545,7 +2545,7 @@ switch (cr.detail) {
case Above: case TopIf: default: - if (isFocused() && focusRequestFromClient(*client) || + if ((isFocused() && focusRequestFromClient(*client)) || !FocusControl::focusedWindow()) { setCurrentClient(*client, true); raise();@@ -2618,8 +2618,8 @@ raise();
// check keys file first Keys *k = Fluxbox::instance()->keys(); - if (onTitlebar && k->doAction(be.type, be.state, be.button, - Keys::ON_TITLEBAR, m_client, be.time) || + if ((onTitlebar && k->doAction(be.type, be.state, be.button, + Keys::ON_TITLEBAR, m_client, be.time)) || k->doAction(be.type, be.state, be.button, Keys::ON_WINDOW, m_client, be.time)) { return;@@ -2706,8 +2706,8 @@ (int)frame().tabcontainer().height() + borderw))))
return; } - if (moving || (me.state & Button1Mask) && functions.move && - inside_titlebar && !isResizing() && m_attaching_tab == 0) { + if (moving || ((me.state & Button1Mask) && functions.move && + inside_titlebar && !isResizing() && m_attaching_tab == 0)) { if (! isMoving()) { startMoving(me.x_root, me.y_root);@@ -2781,11 +2781,11 @@ }
screen().showPosition(dx, dy); } // end if moving - } else if (resizing || m_attaching_tab == 0 && functions.resize && - (((me.state & Button1Mask) && - (me.window == frame().gripRight() || - me.window == frame().gripLeft())) || - me.window == frame().window())) { + } else if (resizing || (m_attaching_tab == 0 && functions.resize && + (((me.state & Button1Mask) && + (me.window == frame().gripRight() || + me.window == frame().gripLeft())) || + me.window == frame().window()))) { if (! resizing) {