all repos — fluxbox @ e56c3c5b448a16a90dc1e518b29afd5c0ee544e8

custom fork of the fluxbox windowmanager

fix some issues with window frame that happened when changing style
rathnor rathnor
commit

e56c3c5b448a16a90dc1e518b29afd5c0ee544e8

parent

9d035e19c8d574e148ac92cc537de6c49f000f61

4 files changed, 84 insertions(+), 20 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.9: +*04/01/23: + * Fix a few window frame issues when changing styles (Simon) + - particularly a "void" area of the window + Window.hh/cc FbWinFrame.cc *04/01/22: * Fix missing sanitycheck in fbsetbg (Thanks Tom Ryan) fbsetbg
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -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: FbWinFrame.cc,v 1.72 2004/01/21 19:47:30 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.73 2004/01/23 10:37:01 rathnor Exp $ #include "FbWinFrame.hh"

@@ -455,10 +455,12 @@ bool FbWinFrame::showHandle() {

if (m_use_handle || theme().handleWidth() == 0) return false; + m_use_handle = true; + + renderHandles(); m_handle.show(); m_handle.showSubwindows(); // shows grips - m_use_handle = true; m_window.resize(m_window.width(), m_window.height() + m_handle.height() + m_handle.borderWidth()); return true;

@@ -636,6 +638,13 @@ if (m_labelbuttons.empty())

return; m_bevel = theme().bevelWidth(); + // reconfigure can't set borderwidth, as it doesn't know + // if it's meant to be borderless or not + + unsigned int orig_handle_h = handle().height(); + if (m_use_handle && orig_handle_h != theme().handleWidth()) + m_window.resize(m_window.width(), m_window.height() - + orig_handle_h + theme().handleWidth()); handle().resize(handle().width(), theme().handleWidth());

@@ -663,32 +672,37 @@ client_top += titlebar_height;

client_height -= titlebar_height; } - if (m_use_handle) { - // align handle and grips - const int grip_height = m_handle.height(); - const int grip_width = 20; //TODO - const int handle_bw = static_cast<signed>(m_handle.borderWidth()); + // align handle and grips + const int grip_height = m_handle.height(); + const int grip_width = 20; //TODO + const int handle_bw = static_cast<signed>(m_handle.borderWidth()); - const int ypos = m_window.height() - grip_height - m_handle.borderWidth(); - m_handle.moveResize(-handle_bw, ypos, - m_window.width(), grip_height); - - m_grip_left.moveResize(-handle_bw, -handle_bw, - grip_width, grip_height); + int ypos = m_window.height(); - m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, - grip_width, grip_height); - m_handle.raise(); + // if the handle isn't on, it's actually below the window + if (m_use_handle) + ypos -= grip_height + handle_bw; - client_height -= m_handle.height() + m_handle.borderWidth(); + // we do handle settings whether on or not so that if they get toggled + // then things are ok... + m_handle.moveResize(-handle_bw, ypos, + m_window.width(), grip_height); + m_grip_left.moveResize(-handle_bw, -handle_bw, + grip_width, grip_height); + + m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, + grip_width, grip_height); + + if (m_use_handle) { + m_handle.raise(); + client_height -= m_handle.height() + m_handle.borderWidth(); } else { m_handle.lower(); } m_clientarea.moveResize(0, client_top, m_window.width(), client_height); - }
M src/Window.ccsrc/Window.cc

@@ -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.265 2004/01/21 15:42:59 fluxgen Exp $ +// $Id: Window.cc,v 1.266 2004/01/23 10:37:08 rathnor Exp $ #include "Window.hh"

@@ -264,6 +264,7 @@ m_workspacesig(*this),

m_diesig(*this), m_focussig(*this), m_titlesig(*this), + m_themelistener(*this), moving(false), resizing(false), shaded(false), iconic(false), focused(false), stuck(false), m_managed(false),

@@ -279,6 +280,8 @@ m_layeritem(m_frame.window(), layer),

m_layernum(layer.getLayerNum()), m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) { + + tm.reconfigSig().attach(&m_themelistener); init(); }

@@ -3457,3 +3460,33 @@ menu().insert("Close", close_cmd);

menu().reconfigure(); // update graphics } + + +/** + * reconfigTheme: must be called after frame is reconfigured + * Client windows need to be made the same size and location as + * the frame's client area. + */ +void FluxboxWindow::reconfigTheme() { + + m_frame.setBorderWidth(decorations.border?frame().theme().border().width():0); + if (decorations.handle && frame().theme().handleWidth() != 0) + frame().showHandle(); + else + frame().hideHandle(); + + ClientList::iterator it = clientList().begin(); + ClientList::iterator it_end = clientList().end(); + + int x = m_frame.clientArea().x(), + y = m_frame.clientArea().y(); + + unsigned int width = m_frame.clientArea().width(), + height = m_frame.clientArea().height(); + + for (; it != it_end; ++it) { + (*it)->moveResize(x, y, width, height); + } + + sendConfigureNotify(); +}
M src/Window.hhsrc/Window.hh

@@ -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.106 2004/01/18 19:14:08 fluxgen Exp $ +// $Id: Window.hh,v 1.107 2004/01/23 10:38:25 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -352,6 +352,8 @@ FbTk::Subject &focusSig() { return m_focussig; }

FbTk::Subject &titleSig() { return m_titlesig; } /** @} */ // end group signals + void reconfigTheme(); + const timeval &lastFocusTime() const { return m_last_focus_time;} //@}

@@ -409,6 +411,17 @@ /// sends configurenotify to all clients

void sendConfigureNotify(bool send_to_netizens = true); // state and hint signals WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig, m_focussig, m_titlesig; + + class ThemeListener: public FbTk::Observer { + public: + ThemeListener(FluxboxWindow &win):m_win(win) { } + void update(FbTk::Subject *) { + m_win.reconfigTheme(); + } + private: + FluxboxWindow &m_win; + }; + ThemeListener m_themelistener; // Window states bool moving, resizing, shaded, iconic,