/*
* ion/ioncore/detach.c
*
- * Copyright (c) Tuomo Valkonen 1999-2007.
+ * Copyright (c) Tuomo Valkonen 1999-2008.
*
* See the included file LICENSE for details.
*/
+#include <string.h>
+
#include <libtu/objp.h>
#include <libtu/setparam.h>
#include <libtu/minmax.h>
}
if(framemode!=FRAME_MODE_UNKNOWN){
+ /* TODO: remove/obsolete this special case */
WFramedParam fpa=FRAMEDPARAM_INIT;
fpa.mode=framemode;
}else{
WStacking *st=ioncore_find_stacking(reg);
+ ap.level_set=TRUE;
+ ap.level=framelevel+1;
+
if(st!=NULL){
ap.szplcy=st->szplcy;
ap.szplcy_set=TRUE;
- ap.level_set=TRUE;
- ap.level=maxof(st->level, STACKING_LEVEL_NORMAL);
+ /* Hack for modal detached queries, while transients become
+ * non-modal detached.
+ */
+ if(st->level>STACKING_LEVEL_MODAL1)
+ ap.level=st->level;
}
ap.geom_set=TRUE;
*mode=FRAME_MODE_FLOATING;
- if(OBJ_IS(mplex, WFrame)
- && frame_mode((WFrame*)mplex)==FRAME_MODE_TRANSIENT){
- *mode=FRAME_MODE_TRANSIENT;
+ if(OBJ_IS(mplex, WFrame)){
+ WFrameMode mode2=frame_mode((WFrame*)mplex);
+ if(framemode_unalt(mode2)==FRAME_MODE_TRANSIENT)
+ *mode=mode2;
}
return (WRegion*)mplex;
bool ioncore_detach(WRegion *reg, int sp)
{
- WPHolder *ph=region_get_return(reg);
WFrameMode mode;
WGroup *grp;
bool set, nset;
/*EXTL_DOC
- * Detach or reattach \var{reg}, depending on whether \var{how}
- * is \codestr{set}, \codestr{unset} or \codestr{toggle}. (Detaching
- * means making \var{reg} managed by its nearest ancestor \type{WGroup},
- * framed if \var{reg} is not itself \type{WFrame}. Reattaching means
- * making it managed where it used to be managed, if a return-placeholder
- * exists.)
- * If \var{reg} is the `bottom' of some group, the whole group is
- * detached. If \var{reg} is a \type{WWindow}, it is put into a
- * frame.
+ * Detach or reattach \var{reg} or any group it is the leader of
+ * (see \fnref{WRegion.groupleader_of}), depending on whether \var{how}
+ * is \codestr{set}, \codestr{unset} or \codestr{toggle}. If this
+ * region is not a window, it is put into a frame.
+ *
+ * Detaching a region means having it managed by its nearest ancestor
+ * \type{WGroup}. Reattaching means having it managed where it used
+ * to be managed, if a ``return placeholder'' exists.
+ *
+ * Additionally, setting \var{how} to \codestr{forget}, can be used to
+ * clear this return placeholder of the group leader of \var{reg}.
*/
EXTL_EXPORT_AS(ioncore, detach)
bool ioncore_detach_extl(WRegion *reg, const char *how)
if(how==NULL)
how="set";
+ if(strcmp(how, "forget")==0){
+ region_unset_return(region_groupleader_of(reg));
+ return FALSE;
+ }
+
return ioncore_detach(reg, libtu_string_to_setparam(how));
}