From e7b893beba45053ff05a8a192d198b7c5d7918bf Mon Sep 17 00:00:00 2001
From: rathnor <rathnor>
Date: Mon, 28 Apr 2003 13:38:23 +0000
Subject: fixing remembering of decorations

---
 ChangeLog     |  2 ++
 src/Window.cc | 28 +++++++++++++++++++++-------
 src/Window.hh |  3 ++-
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4ccb70..536e3a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 (Format: Year/Month/Day)
 Changes for 0.9.2:
 *03/04/28:
+   * Fix remembering (and general init) of decorations (Simon)
+     Window.hh/cc
    * Fix handleEvent issues, plus detachClient crash (Simon)
      Window.cc Screen.cc Remember.cc
 *03/04/27:
diff --git a/src/Window.cc b/src/Window.cc
index 986b812..7aaeb41 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.154 2003/04/28 12:56:38 rathnor Exp $
+// $Id: Window.cc,v 1.155 2003/04/28 13:38:23 rathnor Exp $
 
 #include "Window.hh"
 
@@ -2507,7 +2507,6 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
 	//	functions.iconify = functions.maximize = true;
 	//	functions.move = true;   // We need to move even without decor
 	//	functions.resize = true; // We need to resize even without decor
-        frame().hideAllDecorations();
 	break;
 
     default:
@@ -2517,9 +2516,6 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
             decorations.menu = true;
         functions.resize = functions.move = functions.iconify =
             functions.maximize = true;
-        m_frame.showAllDecorations();
-        m_frame.show();
-        
 	break;
 
     case DECOR_TINY:
@@ -2527,7 +2523,6 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
             functions.move = functions.iconify = true;
         decorations.border = decorations.handle = decorations.maximize =
             functions.resize = functions.maximize = false;
-        m_frame.show();
 	break;
 
     case DECOR_TOOL:
@@ -2537,11 +2532,29 @@ void FluxboxWindow::setDecoration(Decoration decoration) {
             functions.iconify = false;
 	break;
     }
-
+    applyDecorations();
+    // is this reconfigure necessary???
     reconfigure();
 
 }
 
+// commit current decoration values to actual displayed things
+void FluxboxWindow::applyDecorations() {
+    // we rely on frame not doing anything if it is already shown/hidden
+    if (decorations.titlebar) 
+        m_frame.showTitlebar();
+    else
+        m_frame.hideTitlebar();
+
+    if (decorations.handle)
+        m_frame.showHandle();
+    else
+        m_frame.hideHandle();
+
+    m_frame.show();
+    // is reconfigure needed here?
+}
+
 void FluxboxWindow::toggleDecoration() {
     //don't toggle decor if the window is shaded
     if (isShaded())
@@ -2599,6 +2612,7 @@ void FluxboxWindow::setDecorationMask(unsigned int mask) {
     decorations.shade    = mask & DECORM_SHADE;
     decorations.tab      = mask & DECORM_TAB;
     decorations.enabled  = mask & DECORM_ENABLED;
+    applyDecorations();
 }
 
 bool FluxboxWindow::validateClient() {
diff --git a/src/Window.hh b/src/Window.hh
index cbeb6ac..d8ddcdd 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.64 2003/04/27 14:36:05 rathnor Exp $
+// $Id: Window.hh,v 1.65 2003/04/28 13:38:23 rathnor Exp $
 
 #ifndef	 WINDOW_HH
 #define	 WINDOW_HH
@@ -202,6 +202,7 @@ public:
     //@}
 
     void setDecoration(Decoration decoration);
+    void applyDecorations();
     void toggleDecoration();
 	
     /** 
-- 
cgit v0.11.2