X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fgroup-cw.c;h=d5b7396efbe476d2dc1c2f2f95f677a0e766598d;hp=6bb9c2f9ea32073689436fc1e0a8fd08c39b794b;hb=f869221ce49f0fb7cca48eee28daff8684305963;hpb=720e6978185b09f2b2f60a6b96018238085a7238 diff --git a/ioncore/group-cw.c b/ioncore/group-cw.c index 6bb9c2f..d5b7396 100644 --- a/ioncore/group-cw.c +++ b/ioncore/group-cw.c @@ -22,6 +22,8 @@ #include "names.h" #include "framedpholder.h" #include "grouppholder.h" +#include "return.h" +#include "saveload.h" #define DFLT_SZPLCY SIZEPOLICY_FREE_GLUE__SOUTH @@ -209,6 +211,46 @@ void groupcw_bottom_set(WGroupCW *cwg) /*}}}*/ +/*{{{ Rescue */ + + +static void group_migrate_phs_to_ph(WGroup *group, WPHolder *rph) +{ + WGroupPHolder *phs, *ph; + + phs=group->phs; + group->phs=NULL; + + phs->recreate_pholder=rph; + + for(ph=phs; ph!=NULL; ph=ph->next) + ph->group=NULL; +} + + +bool groupcw_rescue_clientwins(WGroupCW *cwg, WRescueInfo *info) +{ + bool ret=group_rescue_clientwins(&cwg->grp, info); + + /* If this group can be recreated, arrange remaining placeholders + * to do so. This takes care of e.g. recreating client window groups + * when recreating layout delayedly under a session manager. + */ + if(cwg->grp.phs!=NULL){ + WPHolder *rph=region_make_return_pholder((WRegion*)cwg); + + if(rph!=NULL) + group_migrate_phs_to_ph(&cwg->grp, rph); + } + + return ret; +} + + +/*}}}*/ + + + /*{{{ WGroupCW class */ @@ -239,34 +281,29 @@ void groupcw_deinit(WGroupCW *cwg) WRegion *groupcw_load(WWindow *par, const WFitParams *fp, ExtlTab tab) { - WGroupCW *ws; + WGroupCW *cwg; ExtlTab substab, subtab; int i, n; - ws=create_groupcw(par, fp); + cwg=create_groupcw(par, fp); - if(ws==NULL) + if(cwg==NULL) return NULL; - - if(!extl_table_gets_t(tab, "managed", &substab)) - return (WRegion*)ws; - - n=extl_table_get_n(substab); - for(i=1; i<=n; i++){ - if(extl_table_geti_t(substab, i, &subtab)){ - group_attach_new(&ws->grp, subtab); - extl_unref_table(subtab); - } - } - - extl_unref_table(substab); + + group_do_load(&cwg->grp, tab); - if(ws->grp.managed_list==NULL){ - destroy_obj((Obj*)ws); + if(cwg->grp.managed_list==NULL){ + if(cwg->grp.phs!=NULL){ + /* Session management hack */ + WPHolder *ph=ioncore_get_load_pholder(); + if(ph!=NULL) + group_migrate_phs_to_ph(&cwg->grp, ph); + } + destroy_obj((Obj*)cwg); return NULL; } - return (WRegion*)ws; + return (WRegion*)cwg; } @@ -307,6 +344,9 @@ static DynFunTab groupcw_dynfuntab[]={ {group_bottom_set, groupcw_bottom_set}, + + {(DynFun*)region_rescue_clientwins, + (DynFun*)groupcw_rescue_clientwins}, END_DYNFUNTAB };