From e56c3c5b448a16a90dc1e518b29afd5c0ee544e8 Mon Sep 17 00:00:00 2001 From: rathnor Date: Fri, 23 Jan 2004 10:38:25 +0000 Subject: fix some issues with window frame that happened when changing style --- ChangeLog | 4 ++++ src/FbWinFrame.cc | 52 +++++++++++++++++++++++++++++++++------------------- src/Window.cc | 35 ++++++++++++++++++++++++++++++++++- src/Window.hh | 15 ++++++++++++++- 4 files changed, 85 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62de82b..02cdd7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index d310f24..5dcd64a 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // 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 @@ void FbWinFrame::reconfigure() { 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 @@ void FbWinFrame::reconfigure() { 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(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); + // align handle and grips + const int grip_height = m_handle.height(); + const int grip_width = 20; //TODO + const int handle_bw = static_cast(m_handle.borderWidth()); - m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, - grip_width, grip_height); - m_handle.raise(); + int ypos = m_window.height(); - client_height -= m_handle.height() + m_handle.borderWidth(); + // if the handle isn't on, it's actually below the window + if (m_use_handle) + ypos -= grip_height + handle_bw; + + // 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); - } diff --git a/src/Window.cc b/src/Window.cc index ff67a8d..a7e3afa 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // 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 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, 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), @@ -280,6 +281,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) { + tm.reconfigSig().attach(&m_themelistener); + init(); } @@ -3457,3 +3460,33 @@ void FluxboxWindow::setupWindow() { 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(); +} diff --git a/src/Window.hh b/src/Window.hh index 71c0b71..0ee053f 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // 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 @@ public: FbTk::Subject &titleSig() { return m_titlesig; } /** @} */ // end group signals + void reconfigTheme(); + const timeval &lastFocusTime() const { return m_last_focus_time;} //@} @@ -410,6 +412,17 @@ private: // 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, focused, stuck, m_managed; -- cgit v0.11.2