+/*{{{ Frame recreate pholder stuff */
+
+
+static WFramedPHolder *frame_make_recreate_pholder(WFrame *frame, WPHolder *rph)
+{
+ WFramedParam fparam=FRAMEDPARAM_INIT;
+ WFramedPHolder *fph=NULL;
+
+ if(rph!=NULL){
+ fparam.mode=frame->mode;
+
+ fph=create_framedpholder(rph, &fparam);
+
+ if(fph==NULL)
+ destroy_obj((Obj*)rph);
+ }
+
+ return fph;
+}
+
+
+static void mplex_migrate_phs_to_fph(WMPlex *mplex, WFramedPHolder *fph)
+{
+ WMPlexPHolder *phs, *ph;
+
+ phs=mplex->misc_phs;
+ mplex->misc_phs=NULL;
+
+ phs->recreate_pholder=fph;
+
+ for(ph=phs; ph!=NULL; ph=ph->next)
+ ph->mplex=NULL;
+}
+
+
+
+bool frame_rescue_clientwins(WFrame *frame, WRescueInfo *info)
+{
+ bool ret;
+
+ ret=mplex_rescue_clientwins(&frame->mplex, info);
+
+ /* Now, do placeholders.
+ * We can't currently be arsed to keep them ordered with regions...
+ * First we check if we can simply recreate this frame, which takes
+ * care of e.g. floating frames being destroyed when entering full
+ * screen mode. If not, we check if the target would be a WMPlex, and
+ * migrate there. This takes care of frames destroyed in tilings.
+ */
+ mplex_flatten_phs(&frame->mplex);
+
+ if(frame->mplex.misc_phs!=NULL){
+ WPHolder *ret_ph=region_make_return_pholder((WRegion*)frame);
+ WFramedPHolder *fph=frame_make_recreate_pholder(frame, ret_ph);
+
+ if(fph!=NULL){
+ mplex_migrate_phs_to_fph(&frame->mplex, fph);
+ }else{
+ WPHolder *rescueph=rescueinfo_pholder(info);
+ if(rescueph!=NULL){
+ WRegion *target=pholder_target(rescueph);
+ WMPlex *other_mplex=OBJ_CAST(target, WMPlex);
+
+ if(other_mplex!=NULL){
+ assert(other_mplex!=&frame->mplex);
+ mplex_migrate_phs(&frame->mplex, other_mplex);
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+/*}}}*/
+
+