/*
* ion/ioncore/manage.c
*
- * Copyright (c) Tuomo Valkonen 1999-2007.
+ * Copyright (c) Tuomo Valkonen 1999-2009.
*
* See the included file LICENSE for details.
*/
if(r==NULL)
return NULL;
+ if(!region_same_rootwin(r, (WRegion*)cwin))
+ return NULL;
+
return region_prepare_manage(r, cwin, param, MANAGE_PRIORITY_NONE);
}
WPHolder *ph=NULL;
int swf=(param->switchto ? PHOLDER_ATTACH_SWITCHTO : 0);
bool ok, uq=FALSE;
+ WRegion *createroot=NULL;
/* Find a suitable screen */
scr=clientwin_find_suitable_screen(cwin, param);
return FALSE;
/* Not in full-screen mode; use the placeholder to attach. */
-
- ok=pholder_attach(ph, swf, (WRegion*)cwin);
-
+ {
+ WRegionAttachData data;
+ data.type=REGION_ATTACH_REPARENT;
+ data.u.reg=(WRegion*)cwin;
+
+ createroot=pholder_do_attach(ph,
+ swf|PHOLDER_ATTACH_RETURN_CREATEROOT,
+ &data);
+ }
+
destroy_obj((Obj*)ph);
- if(uq && ok)
- ioncore_unsqueeze((WRegion*)cwin, FALSE);
+ if(uq && createroot!=NULL)
+ ioncore_unsqueeze(createroot, FALSE);
- return ok;
+ return (createroot!=NULL);
}
}
+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)
if(tosave==NULL){
return region_rescue_clientwins(tosave_, info);
- }else if(info->test){
- return FALSE;
}else{
int phf=(info->flags®ION_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));
}
}