X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fdetach.c;h=8493b9afbca73dc82922b053aafef49d8d8ad9d6;hp=c93ca0cb2154b28d76c195e3811e8c9d73d37a55;hb=20070318;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/ioncore/detach.c b/ioncore/detach.c index c93ca0c..8493b9a 100644 --- a/ioncore/detach.c +++ b/ioncore/detach.c @@ -14,12 +14,15 @@ #include #include +#include #include #include #include #include #include #include +#include +#include static void get_relative_geom(WRectangle *g, WRegion *reg, WRegion *mgr) @@ -141,7 +144,7 @@ bool ioncore_detach(WRegion *reg, int sp) WGroup *grp; bool set, nset; - reg=region_group_if_bottom(reg); + reg=region_groupleader_of(reg); grp=find_group(check_mplex(reg, &mode)); @@ -192,3 +195,41 @@ bool ioncore_detach_extl(WRegion *reg, const char *how) } +void do_unsqueeze(WRegion *reg) +{ + WSizeHints hints; + + if(REGION_MANAGER_CHK(reg, WScreen)!=NULL) + return; + + region_size_hints(reg, &hints); + + if(!hints.min_set) + return; + + if(hints.min_width<=REGION_GEOM(reg).w && + hints.min_height<=REGION_GEOM(reg).h){ + return; + } + + if(!ioncore_detach(reg, SETPARAM_SET)) + return; + + do_unsqueeze(reg); +} + + +/*EXTL_DOC + * Try to detach \var{reg} if it fits poorly in its + * current location. This function does not do anything, + * unless \var{override} is set or the \var{unsqueeze} option + * of \fnref{ioncore.set} is set. + */ +EXTL_EXPORT +void ioncore_unsqueeze(WRegion *reg, bool override) +{ + if(ioncore_g.unsqueeze_enabled || override) + do_unsqueeze(region_groupleader_of(reg)); +} + +