From 06d696f99b276e3394aec10f52c206aec4697c76 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 15 Aug 2008 04:39:24 -0700 Subject: fix some consts and private functions --- src/Window.cc | 24 ++++++++---------------- src/Window.hh | 27 +++++++++++++-------------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index 866e160..6f8d0f7 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -874,7 +874,6 @@ void FluxboxWindow::moveClientRight() { updateClientLeftWindow(); } -//list<*WinClient>::iterator FluxboxWindow::getClientInsertPosition(int x, int y) { FluxboxWindow::ClientList::iterator FluxboxWindow::getClientInsertPosition(int x, int y) { int dest_x = 0, dest_y = 0; @@ -1261,25 +1260,18 @@ void FluxboxWindow::moveResizeForClient(int new_x, int new_y, } -void FluxboxWindow::maxSize(unsigned int &max_width, unsigned int &max_height) { +void FluxboxWindow::maxSize(unsigned int &width, unsigned int &height) const { ClientList::const_iterator it = clientList().begin(); ClientList::const_iterator it_end = clientList().end(); - max_width = (unsigned int) ~0; // unlimited - max_height = (unsigned int) ~0; // unlimited + width = height = 0; // unlimited for (; it != it_end; ++it) { // special case for max height/width == 0 // 0 indicates unlimited size, so we skip them - // and set max size to 0 if max size == ~0 after the loop - if ((*it)->maxHeight() != 0) - max_height = std::min( (*it)->maxHeight(), max_height ); - if ((*it)->maxWidth() != 0) - max_width = std::min( (*it)->maxWidth(), max_width ); + if (!height || (*it)->maxHeight() && height > (*it)->maxHeight()) + height = (*it)->maxHeight(); + if (!width || (*it)->maxWidth() && width > (*it)->maxWidth()) + width = (*it)->maxWidth(); } - - if (max_width == (unsigned int) ~0) - max_width = 0; - if (max_height == (unsigned int) ~0) - max_height = 0; } // returns whether the focus was "set" to this window @@ -2597,7 +2589,7 @@ void FluxboxWindow::keyPressEvent(XKeyEvent &ke) { gettimeofday(&m_last_keypress_time, 0); } -bool FluxboxWindow::isTyping() { +bool FluxboxWindow::isTyping() const { timeval now; if (gettimeofday(&now, NULL) == -1) return false; @@ -3345,7 +3337,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { } FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y, - ResizeModel model) { + ResizeModel model) const { int cx = frame().width() / 2; int cy = frame().height() / 2; if (model == CENTERRESIZE) diff --git a/src/Window.hh b/src/Window.hh index 05c4342..f0a390c 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -199,14 +199,6 @@ public: */ void moveClientTo(WinClient &win, int x, int y); /** - * Calculates insertition position in the list by - * using pixel position x and y. - * @param x position - * @param y position - * @return iterator position for insertion - */ - ClientList::iterator getClientInsertPosition(int x, int y); - /** * Take focus. * @see Focusable * @return true if it took focus. @@ -313,7 +305,7 @@ public: * @param width will be filled in with maximum width * @param height will be filled in with maximum height */ - void maxSize(unsigned int &width, unsigned int &height); + void maxSize(unsigned int &width, unsigned int &height) const; void setWorkspace(int n); void updateFunctions(); void restoreAttributes(); @@ -381,7 +373,7 @@ public: */ void startResizing(int x, int y, ResizeDirection dir); /// determine which edge or corner to resize - ResizeDirection getResizeDirection(int x, int y, ResizeModel model); + ResizeDirection getResizeDirection(int x, int y, ResizeModel model) const; /// stops the resizing void stopResizing(bool interrupted = false); /// starts tabbing @@ -395,7 +387,7 @@ public: // whether this window can be tabbed with other windows, // and others tabbed with it void setTabable(bool tabable) { functions.tabable = tabable; } - bool isTabable() { return functions.tabable; } + bool isTabable() const { return functions.tabable; } void setMovable(bool movable) { functions.move = movable; } void setResizable(bool resizable) { functions.resize = resizable; } @@ -403,9 +395,7 @@ public: bool isIconHidden() const { return m_icon_hidden; } bool isManaged() const { return m_initialized; } bool isVisible() const; - bool isIconic() { return iconic; } bool isIconic() const { return iconic; } - bool isShaded() { return shaded; } bool isShaded() const { return shaded; } bool isFullscreen() const { return fullscreen; } bool isMaximized() const { return maximized == MAX_FULL; } @@ -429,7 +419,7 @@ public: WinClient &winClient() { return *m_client; } const WinClient &winClient() const { return *m_client; } - bool isTyping(); + bool isTyping() const; const FbTk::XLayerItem &layerItem() const { return m_frame.layerItem(); } FbTk::XLayerItem &layerItem() { return m_frame.layerItem(); } @@ -523,6 +513,15 @@ private: void updateClientLeftWindow(); void grabButtons(); + /** + * Calculates insertition position in the list by + * using pixel position x and y. + * @param x position + * @param y position + * @return iterator position for insertion + */ + ClientList::iterator getClientInsertPosition(int x, int y); + /// try to attach current attaching client to a window at pos x, y void attachTo(int x, int y, bool interrupted = false); -- cgit v0.11.2