all repos — fluxbox @ 9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c

custom fork of the fluxbox windowmanager

fix window size when changing titlebar height
rathnor rathnor
commit

9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c

parent

6984eb8970b61c0a6bcacba301707807d47d9b42

4 files changed, 54 insertions(+), 32 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.6: *03/10/05: + * Fix frame size when changing titlebar size (Simon) + - also send configure notify when toggling decorations + FbWinFrame.hh/cc Window.cc * Move a bunch of functionality from Keys into FbTk::KeyUtil (Simon) - also fix issue where Capslock mod was taken to be whatever caps key was mapped to (why??). Now uses LockMask (ditto num,scroll).
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.56 2003/10/02 14:14:45 rathnor Exp $ +// $Id: FbWinFrame.cc,v 1.57 2003/10/05 09:03:43 rathnor Exp $ #include "FbWinFrame.hh"

@@ -391,9 +391,9 @@ m_clientarea.showSubwindows();

} -void FbWinFrame::hideTitlebar() { +bool FbWinFrame::hideTitlebar() { if (!m_use_titlebar) - return; + return false; m_titlebar.hide(); m_use_titlebar = false;

@@ -402,11 +402,12 @@

// only take away one borderwidth (as the other border is still the "top" border) m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - m_titlebar.borderWidth()); + return true; } -void FbWinFrame::showTitlebar() { +bool FbWinFrame::showTitlebar() { if (m_use_titlebar) - return; + return false; m_titlebar.show(); m_use_titlebar = true;

@@ -414,24 +415,26 @@

// only add one borderwidth (as the other border is still the "top" border) m_window.resize(m_window.width(), m_window.height() + m_titlebar.height() + m_titlebar.borderWidth()); + return true; } -void FbWinFrame::hideHandle() { +bool FbWinFrame::hideHandle() { if (!m_use_handle) - return; + return false; m_handle.hide(); m_grip_left.hide(); m_grip_right.hide(); m_use_handle = false; m_window.resize(m_window.width(), m_window.height() - m_handle.height() - m_handle.borderWidth()); + return true; } -void FbWinFrame::showHandle() { +bool FbWinFrame::showHandle() { if (m_use_handle) - return; + return false; m_handle.show(); m_handle.showSubwindows(); // shows grips

@@ -439,22 +442,29 @@

m_use_handle = true; m_window.resize(m_window.width(), m_window.height() + m_handle.height() + m_handle.borderWidth()); + return true; } -void FbWinFrame::hideAllDecorations() { - hideHandle(); - hideTitlebar(); +bool FbWinFrame::hideAllDecorations() { + bool changed = false; + changed |= hideHandle(); + changed |= hideTitlebar(); // resize done by hide* reconfigure(); + + return changed; } -void FbWinFrame::showAllDecorations() { +bool FbWinFrame::showAllDecorations() { + bool changed = false; if (!m_use_handle) - showHandle(); + changed |= showHandle(); if (!m_use_titlebar) - showTitlebar(); + changed |= showTitlebar(); // resize shouldn't be necessary reconfigure(); + + return changed; } /**

@@ -740,12 +750,16 @@ void FbWinFrame::reconfigureTitlebar() {

if (!m_use_titlebar) return; + int orig_height = m_titlebar.height(); // resize titlebar to window size with font height int title_height = m_theme.font().height() == 0 ? 16 : m_theme.font().height() + m_bevel*2 + 2; if (m_theme.titleHeight() != 0) title_height = m_theme.titleHeight(); + // if the titlebar grows in size, make sure the whole window does too + if (orig_height != title_height) + m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), m_window.width(), title_height);
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -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.hh,v 1.22 2003/10/02 14:14:46 rathnor Exp $ +// $Id: FbWinFrame.hh,v 1.23 2003/10/05 09:03:43 rathnor Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH

@@ -118,12 +118,13 @@ void setEventHandler(FbTk::EventHandler &evh);

/// remove any handler for the windows void removeEventHandler(); - void hideTitlebar(); - void showTitlebar(); - void hideHandle(); - void showHandle(); - void hideAllDecorations(); - void showAllDecorations(); + // these return true/false for if something changed + bool hideTitlebar(); + bool showTitlebar(); + bool hideHandle(); + bool showHandle(); + bool hideAllDecorations(); + bool showAllDecorations(); // this function translates its arguments according to win_gravity // if win_gravity is negative, it does an inverse translation
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.239 2003/10/05 02:31:22 rathnor Exp $ +// $Id: Window.cc,v 1.240 2003/10/05 09:03:43 rathnor Exp $ #include "Window.hh"

@@ -511,7 +511,6 @@ moveToLayer(m_layernum);

if (!place_window) moveResize(frame().x(), frame().y(), frame().width(), frame().height()); - screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);

@@ -2627,6 +2626,7 @@

// commit current decoration values to actual displayed things void FluxboxWindow::applyDecorations(bool initial) { frame().clientArea().setBorderWidth(0); // client area bordered by other things + bool client_move = false; int grav_x=0, grav_y=0; // negate gravity

@@ -2636,28 +2636,34 @@ unsigned int border_width = 0;

if (decorations.border) border_width = frame().theme().border().width(); - if (initial || frame().window().borderWidth() != border_width) + if (initial || frame().window().borderWidth() != border_width) { + client_move = true; frame().setBorderWidth(border_width); + } // we rely on frame not doing anything if it is already shown/hidden if (decorations.titlebar) - frame().showTitlebar(); + client_move |= frame().showTitlebar(); else - frame().hideTitlebar(); + client_move |= frame().hideTitlebar(); if (decorations.handle) { - frame().showHandle(); + client_move |= frame().showHandle(); } else - frame().hideHandle(); + client_move |= frame().hideHandle(); // apply gravity once more frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); // if the location changes, shift it - if (grav_x != 0 || grav_y != 0) + if (grav_x != 0 || grav_y != 0) { move(grav_x + frame().x(), grav_y + frame().y()); + client_move = true; + } frame().reconfigure(); + if (client_move) + sendConfigureNotify(); } void FluxboxWindow::toggleDecoration() {

@@ -2988,8 +2994,6 @@ WinClient *client = Fluxbox::instance()->searchWindow(child);

FluxboxWindow *attach_to_win = 0; if (client) attach_to_win = client->fbwindow(); - - cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl; if (attach_to_win != this && attach_to_win != 0) {