]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/manage.c
Add 20081002-1.
[ion3.git] / ioncore / manage.c
index 69b7711f9f7311e060d0a8c4cd53ece76af9193a..5b036053c52218218b5f9dd50deb2f81133b0e5d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/ioncore/manage.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2007
+ * Copyright (c) Tuomo Valkonen 1999-2008
  *
  * See the included file LICENSE for details.
  */
@@ -72,6 +72,9 @@ static WPHolder *try_target(WClientWin *cwin, const WManageParams *param,
     if(r==NULL)
         return NULL;
     
+    if(!region_same_rootwin(r, (WRegion*)cwin))
+        return NULL;
+    
     return region_prepare_manage(r, cwin, param, MANAGE_PRIORITY_NONE);
 }
 
@@ -339,6 +342,23 @@ bool region_rescue_child_clientwins(WRegion *reg, WRescueInfo *info)
 }
 
 
+WPHolder *rescueinfo_pholder(WRescueInfo *info)
+{
+    if(info->test)
+        return NULL;
+        
+    if(info->ph==NULL){
+        info->ph=region_get_rescue_pholder(info->get_rescue);
+        if(info->ph==NULL){
+            info->failed_get=TRUE;
+            return NULL;
+        }
+    }
+    
+    return info->ph;
+}
+
+
 /* Bah, unsplitissä oikestaan pitäisi tehä non-deep rescue */
 
 bool region_do_rescue_this(WRegion *tosave_, WRescueInfo *info, int ph_flags)
@@ -359,19 +379,13 @@ bool region_do_rescue_this(WRegion *tosave_, WRescueInfo *info, int ph_flags)
     
     if(tosave==NULL){
         return region_rescue_clientwins(tosave_, info);
-    }else if(info->test){
-        return FALSE;
     }else{
         int phf=(info->flags&REGION_RESCUE_PHFLAGS_OK ? ph_flags : 0);
+        WPHolder *ph=rescueinfo_pholder(info);
         
-        if(info->ph==NULL){
-            info->ph=region_get_rescue_pholder(info->get_rescue);
-            if(info->ph==NULL){
-                info->failed_get=TRUE;
-                return FALSE;
-            }
-        }
-        return pholder_attach(info->ph, phf, tosave);
+        return (ph==NULL
+                ? FALSE
+                : pholder_attach(info->ph, phf, tosave));
     }
 }