/*
* 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
#include "grouppholder.h"
#include "frame.h"
#include "float-placement.h"
+#include "return.h"
static void group_place_stdisp(WGroup *ws, WWindow *parent,
}
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'
}
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);
+ }
}
* 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);
}
WFitParams fp;
WWindow *par;
WRegion *reg;
-
+
if(ws->bottom!=NULL && param->bottom){
warn(TR("'bottom' already set."));
return NULL;
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);
}
if(sti_ok && focusable(ws, sti, min_level))
- return st;
+ return sti;
return NULL;
}
WStacking *group_find_stacking(WGroup *ws, WRegion *r)
{
- WStacking *st;
-
if(r==NULL || REGION_MANAGER(r)!=(WRegion*)ws)
return NULL;
/*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);
}
}
+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;
+}
+
+
/*}}}*/
{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},