From 68ffc78978a3e2aef2b47e4831e7851f3ca51918 Mon Sep 17 00:00:00 2001
From: rathnor <rathnor>
Date: Sat, 26 Apr 2003 05:42:36 +0000
Subject: Add code for remember functionality (Simon)

---
 ChangeLog       |  6 ++++++
 RoadMap         |  2 +-
 src/Makefile.am |  4 +++-
 src/Screen.cc   |  4 ++--
 src/Window.cc   | 43 ++++++++++++++++++++++++++++++++++++++++++-
 src/Window.hh   | 20 +++++++++++++++++++-
 src/fluxbox.cc  | 53 ++++++++++++++++-------------------------------------
 7 files changed, 89 insertions(+), 43 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 59a4417..df43786 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 (Format: Year/Month/Day)
 Changes for 0.9.2:
+*03/04/26:
+   * Add remember patch integration code (Simon)
+     - note: does not include "startup" menu
+     - save on close disabled atm, due to other issues...
+     - enabled in configure by default, disable with --disable-remember
+     Makefile.am Remember.hh/cc Screen.cc Window.hh/cc fluxbox.cc
 *03/04/25:
    * Fix small gcc 3.3 build issue (Simon)
      Window.hh/cc
diff --git a/RoadMap b/RoadMap
index 5782f2d..8de499e 100644
--- a/RoadMap
+++ b/RoadMap
@@ -99,7 +99,7 @@ Bugfixes/lower priority:
 Release:      0.9.2
 Approx Date:  5 May, 2003
 Major Features:
- - Integration of Remember patch        (Simon)
+ + Integration of Remember patch        (Simon)
  * Transparency                         (Henrik)
 Minor Features:
  - more keybinding actions              (Both)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8dd4684..38d5b48 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,6 +69,8 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
 	WinButton.hh WinButton.cc Window.cc Window.hh \
 	Workspace.cc Workspace.hh \
 	XrmDatabaseHelper.hh FbCommands.hh FbCommands.cc LayerMenu.hh \
-	IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh WinClient.hh WinClient.cc
+	IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh \
+	WinClient.hh WinClient.cc \
+	Remember.hh Remember.cc
 
 LDADD=FbTk/libFbTk.a
diff --git a/src/Screen.cc b/src/Screen.cc
index de5e655..226c352 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Screen.cc,v 1.135 2003/04/25 17:39:00 fluxgen Exp $
+// $Id: Screen.cc,v 1.136 2003/04/26 05:42:35 rathnor Exp $
 
 
 #include "Screen.hh"
@@ -1260,8 +1260,8 @@ FluxboxWindow *BScreen::createWindow(Window client) {
 
         //TODO: is next line needed?
         Fluxbox::instance()->saveWindowSearch(client, win);
-        Fluxbox::instance()->attachSignals(*win);
         setupWindowActions(*win);
+        Fluxbox::instance()->attachSignals(*win);
     }
     if (win->getWorkspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) {
         win->show();
diff --git a/src/Window.cc b/src/Window.cc
index 10db141..b6e29c7 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.148 2003/04/25 16:11:00 fluxgen Exp $
+// $Id: Window.cc,v 1.149 2003/04/26 05:42:35 rathnor Exp $
 
 #include "Window.hh"
 
@@ -2556,6 +2556,47 @@ void FluxboxWindow::toggleDecoration() {
     }
 }
 
