X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fgroup.c;h=7d51715e9ee88e1165d4a1ad8162ad61db6bb0d3;hb=20070708;hp=61a32358b73031ff4fe40c1d8bbbd8e51e159556;hpb=de22e45179cb3bafa490294d31d47f361047a30a;p=ion3.git diff --git a/ioncore/group.c b/ioncore/group.c index 61a3235..7d51715 100644 --- a/ioncore/group.c +++ b/ioncore/group.c @@ -3,10 +3,7 @@ * * Copyright (c) Tuomo Valkonen 1999-2007. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -48,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 */ @@ -314,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; } } } @@ -484,22 +472,37 @@ 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); } } /*EXTL_DOC - * Sets the 'bottom' of \var{ws}. The region \var{reg} must already + * Sets the `bottom' of \var{ws}. The region \var{reg} must already * be managed by \var{ws}, unless \code{nil}. */ EXTL_EXPORT_MEMBER @@ -521,7 +524,7 @@ bool group_set_bottom(WGroup *ws, WRegion *reg) /*EXTL_DOC - * Returns the 'bottom' of \var{ws}. + * Returns the `bottom' of \var{ws}. */ EXTL_SAFE EXTL_EXPORT_MEMBER @@ -571,7 +574,7 @@ WStacking *group_do_add_managed_default(WGroup *ws, WRegion *reg, int level, frame=OBJ_CAST(reg, WFrame); if(frame!=NULL){ WFrameMode m=frame_mode(frame); - if(m!=FRAME_MODE_FLOATING && m!=FRAME_MODE_TRANSIENT) + if(m==FRAME_MODE_TILED || m==FRAME_MODE_TILED_ALT) frame_set_mode(frame, FRAME_MODE_FLOATING); } @@ -742,6 +745,12 @@ static void get_params(WGroup *ws, ExtlTab tab, WGroupAttachParams *par) par->geom_set=0; par->bottom=0; + if(extl_table_is_bool_set(tab, "bottom")){ + par->level=STACKING_LEVEL_BOTTOM; + par->level_set=1; + par->bottom=1; + } + if(extl_table_gets_i(tab, "level", &tmp)){ if(tmp>=0){ par->level_set=STACKING_LEVEL_NORMAL; @@ -749,12 +758,6 @@ static void get_params(WGroup *ws, ExtlTab tab, WGroupAttachParams *par) } } - if(extl_table_is_bool_set(tab, "bottom")){ - par->level=STACKING_LEVEL_BOTTOM; - par->level_set=1; - par->bottom=1; - } - if(!par->level_set && extl_table_is_bool_set(tab, "modal")){ par->level=STACKING_LEVEL_MODAL1; par->level_set=1; @@ -822,12 +825,14 @@ WRegion *group_attach(WGroup *ws, WRegion *reg, ExtlTab param) * * \begin{tabularx}{\linewidth}{lX} * \tabhead{Field & Description} - * \var{type} & Class name (a string) of the object to be created. Mandatory. \\ - * \var{name} & Name of the object to be created (a string). Optional. \\ - * \var{switchto} & Should the region be switched to (boolean)? Optional. \\ - * \var{level} & Stacking level; default is 1. \\ - * \var{modal} & Make object modal; ignored if level is set. \\ - * \var{sizepolicy} & Size policy. \\ + * \var{type} & (string) Class of the object to be created. Mandatory. \\ + * \var{name} & (string) Name of the object to be created. \\ + * \var{switchto} & (boolean) Should the region be switched to? \\ + * \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 @@ -1006,12 +1011,6 @@ static WStacking *prv(WGroup *ws, WStacking *st, bool wrap) typedef WStacking *NxtFn(WGroup *ws, WStacking *st, bool wrap); -static bool mapped_filt(WStacking *st, void *unused) -{ - return (st->reg!=NULL && REGION_IS_MAPPED(st->reg)); -} - - static bool focusable(WGroup *ws, WStacking *st, uint min_level) { return (st->reg!=NULL @@ -1030,7 +1029,7 @@ static WStacking *do_get_next(WGroup *ws, WStacking *sti, stacking=group_get_stacking(ws); if(stacking!=NULL) - min_level=stacking_min_level(stacking, mapped_filt, NULL); + min_level=stacking_min_level_mapped(stacking); st=sti; while(1){ @@ -1290,7 +1289,8 @@ static ExtlTab group_get_configuration(WGroup *ws) subtab=region_get_configuration(st->reg); if(subtab!=extl_table_none()){ - extl_table_sets_i(subtab, "sizepolicy", st->szplcy); + extl_table_sets_s(subtab, "sizepolicy", + sizepolicy2string(st->szplcy)); extl_table_sets_i(subtab, "level", st->level); tmpg=REGION_GEOM(st->reg);