]> git.decadent.org.uk Git - ion3.git/blobdiff - mod_tiling/tiling.c
Imported Upstream version 20090110
[ion3.git] / mod_tiling / tiling.c
index 6fec3723b095675a06c429a934a2ce056375f7a6..48bbb86f506a3976f57258831660bb12a4710544 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/mod_tiling/tiling.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2007
+ * Copyright (c) Tuomo Valkonen 1999-2009
  *
  * See the included file LICENSE for details.
  */
@@ -432,6 +432,8 @@ void tiling_manage_stdisp(WTiling *ws, WRegion *stdisp,
         tiling_unmanage_stdisp(ws, TRUE, TRUE);
         return;
     }
+
+    stdisp->flags|=REGION_SKIP_FOCUS;
     
     dg=((WSplit*)(ws->stdispnode))->geom;
     
@@ -476,8 +478,7 @@ bool tiling_managed_add_default(WTiling *ws, WRegion *reg)
     
     frame=OBJ_CAST(reg, WFrame);
     if(frame!=NULL){
-        WFrameMode mode=frame_mode(frame);
-        if(mode!=FRAME_MODE_TILED && mode!=FRAME_MODE_TILED_ALT)
+        if(framemode_unalt(frame_mode(frame))!=FRAME_MODE_TILED)
             frame_set_mode(frame, FRAME_MODE_TILED);
     }
     
@@ -660,6 +661,7 @@ void tiling_do_managed_remove(WTiling *ws, WRegion *reg)
     }
 
     region_unset_manager(reg, (WRegion*)ws);
+    splittree_set_node_of(reg, NULL);
 }
 
 
@@ -701,6 +703,7 @@ void tiling_managed_remove(WTiling *ws, WRegion *reg)
             
             if(other!=NULL){
                 node->reg=other;
+                splittree_set_node_of(other, node);
                 tiling_managed_add(ws, other);
                 reused=TRUE;
             }else{
@@ -989,10 +992,6 @@ static WFrame *tiling_do_split(WTiling *ws, WSplit *node,
         destroy_obj((Obj*)newframe);
         return NULL;
     }
-
-    /* Restack */
-    if(ws->split_tree!=NULL)
-        split_restack(ws->split_tree, ws->dummywin, Above);
     
     return newframe;
 }
@@ -1067,45 +1066,26 @@ WFrame *tiling_split_at(WTiling *ws, WFrame *frame, const char *dirstr,
 }
 
 
-void do_unsplit(WRegion *reg)
+/*EXTL_DOC
+ * Try to relocate regions managed by \var{reg} to another frame
+ * and, if possible, destroy it.
+ */
+EXTL_EXPORT_MEMBER
+void tiling_unsplit_at(WTiling *ws, WRegion *reg)
 {
-    WTiling *ws=REGION_MANAGER_CHK(reg, WTiling);
     WPHolder *ph;
-    bool res;
     
-    if(ws==NULL)
+    if(reg==NULL || REGION_MANAGER(reg)!=(WRegion*)ws)
         return;
     
     ph=region_get_rescue_pholder_for((WRegion*)ws, reg);
     
-    if(ph==NULL){
-        res=!region_rescue_needed(reg);
-    }else{
-        res=region_rescue(reg, ph);
+    if(ph!=NULL){
+        region_rescue(reg, ph, REGION_RESCUE_NODEEP|REGION_RESCUE_PHFLAGS_OK);
         destroy_obj((Obj*)ph);
     }
     
-    if(!res){
-        warn(TR("Unable to unsplit: Could not move client windows "
-                "elsewhere within the tiling."));
-        return;
-    }
-    
-    destroy_obj((Obj*)reg);
-}
-
-
-/*EXTL_DOC
- * Try to relocate regions managed by \var{reg} to another frame
- * and, if possible, destroy it.
- */
-EXTL_EXPORT_MEMBER
-void tiling_unsplit_at(WTiling *ws, WRegion *reg)
-{
-    if(reg==NULL || REGION_MANAGER(reg)!=(WRegion*)ws)
-        return;
-        
-    mainloop_defer_action((Obj*)reg, (WDeferredAction*)do_unsplit);
+    region_defer_rqdispose(reg);
 }
 
 
@@ -1129,7 +1109,8 @@ WRegion *tiling_current(WTiling *ws)
 /*EXTL_DOC
  * Iterate over managed regions of \var{ws} until \var{iterfn} returns
  * \code{false}.
- * The function itself returns \code{true} if it reaches the end of list
+ * The function is called in protected mode.
+ * This routine returns \code{true} if it reaches the end of list
  * without this happening.
  */
 EXTL_SAFE