]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/saveload.c
[svn-upgrade] Integrating new upstream version, ion3 (20070506)
[ion3.git] / ioncore / saveload.c
index e5902b302dec819020e92716aa4418d5d0777a2e..db8a12f47b55dcb9e9ee043690836ec042aaa750 100644 (file)
@@ -1,12 +1,9 @@
 /*
  * ion/ioncore/saveload.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2006
+ * Copyright (c) Tuomo Valkonen 1999-2007
  *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
  */
 
 #include <string.h>
@@ -86,33 +83,6 @@ WRegion *create_region_load(WWindow *par, const WFitParams *fp,
     
     if(!extl_table_gets_s(tab, "type", &objclass))
         return NULL;
-        
-    /* Backwards compatibility hack. */
-    if(strcmp(objclass, "WFloatWS")==0){
-        objclass=scopy("WGroupWS");
-    }else if(strcmp(objclass, "WIonWS")==0){
-        WGroupWS *ws=create_groupws(par, fp);
-        if(ws!=NULL){
-            extl_table_gets_s(tab, "name", &name);
-            extl_table_sets_s(tab, "type", "WTiling");
-            extl_table_sets_b(tab, "bottom", TRUE);
-            extl_table_sets_b(tab, "bottom_last_close", TRUE);
-            extl_table_sets_i(tab, "sizepolicy", SIZEPOLICY_FULL_EXACT);
-            
-            if(name!=NULL)
-                region_set_name((WRegion*)ws, name);
-            
-            reg=group_attach_new((WGroup*)ws, tab);
-            
-            if(reg!=NULL)
-                return (WRegion*)ws;
-            
-            destroy_obj((Obj*)ws);
-        }
-        objclass=scopy("WTiling");
-    }else if(strcmp(objclass, "WFloatFrame")==0){
-        objclass=scopy("WFrame");
-    }
     
     if(objclass==NULL)
         return NULL;
@@ -187,10 +157,34 @@ ExtlTab region_get_base_configuration(WRegion *reg)
 }
 
 
+static bool get_config_clientwins=TRUE;
+
+
 ExtlTab region_get_configuration(WRegion *reg)
 {
     ExtlTab tab=extl_table_none();
-    CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg));
+    if(get_config_clientwins || !OBJ_IS(reg, WClientWin)){
+        CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg));
+    }
+    return tab;
+}
+
+
+/*EXTL_DOC
+ * Get configuration tree. If \var{clientwins} is unset, client windows
+ * are filtered out.
+ */
+EXTL_EXPORT_AS(WRegion, get_configuration)
+ExtlTab region_get_configuration_extl(WRegion *reg, bool clientwins)
+{
+    ExtlTab tab;
+    
+    get_config_clientwins=clientwins;
+    
+    tab=region_get_configuration(reg);
+    
+    get_config_clientwins=TRUE;
+    
     return tab;
 }
 
@@ -226,6 +220,14 @@ bool ioncore_init_layout()
     FOR_ALL_SCREENS(scr){
         ExtlTab scrtab=extl_table_none();
         bool scrok=FALSE;
+        
+        /* Potential Xinerama or such support should set the screen ID
+         * of the root window to less than zero, and number its own
+         * fake screens up from 0.
+         */
+        if(screen_id(scr)<0)
+            continue;
+
         if(ok)
             scrok=extl_table_geti_t(tab, screen_id(scr), &scrtab);
         
@@ -278,7 +280,14 @@ bool ioncore_save_layout()
         return FALSE;
     
     FOR_ALL_SCREENS(scr){
-        ExtlTab scrtab=region_get_configuration((WRegion*)scr);
+        ExtlTab scrtab;
+        
+        /* See note above */
+        if(screen_id(scr)<0)
+            continue;
+            
+        scrtab=region_get_configuration((WRegion*)scr);
+        
         if(scrtab==extl_table_none()){
             warn(TR("Unable to get configuration for screen %d."),
                  screen_id(scr));