]> git.decadent.org.uk Git - ion3.git/blobdiff - mod_tiling/ops.c
[svn-upgrade] Integrating new upstream version, ion3 (20070203)
[ion3.git] / mod_tiling / ops.c
index c86a80a94f6bbb2fc69a88b6b034d1d3b83bb0ea..48365528a2c2c16efc17ce8d35daf0135f8fef1b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/mod_tiling/ops.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
  * (at your option) any later version.
  */
 
-#include <libtu/objp.h>
-
 #include <ioncore/common.h>
 #include <ioncore/mplex.h>
 #include <ioncore/focus.h>
+#include <ioncore/return.h>
 #include <ioncore/group.h>
-#include <ioncore/group-ws.h>
-#include <ioncore/framedpholder.h>
 #include "tiling.h"
 
 
-static WGroup *find_group(WRegion *reg, bool *detach_framed)
-{
-    WRegion *mgr=REGION_MANAGER(reg);
-    bool was_grouped=FALSE;
-    
-    if(OBJ_IS(mgr, WMPlex)){
-        WMPlex *mplex=(WMPlex*)mgr;
-        *detach_framed=TRUE;
-        mgr=REGION_MANAGER(mgr);
-        if(OBJ_IS(mgr, WGroup)){
-            assert(mplex->mgd!=NULL);
-            if(mplex->mgd->reg==reg && mplex->mgd->mgr_next==NULL){
-                /* Nothing to detach */
-                return NULL;
-            }
-        }
-    }else{
-        was_grouped=OBJ_IS(mgr, WGroup);
-        *detach_framed=FALSE;
-    }
-    
-    while(mgr!=NULL){
-        mgr=REGION_MANAGER(mgr);
-        if(OBJ_IS(mgr, WGroup))
-            break;
-    }
-
-    if(mgr==NULL && was_grouped)
-        warn(TR("Already detached."));
-    
-    return (WGroup*)mgr;
-}
-
-
-static void get_relative_geom(WRectangle *g, WRegion *reg, WRegion *mgr)
-{
-    WWindow *rel=REGION_PARENT(mgr), *w;
-    
-    *g=REGION_GEOM(reg);
-    
-    for(w=REGION_PARENT(reg); 
-        w!=rel && (WRegion*)w!=mgr; 
-        w=REGION_PARENT(w)){
-        
-        g->x+=REGION_GEOM(w).x;
-        g->y+=REGION_GEOM(w).y;
-    }
-}
-
-
-/*EXTL_DOC
- * Detach \var{reg}, i.e. make it managed by its nearest ancestor
- * \type{WGroup}, framed if \var{reg} is not itself \type{WFrame}.
- */
-EXTL_EXPORT
-bool mod_tiling_detach(WRegion *reg)
-{
-    bool detach_framed=!OBJ_IS(reg, WFrame);
-    WGroupAttachParams ap=GROUPATTACHPARAMS_INIT;
-    WRegionAttachData data;
-    WGroup *grp;
-    
-    grp=find_group(reg, &detach_framed);
-    
-    if(grp==NULL)
-        return FALSE;
-    
-    ap.switchto_set=TRUE;
-    ap.switchto=region_may_control_focus(reg);
-    
-    ap.geom_set=TRUE;
-    get_relative_geom(&ap.geom, reg, (WRegion*)grp);
-    
-    /* TODO: Retain (root-relative) geometry of reg for framed 
-     * detach instead of making a frame of this size?
-     */
-    
-    data.type=REGION_ATTACH_REPARENT;
-    data.u.reg=reg;
-    
-    if(detach_framed){
-        WFramedParam fp=FRAMEDPARAM_INIT;
-        
-        return (region_attach_framed((WRegion*)grp, &fp,
-                                     (WRegionAttachFn*)group_do_attach,
-                                     &ap, &data)!=NULL);
-    }else{
-        return (group_do_attach(grp, &ap, &data)!=NULL);
-    }
-}
-
-
 static WRegion *mkbottom_fn(WWindow *parent, const WFitParams *fp, 
                             void *param)
 {