From f9ed11a351108662e3ca761169eeb51b86a35076 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Tue, 2 Sep 2008 11:41:55 -0400
Subject: resize fullscreen windows when resolution changes

---
 src/Window.cc | 17 ++++++++++++-----
 src/Window.hh |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/Window.cc b/src/Window.cc
index 3b9534b..16334c6 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1460,6 +1460,8 @@ void FluxboxWindow::setFullscreen(bool flag) {
         moveToLayer(m_old_layernum);
         stateSig().notify();
     }
+
+    attachWorkAreaSig();
 }
 
 void FluxboxWindow::setFullscreenLayer() {
@@ -1478,6 +1480,15 @@ void FluxboxWindow::setFullscreenLayer() {
 
 }
 
+void FluxboxWindow::attachWorkAreaSig() {
+    // notify when struts change, so we can resize accordingly
+    // Subject checks for duplicates for us
+    if (m_state.maximized || m_state.fullscreen)
+        screen().workspaceAreaSig().attach(this);
+    else
+        screen().workspaceAreaSig().detach(this);
+}
+
 /**
    Maximize window both horizontal and vertical
 */
@@ -1500,11 +1511,7 @@ void FluxboxWindow::setMaximizedState(int type) {
     m_state.maximized = type;
     frame().applyState();
 
-    // notify when struts change, so we can resize accordingly
-    if (m_state.maximized)
-        screen().workspaceAreaSig().attach(this);
-    else
-        screen().workspaceAreaSig().detach(this);
+    attachWorkAreaSig();
 
     // notify listeners that we changed state
     stateSig().notify();
diff --git a/src/Window.hh b/src/Window.hh
index 220cedb..8ee2b5c 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -501,6 +501,7 @@ private:
     void setState(unsigned long stateval, bool setting_up);
     /// set the layer of a fullscreen window
     void setFullscreenLayer();
+    void attachWorkAreaSig();
 
     // modifies left and top if snap is necessary
     void doSnapping(int &left, int &top);
-- 
cgit v0.11.2