X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fgroup.c;h=ffe6c8623da7d3a971cab798123ae27ee769e55d;hb=799a98b5f970cc5b09cd572f293b6ab7ac6854fc;hp=9c67348fe2a26442a696def5b14523ec2c55bfd7;hpb=ae4260bb64817c11f9a7140324cd3e3ba113e297;p=ion3.git diff --git a/ioncore/group.c b/ioncore/group.c index 9c67348..ffe6c86 100644 --- a/ioncore/group.c +++ b/ioncore/group.c @@ -45,6 +45,8 @@ static void group_place_stdisp(WGroup *ws, WWindow *parent, static void group_remanage_stdisp(WGroup *ws); +static void group_do_set_bottom(WGroup *grp, WStacking *st); + /*{{{ Stacking list stuff */ @@ -311,51 +313,40 @@ void group_managed_remove(WGroup *ws, WRegion *reg) st=group_find_stacking(ws, reg); if(st!=NULL){ - next_st=stacking_unstack(REGION_PARENT(ws), st); - - UNLINK_ITEM(ws->managed_list, st, mgr_next, mgr_prev); + if(st==ws->bottom){ + was_bottom=TRUE; + group_do_set_bottom(ws, NULL); + } if(st==ws->managed_stdisp){ ws->managed_stdisp=NULL; was_stdisp=TRUE; } - - if(st==ws->bottom){ - ws->bottom=NULL; - was_bottom=TRUE; - } if(st==ws->current_managed){ ws->current_managed=NULL; was_current=TRUE; } + next_st=stacking_unstack(REGION_PARENT(ws), st); + UNLINK_ITEM(ws->managed_list, st, mgr_next, mgr_prev); stacking_unassoc(st); stacking_free(st); } region_unset_manager(reg, (WRegion*)ws); - if(!OBJ_IS_BEING_DESTROYED(ws)){ - if(was_bottom && !was_stdisp && ws->managed_stdisp==NULL){ - /* We should probably be managing any stdisp, that 'bottom' - * was managing. - */ - group_remanage_stdisp(ws); - } - - if(was_current){ - /* This may still potentially cause problems when focus - * change is pending. Perhaps we should use region_await_focus, - * if it is pointing to our child (and region_may_control_focus - * fail if it is pointing somewhere else). - */ - WStacking *stf=find_to_focus(ws, next_st, TRUE); - if(stf!=NULL && mcf){ - region_maybewarp_now(stf->reg, FALSE); - }else{ - ws->current_managed=stf; - } + if(!OBJ_IS_BEING_DESTROYED(ws) && was_current){ + /* This may still potentially cause problems when focus + * change is pending. Perhaps we should use region_await_focus, + * if it is pointing to our child (and region_may_control_focus + * fail if it is pointing somewhere else). + */ + WStacking *stf=find_to_focus(ws, next_st, TRUE); + if(stf!=NULL && mcf){ + region_maybewarp_now(stf->reg, FALSE); + }else{ + ws->current_managed=stf; } } } @@ -481,16 +472,31 @@ static WRegion *group_managed_disposeroot(WGroup *ws, WRegion *reg) /*{{{ Bottom */ +void group_bottom_set(WGroup *grp) +{ + CALL_DYN(group_bottom_set, grp, (grp)); +} + + static void group_do_set_bottom(WGroup *grp, WStacking *st) { WStacking *was=grp->bottom; + WStacking *std=grp->managed_stdisp; grp->bottom=st; - if(st!=was){ - if(st==NULL || HAS_DYN(st->reg, region_manage_stdisp)) + if(!OBJ_IS_BEING_DESTROYED(grp)){ + bool noremanage=((was==st) || + (was==NULL && std==NULL) || + (st!=NULL && st==std) || + (st==NULL && was==std)); + + if(!noremanage && + (st==NULL || HAS_DYN(st->reg, region_manage_stdisp))){ group_remanage_stdisp(grp); + } + group_bottom_set(grp); } } @@ -825,6 +831,8 @@ WRegion *group_attach(WGroup *ws, WRegion *reg, ExtlTab param) * \var{level} & (integer) Stacking level; default is 1. \\ * \var{modal} & (boolean) Make object modal; ignored if level is set. \\ * \var{sizepolicy} & (string) Size policy; see Section \ref{sec:sizepolicies}. \\ + * \var{bottom} & (boolean) Mark the attached region as the + * ``bottom'' of \var{ws}. \\ * \end{tabularx} * * In addition parameters to the region to be created are passed in this @@ -910,7 +918,9 @@ void group_manage_stdisp(WGroup *ws, WRegion *stdisp, STACKING_LEVEL_ON_TOP, szplcy); } - + + stdisp->flags|=REGION_SKIP_FOCUS; + fp.g=REGION_GEOM(ws); sizepolicy(&ws->managed_stdisp->szplcy, stdisp, NULL, 0, &fp);