fix window size when varying borderWidth
rathnor rathnor
5 files changed,
37 insertions(+),
19 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,6 +1,8 @@
(Format: Year/Month/Day) Changes for 0.9.5: *03/07/26: + * Fix window size when changing borderWidth [borderless wins] (Simon) + Window.hh/cc FbWinFrame.hh/cc * Fix some keybinding issues with ShadeWindow, StickWindow, SendToWorkspace, NextGroup, PrevGroup (Simon) CurrentWindowCmd.cc FbCommandFactory.cc
M
src/FbWinFrame.cc
→
src/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.30 2003/07/10 11:36:21 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.31 2003/07/26 16:17:01 rathnor Exp $ #include "FbWinFrame.hh" #include "ImageControl.hh"@@ -914,3 +914,22 @@ m_current_label->clear();
} } + +void FbWinFrame::setBorderWidth(unsigned int borderW) { + int bw_changes = 0; + // we need to change the size of the window + // if the border width changes... + if (m_use_titlebar) + bw_changes += (signed) borderW - titlebar().borderWidth(); + if (m_use_handle) + bw_changes += (signed) borderW - handle().borderWidth(); + + window().setBorderWidth(borderW); + titlebar().setBorderWidth(borderW); + handle().setBorderWidth(borderW); + gripLeft().setBorderWidth(borderW); + gripRight().setBorderWidth(borderW); + + if (bw_changes != 0) + resize(width(), height() + bw_changes); +}
M
src/FbWinFrame.hh
→
src/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.9 2003/07/10 11:36:21 fluxgen Exp $ +// $Id: FbWinFrame.hh,v 1.10 2003/07/26 16:17:01 rathnor Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH@@ -112,6 +112,8 @@ void hideHandle();
void showHandle(); void hideAllDecorations(); void showAllDecorations(); + + void setBorderWidth(unsigned int borderW); /** @name Event handlers
M
src/Window.cc
→
src/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.210 2003/07/24 03:19:02 rathnor Exp $ +// $Id: Window.cc,v 1.211 2003/07/26 16:17:01 rathnor Exp $ #include "Window.hh"@@ -504,7 +504,7 @@ associateClientWindow();
grabButtons(); - applyDecorations(); + applyDecorations(true); if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) m_workspace_number = screen().currentWorkspaceID();@@ -2678,21 +2678,15 @@
} // commit current decoration values to actual displayed things -void FluxboxWindow::applyDecorations() { +void FluxboxWindow::applyDecorations(bool initial) { frame().clientArea().setBorderWidth(0); // client area bordered by other things unsigned int borderW = 0; if (decorations.border) borderW = screen().rootTheme().borderWidth(); - if (frame().window().borderWidth() != borderW) { - frame().window().setBorderWidth(borderW); - frame().titlebar().setBorderWidth(borderW); - frame().handle().setBorderWidth(borderW); - frame().gripLeft().setBorderWidth(borderW); - frame().gripRight().setBorderWidth(borderW); - frame().reconfigure(); - } + if (initial || frame().window().borderWidth() != borderW) + frame().setBorderWidth(borderW); // we rely on frame not doing anything if it is already shown/hidden if (decorations.titlebar)@@ -2700,9 +2694,10 @@ frame().showTitlebar();
else frame().hideTitlebar(); - if (decorations.handle) + if (decorations.handle) { frame().showHandle(); - else + frame().reconfigure(); // show handle requires reconfigure + } else frame().hideHandle(); }@@ -2713,15 +2708,15 @@ if (isShaded())
return; if (decorations.enabled) { //remove decorations - setDecoration(DECOR_NONE); decorations.enabled = false; + setDecoration(DECOR_NONE); } else { //revert back to old decoration + decorations.enabled = true; if (m_old_decoration == DECOR_NONE) { // make sure something happens setDecoration(DECOR_NORMAL); } else { setDecoration(m_old_decoration); } - decorations.enabled = true; } }
M
src/Window.hh
→
src/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.86 2003/07/24 03:19:02 rathnor Exp $ +// $Id: Window.hh,v 1.87 2003/07/26 16:17:02 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH@@ -241,7 +241,7 @@ void leaveNotifyEvent(XCrossingEvent &ev);
//@} void setDecoration(Decoration decoration); - void applyDecorations(); + void applyDecorations(bool initial = false); void toggleDecoration();