aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-26 16:17:02 (GMT)
committerrathnor <rathnor>2003-07-26 16:17:02 (GMT)
commit2585aefafe99591a6d3fa20fd09f079ddfa897c1 (patch)
tree98dfce1ebc1e0e3537360aaa3953cb8abba3c6dc /src
parent2b7aace6b304fc46ae4f948feb531ae60b39251e (diff)
downloadfluxbox-2585aefafe99591a6d3fa20fd09f079ddfa897c1.zip
fluxbox-2585aefafe99591a6d3fa20fd09f079ddfa897c1.tar.bz2
fix window size when varying borderWidth
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrame.cc21
-rw-r--r--src/FbWinFrame.hh4
-rw-r--r--src/Window.cc25
-rw-r--r--src/Window.hh4
4 files changed, 35 insertions, 19 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index a848788..ada5f00 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrame.cc,v 1.30 2003/07/10 11:36:21 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.31 2003/07/26 16:17:01 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -914,3 +914,22 @@ void FbWinFrame::renderLabelButtons() {
914 } 914 }
915 915
916} 916}
917
918void FbWinFrame::setBorderWidth(unsigned int borderW) {
919 int bw_changes = 0;
920 // we need to change the size of the window
921 // if the border width changes...
922 if (m_use_titlebar)
923 bw_changes += (signed) borderW - titlebar().borderWidth();
924 if (m_use_handle)
925 bw_changes += (signed) borderW - handle().borderWidth();
926
927 window().setBorderWidth(borderW);
928 titlebar().setBorderWidth(borderW);
929 handle().setBorderWidth(borderW);
930 gripLeft().setBorderWidth(borderW);
931 gripRight().setBorderWidth(borderW);
932
933 if (bw_changes != 0)
934 resize(width(), height() + bw_changes);
935}
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 49bb452..2632311 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrame.hh,v 1.9 2003/07/10 11:36:21 fluxgen Exp $ 22// $Id: FbWinFrame.hh,v 1.10 2003/07/26 16:17:01 rathnor Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -113,6 +113,8 @@ public:
113 void hideAllDecorations(); 113 void hideAllDecorations();
114 void showAllDecorations(); 114 void showAllDecorations();
115 115
116 void setBorderWidth(unsigned int borderW);
117
116 /** 118 /**
117 @name Event handlers 119 @name Event handlers
118 */ 120 */
diff --git a/src/Window.cc b/src/Window.cc
index 0ba7a4a..ba5b346 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.210 2003/07/24 03:19:02 rathnor Exp $ 25// $Id: Window.cc,v 1.211 2003/07/26 16:17:01 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -504,7 +504,7 @@ void FluxboxWindow::init() {
504 504
505 grabButtons(); 505 grabButtons();
506 506
507 applyDecorations(); 507 applyDecorations(true);
508 508
509 if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) 509 if (m_workspace_number < 0 || m_workspace_number >= screen().getCount())
510 m_workspace_number = screen().currentWorkspaceID(); 510 m_workspace_number = screen().currentWorkspaceID();
@@ -2678,21 +2678,15 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
2678} 2678}
2679 2679
2680// commit current decoration values to actual displayed things 2680// commit current decoration values to actual displayed things
2681void FluxboxWindow::applyDecorations() { 2681void FluxboxWindow::applyDecorations(bool initial) {
2682 frame().clientArea().setBorderWidth(0); // client area bordered by other things 2682 frame().clientArea().setBorderWidth(0); // client area bordered by other things
2683 2683
2684 unsigned int borderW = 0; 2684 unsigned int borderW = 0;
2685 if (decorations.border) 2685 if (decorations.border)
2686 borderW = screen().rootTheme().borderWidth(); 2686 borderW = screen().rootTheme().borderWidth();
2687 2687
2688 if (frame().window().borderWidth() != borderW) { 2688 if (initial || frame().window().borderWidth() != borderW)
2689 frame().window().setBorderWidth(borderW); 2689 frame().setBorderWidth(borderW);
2690 frame().titlebar().setBorderWidth(borderW);
2691 frame().handle().setBorderWidth(borderW);
2692 frame().gripLeft().setBorderWidth(borderW);
2693 frame().gripRight().setBorderWidth(borderW);
2694 frame().reconfigure();
2695 }
2696 2690
2697 // we rely on frame not doing anything if it is already shown/hidden 2691 // we rely on frame not doing anything if it is already shown/hidden
2698 if (decorations.titlebar) 2692 if (decorations.titlebar)
@@ -2700,9 +2694,10 @@ void FluxboxWindow::applyDecorations() {
2700 else 2694 else
2701 frame().hideTitlebar(); 2695 frame().hideTitlebar();
2702 2696
2703 if (decorations.handle) 2697 if (decorations.handle) {
2704 frame().showHandle(); 2698 frame().showHandle();
2705 else 2699 frame().reconfigure(); // show handle requires reconfigure
2700 } else
2706 frame().hideHandle(); 2701 frame().hideHandle();
2707 2702
2708} 2703}
@@ -2713,15 +2708,15 @@ void FluxboxWindow::toggleDecoration() {
2713 return; 2708 return;
2714 2709
2715 if (decorations.enabled) { //remove decorations 2710 if (decorations.enabled) { //remove decorations
2716 setDecoration(DECOR_NONE);
2717 decorations.enabled = false; 2711 decorations.enabled = false;
2712 setDecoration(DECOR_NONE);
2718 } else { //revert back to old decoration 2713 } else { //revert back to old decoration
2714 decorations.enabled = true;
2719 if (m_old_decoration == DECOR_NONE) { // make sure something happens 2715 if (m_old_decoration == DECOR_NONE) { // make sure something happens
2720 setDecoration(DECOR_NORMAL); 2716 setDecoration(DECOR_NORMAL);
2721 } else { 2717 } else {
2722 setDecoration(m_old_decoration); 2718 setDecoration(m_old_decoration);
2723 } 2719 }
2724 decorations.enabled = true;
2725 } 2720 }
2726} 2721}
2727 2722
diff --git a/src/Window.hh b/src/Window.hh
index d6eb944..573739d 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.hh,v 1.86 2003/07/24 03:19:02 rathnor Exp $ 25// $Id: Window.hh,v 1.87 2003/07/26 16:17:02 rathnor Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -241,7 +241,7 @@ public:
241 //@} 241 //@}
242 242
243 void setDecoration(Decoration decoration); 243 void setDecoration(Decoration decoration);
244 void applyDecorations(); 244 void applyDecorations(bool initial = false);
245 void toggleDecoration(); 245 void toggleDecoration();
246 246
247 247