X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fgroup.c;h=21db4bbb15608d11af2447a495a7ad8a39093895;hb=562cb4d37ba7667ac846fc3d426b152d21ef2c22;hp=e39b20241f3e3b45a4e643a92fcd8c2297944b6c;hpb=3c05dc83d5cac336fe65908542307722c6b98d5a;p=ion3.git diff --git a/ioncore/group.c b/ioncore/group.c index e39b202..21db4bb 100644 --- a/ioncore/group.c +++ b/ioncore/group.c @@ -1,7 +1,7 @@ /* * ion/ioncore/group.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2008. * * See the included file LICENSE for details. */ @@ -356,6 +356,7 @@ bool group_init(WGroup *ws, WWindow *par, const WFitParams *fp) ws->managed_stdisp=NULL; ws->bottom=NULL; ws->managed_list=NULL; + ws->phs=NULL; ws->dummywin=XCreateWindow(ioncore_g.dpy, par->win, fp->g.x, fp->g.y, 1, 1, 0, @@ -406,12 +407,14 @@ void group_deinit(WGroup *ws) XDeleteContext(ioncore_g.dpy, ws->dummywin, ioncore_g.win_context); XDestroyWindow(ioncore_g.dpy, ws->dummywin); ws->dummywin=None; - + + while(ws->phs!=NULL) + grouppholder_do_unlink(ws->phs); + region_deinit(&ws->reg); } - bool group_rescue_clientwins(WGroup *ws, WRescueInfo *info) { WGroupIterTmp tmp; @@ -424,6 +427,39 @@ bool group_rescue_clientwins(WGroup *ws, WRescueInfo *info) } +WPHolder *group_get_rescue_pholder_for(WGroup *ws, + WRegion *forwhat) +{ + WGroupAttachParams ap=GROUPATTACHPARAMS_INIT; + WFramedParam fp=FRAMEDPARAM_INIT; + WPHolder *ph; + + ap.geom_set=TRUE; + ap.geom=REGION_GEOM(forwhat); + + ap.geom_weak_set=1; + + if(REGION_PARENT(forwhat)==REGION_PARENT(ws)){ + ap.geom.x-=REGION_GEOM(ws).x; + ap.geom.y-=REGION_GEOM(ws).y; + }else{ + ap.geom_weak=REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_Y; + } + + /* frame mode */ + /*{ + WFrame *frame=OBJ_CAST(forwhat, WFrame); + if(frame!=NULL) + fp.mode=frame->mode; + }*/ + + ph=(WPHolder*)create_grouppholder(ws, NULL, &ap); + + return pholder_either((WPHolder*)create_framedpholder(ph, &fp), ph); +} + + + /*}}}*/ @@ -531,8 +567,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_TILED || m==FRAME_MODE_TILED_ALT) + if(framemode_unalt(frame_mode(frame))==FRAME_MODE_TILED) frame_set_mode(frame, FRAME_MODE_FLOATING); } @@ -662,18 +697,32 @@ bool group_do_attach_final(WGroup *ws, region_set_focus(st->reg); else ws->current_managed=st; + }else if(region_is_fully_mapped(reg)){ + region_pointer_focus_hack(reg); } - + return TRUE; } +static void group_attach_fp(WGroup *ws, const WGroupAttachParams *param, + WFitParams *fp) +{ + if(param->geom_set){ + geom_group_to_parent(ws, ¶m->geom, &fp->g); + fp->mode=REGION_FIT_EXACT; + }else{ + fp->g=REGION_GEOM(ws); + fp->mode=REGION_FIT_BOUNDS|REGION_FIT_WHATEVER; + } +} + + WRegion *group_do_attach(WGroup *ws, /*const*/ WGroupAttachParams *param, WRegionAttachData *data) { WFitParams fp; - WWindow *par; WRegion *reg; if(ws->bottom!=NULL && param->bottom){ @@ -681,18 +730,9 @@ WRegion *group_do_attach(WGroup *ws, return NULL; } - par=REGION_PARENT(ws); - assert(par!=NULL); - - if(param->geom_set){ - geom_group_to_parent(ws, ¶m->geom, &fp.g); - fp.mode=REGION_FIT_EXACT; - }else{ - fp.g=REGION_GEOM(ws); - fp.mode=REGION_FIT_BOUNDS|REGION_FIT_WHATEVER; - } + group_attach_fp(ws, param, &fp); - return region_attach_helper((WRegion*) ws, par, &fp, + return region_attach_helper((WRegion*) ws, REGION_PARENT(ws), &fp, (WRegionDoAttachFn*)group_do_attach_final, /*(const WRegionAttachParams*)*/param, data); /* ^^^^ doesn't seem to work. */ @@ -897,6 +937,8 @@ void group_manage_stdisp(WGroup *ws, WRegion *stdisp, stdisp->flags|=REGION_SKIP_FOCUS; fp.g=REGION_GEOM(ws); + fp.mode=0; + sizepolicy(&ws->managed_stdisp->szplcy, stdisp, NULL, 0, &fp); region_fitrep(stdisp, NULL, &fp); @@ -935,6 +977,7 @@ void group_managed_rqgeom(WGroup *ws, WRegion *reg, fp.mode=REGION_FIT_EXACT; }else{ fp.g=REGION_GEOM(ws); + fp.mode=0; sizepolicy(&st->szplcy, reg, &rq->geom, rq->flags, &fp); } @@ -1171,7 +1214,8 @@ bool group_managed_rqorder(WGroup *grp, WRegion *reg, WRegionOrder order) /*EXTL_DOC * 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 + * The function is called in protected mode. + * This routine returns \code{true} if it reaches the end of list * without this happening. */ EXTL_SAFE @@ -1291,7 +1335,7 @@ static ExtlTab group_get_configuration(WGroup *ws) return tab; } - + void group_do_load(WGroup *ws, ExtlTab tab) { ExtlTab substab, subtab; @@ -1301,7 +1345,23 @@ void group_do_load(WGroup *ws, ExtlTab tab) n=extl_table_get_n(substab); for(i=1; i<=n; i++){ if(extl_table_geti_t(substab, i, &subtab)){ - group_attach_new(ws, subtab); + WGroupAttachParams par=GROUPATTACHPARAMS_INIT; + WRegionAttachData data; + WFitParams fp; + WPHolder *ph; + + group_get_attach_params(ws, subtab, &par); + group_attach_fp(ws, &par, &fp); + + ph=(WPHolder*)create_grouppholder(ws, NULL, &par); + + region_attach_load_helper((WRegion*)ws, REGION_PARENT(ws), &fp, + (WRegionDoAttachFn*)group_do_attach_final, + (void*)&par, subtab, &ph); + + if(ph!=NULL) + destroy_obj((Obj*)ph); + extl_unref_table(subtab); } } @@ -1395,6 +1455,9 @@ static DynFunTab group_dynfuntab[]={ {(DynFun*)region_managed_rqorder, (DynFun*)group_managed_rqorder}, + + {(DynFun*)region_get_rescue_pholder_for, + (DynFun*)group_get_rescue_pholder_for}, END_DYNFUNTAB };