+unsigned int FluxboxWindow::getDecorationMask() const {
+    unsigned int ret = 0;
+    if (decorations.titlebar)
+        ret |= DECORM_TITLEBAR;
+    if (decorations.handle)
+        ret |= DECORM_HANDLE;
+    if (decorations.border)
+        ret |= DECORM_BORDER;
+    if (decorations.iconify)
+        ret |= DECORM_ICONIFY;
+    if (decorations.maximize)
+        ret |= DECORM_MAXIMIZE;
+    if (decorations.close)
+        ret |= DECORM_CLOSE;
+    if (decorations.menu)
+        ret |= DECORM_MENU;
+    if (decorations.sticky)
+        ret |= DECORM_STICKY;
+    if (decorations.shade)
+        ret |= DECORM_SHADE;
+    if (decorations.tab)
+        ret |= DECORM_TAB;
+    if (decorations.enabled)
+        ret |= DECORM_ENABLED;
+    return ret;
+}
+
+void FluxboxWindow::setDecorationMask(unsigned int mask) {
+    decorations.titlebar = mask & DECORM_TITLEBAR;
+    decorations.handle   = mask & DECORM_HANDLE;
+    decorations.border   = mask & DECORM_BORDER;
+    decorations.iconify  = mask & DECORM_ICONIFY;
+    decorations.maximize = mask & DECORM_MAXIMIZE;
+    decorations.close    = mask & DECORM_CLOSE;
+    decorations.menu     = mask & DECORM_MENU;
+    decorations.sticky   = mask & DECORM_STICKY;
+    decorations.shade    = mask & DECORM_SHADE;
+    decorations.tab      = mask & DECORM_TAB;
+    decorations.enabled  = mask & DECORM_ENABLED;
+}
+
 bool FluxboxWindow::validateClient() {
     XSync(display, false);
 
diff --git a/src/Window.hh b/src/Window.hh
index 16e606d..4884a1e 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.61 2003/04/25 11:27:13 rathnor Exp $
+// $Id: Window.hh,v 1.62 2003/04/26 05:42:36 rathnor Exp $
 
 #ifndef	 WINDOW_HH
 #define	 WINDOW_HH
@@ -204,6 +204,24 @@ public:
     void setDecoration(Decoration decoration);
     void toggleDecoration();
 	
+    enum DecorationMask {
+        DECORM_TITLEBAR = (1<<0),
+        DECORM_HANDLE   = (1<<1),
+        DECORM_BORDER   = (1<<2),
+        DECORM_ICONIFY  = (1<<3),
+        DECORM_MAXIMIZE = (1<<4),
+        DECORM_CLOSE    = (1<<5),
+        DECORM_MENU     = (1<<6),
+        DECORM_STICKY   = (1<<7),
+        DECORM_SHADE    = (1<<8),
+        DECORM_TAB      = (1<<9),
+        DECORM_ENABLED  = (1<<10),
+        DECORM_LAST     = (1<<11) // useful for getting "All"
+    };
+
+    unsigned int getDecorationMask() const;
+    void setDecorationMask(unsigned int mask);
+
 #ifdef SHAPE
     void shapeEvent(XShapeEvent *event);
 #endif // SHAPE
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 68e098b..5512af3 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: fluxbox.cc,v 1.118 2003/04/25 16:00:03 fluxgen Exp $
+// $Id: fluxbox.cc,v 1.119 2003/04/26 05:42:36 rathnor Exp $
 
 #include "fluxbox.hh"
 
@@ -59,7 +59,10 @@
 #endif // USE_GNOME
 #ifdef USE_NEWWMSPEC
 #include "Ewmh.hh"
-#endif //USE_NEWWMSPEC
+#endif // USE_NEWWMSPEC
+#ifdef REMEMBER
+#include "Remember.hh"
+#endif // REMEMBER
 
 // X headers
 #include <X11/Xlib.h>
@@ -421,6 +424,9 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
 #ifdef USE_NEWWMSPEC
     addAtomHandler(new Ewmh()); // for Extended window manager atom support
 #endif // USE_NEWWMSPEC
+#ifdef REMEMBER
+    m_atomhandler.push_back(new Remember()); // for remembering window attribs
+#endif // REMEMBER
 
     grab();
 	
@@ -1514,7 +1520,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
         //!! TODO
 #ifdef DEBUG
         cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO: signal stuff for client death!!"<<endl;
-#endif // DEBUG        
+#endif // DEBUG
     }
 }
 
@@ -1660,43 +1666,16 @@ void Fluxbox::save_rc() {
     for (; it != it_end; ++it) {
         BScreen *screen = *it;
         int screen_number = screen->getScreenNumber();
-        
-/*
+  
+        /*
 #ifdef SLIT
-        string slit_placement;
-
-        switch (screen->getSlitPlacement()) {
-        case Slit::TOPLEFT: slit_placement = "TopLeft"; break;
-        case Slit::CENTERLEFT: slit_placement = "CenterLeft"; break;
-        case Slit::BOTTOMLEFT: slit_placement = "BottomLeft"; break;
-        case Slit::TOPCENTER: slit_placement = "TopCenter"; break;
-        case Slit::BOTTOMCENTER: slit_placement = "BottomCenter"; break;
-        case Slit::TOPRIGHT: slit_placement = "TopRight"; break;
-        case Slit::BOTTOMRIGHT: slit_placement = "BottomRight"; break;
-        case Slit::CENTERRIGHT: default: slit_placement = "CenterRight"; break;
-        }
-
-        sprintf(rc_string, "session.screen%d.slit.placement: %s", screen_number,
-                slit_placement.c_str());
-        XrmPutLineResource(&new_blackboxrc, rc_string);
-
-        sprintf(rc_string, "session.screen%d.slit.direction: %s", screen_number,
-                ((screen->getSlitDirection() == Slit::HORIZONTAL) ? "Horizontal" :
-                 "Vertical"));
+ #ifdef XINERAMA
+        sprintf(rc_string, "session.screen%d.slit.onHead: %d", screen_number,
+                screen->getSlitOnHead());
         XrmPutLineResource(&new_blackboxrc, rc_string);
-
-        sprintf(rc_string, "session.screen%d.slit.autoHide: %s", screen_number,
-                ((screen->getSlit()->doAutoHide()) ? "True" : "False"));
-        XrmPutLineResource(&new_blackboxrc, rc_string);
-        /*
-          #ifdef XINERAMA
-          sprintf(rc_string, "session.screen%d.slit.onHead: %d", screen_number,
-          screen->getSlitOnHead());
-          XrmPutLineResource(&new_blackboxrc, rc_string);
-          #endif // XINERAMA
-*//*
+ #endif // XINERAMA
 #endif // SLIT
-  */      
+        */      
         sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number,
                 ((screen->getRowPlacementDirection() == BScreen::LEFTRIGHT) ?
                  "LeftToRight" : "RightToLeft"));
-- 
cgit v0.11.2