X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fframedpholder.c;h=a2cd2c55fba55dfcaed7c090ff942c6f6b9343e9;hb=f869221ce49f0fb7cca48eee28daff8684305963;hp=de437a23c6921ae10cbd132f93697f7f0691ffc4;hpb=ae4260bb64817c11f9a7140324cd3e3ba113e297;p=ion3.git diff --git a/ioncore/framedpholder.c b/ioncore/framedpholder.c index de437a2..a2cd2c5 100644 --- a/ioncore/framedpholder.c +++ b/ioncore/framedpholder.c @@ -28,6 +28,8 @@ bool framedpholder_init(WFramedPHolder *ph, WPHolder *cont, ph->cont=cont; ph->param=*param; + watch_init(&ph->frame_watch); + return TRUE; } @@ -47,6 +49,7 @@ void framedpholder_deinit(WFramedPHolder *ph) } pholder_deinit(&(ph->ph)); + watch_reset(&ph->frame_watch); } @@ -59,6 +62,7 @@ void framedpholder_deinit(WFramedPHolder *ph) typedef struct{ WRegionAttachData *data; WFramedParam *param; + WRegion *reg_ret; } AP; @@ -119,6 +123,8 @@ WRegion *framed_handler(WWindow *par, reg=mplex_do_attach(&frame->mplex, &mp, ap->data); + ap->reg_ret=reg; + if(reg==NULL){ destroy_obj((Obj*)frame); return NULL; @@ -143,6 +149,7 @@ WRegion *region_attach_framed(WRegion *reg, WFramedParam *param, ap.data=data; ap.param=param; + ap.reg_ret=NULL; return fn(reg, fn_param, &data2); } @@ -152,8 +159,16 @@ WRegion *framedpholder_do_attach(WFramedPHolder *ph, int flags, WRegionAttachData *data) { WRegionAttachData data2; + WFrame *frame; AP ap; + frame=(WFrame*)ph->frame_watch.obj; + + if(frame!=NULL){ + WMPlexAttachParams mp=MPLEXATTACHPARAMS_INIT; + return mplex_do_attach(&frame->mplex, &mp, data); + } + if(ph->cont==NULL) return FALSE; @@ -163,8 +178,16 @@ WRegion *framedpholder_do_attach(WFramedPHolder *ph, int flags, ap.data=data; ap.param=&ph->param; + ap.reg_ret=NULL; - return pholder_do_attach(ph->cont, flags, &data2); + frame=(WFrame*)pholder_do_attach(ph->cont, flags, &data2); + + if(frame!=NULL){ + assert(OBJ_IS(frame, WFrame)); + watch_setup(&ph->frame_watch, (Obj*)frame, NULL); + } + + return ap.reg_ret; } @@ -176,32 +199,34 @@ WRegion *framedpholder_do_attach(WFramedPHolder *ph, int flags, bool framedpholder_do_goto(WFramedPHolder *ph) { - return (ph->cont!=NULL - ? pholder_goto(ph->cont) - : FALSE); + WRegion *frame=(WRegion*)ph->frame_watch.obj; + + if(frame!=NULL) + return region_goto((WRegion*)frame); + else if(ph->cont!=NULL) + return pholder_goto(ph->cont); + else + return FALSE; } WRegion *framedpholder_do_target(WFramedPHolder *ph) { - return (ph->cont!=NULL - ? pholder_target(ph->cont) - : NULL); + WRegion *frame=(WRegion*)ph->frame_watch.obj; + + return (frame!=NULL + ? frame + : (ph->cont!=NULL + ? pholder_target(ph->cont) + : NULL)); } -WPHolder *framedpholder_do_root(WFramedPHolder *ph) +bool framedpholder_stale(WFramedPHolder *ph) { - WPHolder *root; - - if(ph->cont==NULL) - return NULL; - - root=pholder_root(ph->cont); + WRegion *frame=(WRegion*)ph->frame_watch.obj; - return (root!=ph->cont - ? root - : &ph->ph); + return (frame==NULL && (ph->cont==NULL || pholder_stale(ph->cont))); } @@ -221,8 +246,8 @@ static DynFunTab framedpholder_dynfuntab[]={ {(DynFun*)pholder_do_target, (DynFun*)framedpholder_do_target}, - {(DynFun*)pholder_do_root, - (DynFun*)framedpholder_do_root}, + {(DynFun*)pholder_stale, + (DynFun*)framedpholder_stale}, END_DYNFUNTAB };