2 * ion/ioncore/pholder.c
4 * Copyright (c) Tuomo Valkonen 2005-2009.
6 * See the included file LICENSE for details.
9 #include <libtu/objp.h>
16 bool pholder_init(WPHolder
*ph
)
22 void pholder_deinit(WPHolder
*ph
)
27 WRegion
*pholder_do_attach(WPHolder
*ph
, int flags
,
28 WRegionAttachData
*data
)
32 CALL_DYN_RET(ret
, WRegion
*, pholder_do_attach
, ph
, (ph
, flags
, data
));
37 bool pholder_attach(WPHolder
*ph
, int flags
, WRegion
*reg
)
39 WRegionAttachData data
;
41 data
.type
=REGION_ATTACH_REPARENT
;
44 return (pholder_do_attach(ph
, flags
, &data
)!=NULL
);
48 bool pholder_attach_mcfgoto(WPHolder
*ph
, int flags
, WRegion
*reg
)
50 bool cf
=region_may_control_focus(reg
);
52 if(!pholder_attach(ph
, flags
, reg
))
62 WRegion
*pholder_do_target(WPHolder
*ph
)
65 CALL_DYN_RET(ret
, WRegion
*, pholder_do_target
, ph
, (ph
));
70 WRegion
*pholder_target(WPHolder
*ph
)
72 return pholder_do_target(ph
);
76 static bool pholder_do_check_reparent_default(WPHolder
*ph
, WRegion
*reg
)
78 WRegion
*target
=pholder_do_target(ph
);
82 : region_ancestor_check(target
, reg
));
86 DYNFUN
bool pholder_do_check_reparent(WPHolder
*ph
, WRegion
*reg
)
89 CALL_DYN_RET(ret
, bool, pholder_do_check_reparent
, ph
, (ph
, reg
));
94 bool pholder_check_reparent(WPHolder
*ph
, WRegion
*reg
)
96 return pholder_do_check_reparent(ph
, reg
);
100 bool pholder_do_goto(WPHolder
*ph
)
103 CALL_DYN_RET(ret
, bool, pholder_do_goto
, ph
, (ph
));
108 bool pholder_goto(WPHolder
*ph
)
110 return pholder_do_goto(ph
);
114 bool pholder_stale_default(WPHolder
*ph
)
116 return (pholder_target(ph
)==NULL
);
120 bool pholder_stale(WPHolder
*ph
)
123 CALL_DYN_RET(ret
, bool, pholder_stale
, ph
, (ph
));
128 WPHolder
*region_managed_get_pholder(WRegion
*reg
, WRegion
*mgd
)
131 CALL_DYN_RET(ret
, WPHolder
*, region_managed_get_pholder
,
137 WPHolder
*region_get_rescue_pholder_for(WRegion
*reg
, WRegion
*mgd
)
139 if(OBJ_IS_BEING_DESTROYED(reg
) || reg
->flags
®ION_CWINS_BEING_RESCUED
){
144 CALL_DYN_RET(ret
, WPHolder
*, region_get_rescue_pholder_for
,
151 WPHolder
*region_get_rescue_pholder(WRegion
*reg
)
157 mgr
=region_manager_or_parent(reg
);
160 ph
=region_get_rescue_pholder_for(mgr
, reg
);
170 WPHolder
*pholder_either(WPHolder
*a
, WPHolder
*b
)
172 return (a
!=NULL
? a
: b
);
176 static DynFunTab pholder_dynfuntab
[]={
177 {(DynFun
*)pholder_do_check_reparent
,
178 (DynFun
*)pholder_do_check_reparent_default
},
180 {(DynFun
*)pholder_stale
,
181 (DynFun
*)pholder_stale_default
},
187 IMPLCLASS(WPHolder
, Obj
, pholder_deinit
, pholder_dynfuntab
);