X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fgroup.c;h=538db141f11d9abe6c3b7fd6e785fa9faa659679;hp=591fcd757dd4f1a609f658a12de71d597f527f5c;hb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;hpb=8366314611bf30a0f31d25bf5f5023186fa87692 diff --git a/ioncore/group.c b/ioncore/group.c index 591fcd7..538db14 100644 --- a/ioncore/group.c +++ b/ioncore/group.c @@ -1,7 +1,7 @@ /* * ion/ioncore/group.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * 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 @@ -40,6 +40,7 @@ #include "grouppholder.h" #include "frame.h" #include "float-placement.h" +#include "return.h" static void group_place_stdisp(WGroup *ws, WWindow *parent, @@ -352,7 +353,7 @@ void group_managed_remove(WGroup *ws, WRegion *reg) } region_unset_manager(reg, (WRegion*)ws); - + if(!dest && !ds){ if(was_bottom && !was_stdisp && ws->managed_stdisp==NULL){ /* We should probably be managing any stdisp, that 'bottom' @@ -368,19 +369,30 @@ void group_managed_remove(WGroup *ws, WRegion *reg) } if(cur){ + /* 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) - region_warp(stf->reg); + if(stf!=NULL && mcf){ + region_maybewarp_now(stf->reg, FALSE); + }else{ + ws->current_managed=stf; + } } }else if(dest && !ds){ - mainloop_defer_destroy((Obj*)ws); + region_dispose((WRegion*)ws, mcf); } } -static void group_managed_activated(WGroup *ws, WRegion *reg) +static void group_managed_notify(WGroup *ws, WRegion *reg, WRegionNotify how) { - ws->current_managed=group_find_stacking(ws, reg); + if(how==ioncore_g.notifies.activated || + how==ioncore_g.notifies.pseudoactivated){ + ws->current_managed=group_find_stacking(ws, reg); + } } @@ -584,17 +596,20 @@ bool group_do_attach_final(WGroup *ws, * position request is never honoured. */ if((g.x+g.w<=REGION_GEOM(ws).x) || - (g.y+g.h<=REGION_GEOM(ws).y) || - (g.x>=REGION_GEOM(ws).x+REGION_GEOM(ws).w) || + (g.x>=REGION_GEOM(ws).x+REGION_GEOM(ws).w)){ + weak|=REGION_RQGEOM_WEAK_X; + } + + if((g.y+g.h<=REGION_GEOM(ws).y) || (g.y>=REGION_GEOM(ws).y+REGION_GEOM(ws).h)){ - weak|=REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_X; + weak|=REGION_RQGEOM_WEAK_Y; } - if((weak&(REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_Y)) - ==(REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_Y) && + if(weak&(REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_Y) && (szplcy==SIZEPOLICY_UNCONSTRAINED || szplcy==SIZEPOLICY_FREE || szplcy==SIZEPOLICY_FREE_GLUE /* without flags */)){ + /* TODO: use 'weak'? */ group_calc_placement(ws, &g); } @@ -665,7 +680,7 @@ WRegion *group_do_attach(WGroup *ws, WFitParams fp; WWindow *par; WRegion *reg; - + if(ws->bottom!=NULL && param->bottom){ warn(TR("'bottom' already set.")); return NULL; @@ -681,7 +696,7 @@ WRegion *group_do_attach(WGroup *ws, fp.g=REGION_GEOM(ws); fp.mode=REGION_FIT_BOUNDS|REGION_FIT_WHATEVER; } - + return region_attach_helper((WRegion*) ws, par, &fp, (WRegionDoAttachFn*)group_do_attach_final, /*(const WRegionAttachParams*)*/param, data); @@ -985,7 +1000,7 @@ static WStacking *do_get_next(WGroup *ws, WStacking *sti, } if(sti_ok && focusable(ws, sti, min_level)) - return st; + return sti; return NULL; } @@ -1082,8 +1097,6 @@ void group_restack(WGroup *ws, Window other, int mode) WStacking *group_find_stacking(WGroup *ws, WRegion *r) { - WStacking *st; - if(r==NULL || REGION_MANAGER(r)!=(WRegion*)ws) return NULL; @@ -1146,16 +1159,19 @@ WRegion *group_bottom(WGroup *ws) /*EXTL_DOC - * Returns a list of regions managed by the workspace (frames, mostly). + * Iterate over managed regions of \var{ws} until \var{iterfn} returns + * \code{false}. + * The function itself returns \code{true} if it reaches the end of list + * without this happening. */ EXTL_SAFE EXTL_EXPORT_MEMBER -ExtlTab group_managed_list(WGroup *ws) +bool group_managed_i(WGroup *ws, ExtlFn iterfn) { WGroupIterTmp tmp; group_iter_init(&tmp, ws); - return extl_obj_iterable_to_table((ObjIterator*)group_iter, &tmp); + return extl_iter_objlist_(iterfn, (ObjIterator*)group_iter, &tmp); } @@ -1182,6 +1198,17 @@ Window group_xwindow(const WGroup *ws) } +WRegion *region_group_if_bottom(WRegion *reg) +{ + WGroup *grp=REGION_MANAGER_CHK(reg, WGroup); + + if(grp!=NULL && group_bottom(grp)==reg) + return (WRegion*)grp; + else + return reg; +} + + /*}}}*/ @@ -1295,8 +1322,8 @@ static DynFunTab group_dynfuntab[]={ {region_do_set_focus, group_do_set_focus}, - {region_managed_activated, - group_managed_activated}, + {region_managed_notify, + group_managed_notify}, {region_managed_remove, group_managed_remove},