fix window size when varying borderWidth

This commit is contained in:
rathnor 2003-07-26 16:17:02 +00:00
parent 2b7aace6b3
commit 2585aefafe
5 changed files with 37 additions and 19 deletions

View file

@ -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

View file

@ -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.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 @@ void FbWinFrame::renderLabelButtons() {
}
}
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);
}

View file

@ -19,7 +19,7 @@
// 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
@ -113,6 +113,8 @@ public:
void hideAllDecorations();
void showAllDecorations();
void setBorderWidth(unsigned int borderW);
/**
@name Event handlers
*/

View file

@ -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.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 @@ void FluxboxWindow::init() {
grabButtons();
applyDecorations();
applyDecorations(true);
if (m_workspace_number < 0 || m_workspace_number >= screen().getCount())
m_workspace_number = screen().currentWorkspaceID();
@ -2678,21 +2678,15 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
}
// 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 @@ void FluxboxWindow::applyDecorations() {
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 @@ void FluxboxWindow::toggleDecoration() {
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;
}
}

View file

@ -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.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 @@ public:
//@}
void setDecoration(Decoration decoration);
void applyDecorations();
void applyDecorations(bool initial = false);
void toggleDecoration();