some cleanup

This commit is contained in:
Mark Tiefenbruck 2008-08-16 05:54:07 -07:00
parent 06837ba864
commit 38654bae45
24 changed files with 42 additions and 324 deletions

View file

@ -1251,7 +1251,7 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom 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

View file

@ -332,7 +332,8 @@ void Container::repositionItems() {
// 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 @@ void Container::setOrientation(Orientation orient) {
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());

View file

@ -151,14 +151,6 @@ void FbDrawable::drawTriangle(GC gc, FbDrawable::TriangleType type,
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,

View file

@ -61,10 +61,6 @@ public:
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

View file

@ -283,7 +283,8 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u
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);
@ -453,12 +454,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);
m_parent = &parent;

View file

@ -137,10 +137,7 @@ public:
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,

View file

@ -89,15 +89,7 @@ public:
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 @@ public:
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,

View file

@ -39,22 +39,10 @@ public:
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);
@ -95,73 +83,6 @@ void Layer<ItemType, Container>::remove(ItemType &item) {
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) {
if (&item == itemList().front()) // already at the bottom

View file

@ -32,11 +32,6 @@ public:
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

View file

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

View file

@ -76,10 +76,7 @@ public:
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 @@ public:
/// 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; }

View file

@ -38,10 +38,7 @@ public:
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();

View file

@ -60,13 +60,6 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh,
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;

View file

@ -52,13 +52,7 @@ public:
@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();

View file

@ -97,15 +97,6 @@ void TextButton::setFont(FbTk::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;
}
@ -138,13 +129,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)
drawText(0, 0, &drawable);

View file

@ -40,9 +40,6 @@ public:
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 @@ public:
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);

View file

@ -89,11 +89,12 @@ void Texture::setFromString(const char * const texture_str) {
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);

View file

@ -174,100 +174,6 @@ void XLayer::remove(XLayerItem &item) {
}
}
#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

View file

@ -60,15 +60,6 @@ public:
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);

View file

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

View file

@ -44,12 +44,6 @@ public:
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();

View file

@ -247,8 +247,8 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
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 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
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 @@ void FbWinFrame::notifyMoved(bool clear) {
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 @@ int FbWinFrame::getDecoMaskFromString(const string &str_label) {
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;
}

View file

@ -1310,8 +1310,8 @@ void Remember::setupFrame(FluxboxWindow &win) {
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 @@ void Remember::setupFrame(FluxboxWindow &win) {
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) {

View file

@ -1277,9 +1277,9 @@ void FluxboxWindow::getMaxSize(unsigned int* width, unsigned int* height) const
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 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
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 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
}
// 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 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
case Above:
case TopIf:
default:
if (isFocused() && focusRequestFromClient(*client) ||
if ((isFocused() && focusRequestFromClient(*client)) ||
!FocusControl::focusedWindow()) {
setCurrentClient(*client, true);
raise();
@ -2618,8 +2618,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
// 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 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
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 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
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) {