/*
* ion/mod_tiling/tiling.c
*
- * Copyright (c) Tuomo Valkonen 1999-2007.
+ * Copyright (c) Tuomo Valkonen 1999-2008.
*
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
*/
#include <string.h>
}
-WPHolder *tiling_prepare_manage_transient(WTiling *ws,
- const WClientWin *transient,
- const WManageParams *param,
- int unused)
-{
- /* Transient manager searches should not cross tilings unless
- * explicitly floated.
- */
- if(extl_table_is_bool_set(transient->proptab, "float")){
- return region_prepare_manage_transient_default((WRegion*)ws,
- transient,
- param,
- unused);
- }else{
- return NULL;
- }
-}
-
-
/*}}}*/
tiling_unmanage_stdisp(ws, TRUE, TRUE);
return;
}
+
+ stdisp->flags|=REGION_SKIP_FOCUS;
dg=((WSplit*)(ws->stdispnode))->geom;
frame=OBJ_CAST(reg, WFrame);
if(frame!=NULL){
- WFrameMode mode=frame_mode(frame);
- if(mode!=FRAME_MODE_TILED && mode!=FRAME_MODE_TILED_ALT)
+ if(framemode_unalt(frame_mode(frame))!=FRAME_MODE_TILED)
frame_set_mode(frame, FRAME_MODE_TILED);
}
}
region_unset_manager(reg, (WRegion*)ws);
+ splittree_set_node_of(reg, NULL);
}
if(other!=NULL){
node->reg=other;
+ splittree_set_node_of(other, node);
tiling_managed_add(ws, other);
reused=TRUE;
}else{
destroy_obj((Obj*)newframe);
return NULL;
}
-
- /* Restack */
- if(ws->split_tree!=NULL)
- split_restack(ws->split_tree, ws->dummywin, Above);
return newframe;
}
/*EXTL_DOC
- * Create a new frame on \var{ws} above/below/left of/right of
- * \var{node} as indicated by \var{dirstr}. If \var{dirstr} is
- * prefixed with ''floating:'' a floating split is created.
+ * Create a new frame on \var{ws} \codestr{above}, \codestr{below}
+ * \codestr{left} of, or \codestr{right} of \var{node} as indicated
+ * by \var{dirstr}. If \var{dirstr} is prefixed with
+ * \codestr{floating:} a floating split is created.
*/
EXTL_EXPORT_MEMBER
WFrame *tiling_split(WTiling *ws, WSplit *node, const char *dirstr)
/*EXTL_DOC
* Split \var{frame} creating a new frame to direction \var{dirstr}
- * (one of ''left'', ''right'', ''top'' or ''bottom'') of \var{frame}.
+ * (one of \codestr{left}, \codestr{right}, \codestr{top} or
+ * \codestr{bottom}) of \var{frame}.
* If \var{attach_current} is set, the region currently displayed in
* \var{frame}, if any, is moved to thenew frame.
- * If \var{dirstr} is prefixed with ''floating:'' a floating split is
- * created.
+ * If \var{dirstr} is prefixed with \codestr{floating:}, a floating
+ * split is created.
*/
EXTL_EXPORT_MEMBER
WFrame *tiling_split_at(WTiling *ws, WFrame *frame, const char *dirstr,
}
-void do_unsplit(WRegion *reg)
+/*EXTL_DOC
+ * Try to relocate regions managed by \var{reg} to another frame
+ * and, if possible, destroy it.
+ */
+EXTL_EXPORT_MEMBER
+void tiling_unsplit_at(WTiling *ws, WRegion *reg)
{
- WTiling *ws=REGION_MANAGER_CHK(reg, WTiling);
WPHolder *ph;
- bool res;
- if(ws==NULL)
+ if(reg==NULL || REGION_MANAGER(reg)!=(WRegion*)ws)
return;
ph=region_get_rescue_pholder_for((WRegion*)ws, reg);
- if(ph==NULL){
- res=!region_rescue_needed(reg);
- }else{
- res=region_rescue(reg, ph);
+ if(ph!=NULL){
+ region_rescue(reg, ph, REGION_RESCUE_NODEEP|REGION_RESCUE_PHFLAGS_OK);
destroy_obj((Obj*)ph);
}
- if(!res){
- warn(TR("Unable to unsplit: Could not move client windows "
- "elsewhere within the tiling."));
- return;
- }
-
- destroy_obj((Obj*)reg);
-}
-
-
-/*EXTL_DOC
- * Try to relocate regions managed by \var{reg} to another frame
- * and, if possible, destroy it.
- */
-EXTL_EXPORT_MEMBER
-void tiling_unsplit_at(WTiling *ws, WRegion *reg)
-{
- if(reg==NULL || REGION_MANAGER(reg)!=(WRegion*)ws)
- return;
-
- mainloop_defer_action((Obj*)reg, (WDeferredAction*)do_unsplit);
+ region_defer_rqdispose(reg);
}
/*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
/*EXTL_DOC
* Return the most previously active region next to \var{reg} in
- * direction \var{dirstr} (left/right/up/down). The region \var{reg}
+ * direction \var{dirstr} (\codestr{left}, \codestr{right}, \codestr{up},
+ * or \codestr{down}). The region \var{reg}
* must be managed by \var{ws}. If \var{any} is not set, the status display
* is not considered.
*/
/*EXTL_DOC
* Return the most previously active region on \var{ws} with no
* other regions next to it in direction \var{dirstr}
- * (left/right/up/down). If \var{any} is not set, the status
- * display is not considered.
+ * (\codestr{left}, \codestr{right}, \codestr{up}, or \codestr{down}).
+ * If \var{any} is not set, the status display is not considered.
*/
EXTL_SAFE
EXTL_EXPORT_MEMBER
/*EXTL_DOC
* Toggle floating of a split's sides at \var{split} as indicated by the
- * parameter \var{how} (set/unset/toggle). A split of the appropriate is
- * returned, if there was a change.
+ * parameter \var{how} (\codestr{set}, \codestr{unset}, or \codestr{toggle}).
+ * A split of the appropriate is returned, if there was a change.
*/
EXTL_EXPORT_AS(WTiling, set_floating)
WSplitSplit *tiling_set_floating_extl(WTiling *ws, WSplitSplit *split,
/*EXTL_DOC
* Toggle floating of the sides of a split containin \var{reg} as indicated
- * by the parameters \var{how} (set/unset/toggle) and \var{dirstr}
- * (left/right/up/down/any). The new status is returned (and \code{false}
- * also on error).
+ * by the parameters \var{how} (\codestr{set}, \codestr{unset}, or
+ * \codestr{toggle}) and \var{dirstr} (\codestr{left}, \codestr{right},
+ * \codestr{up}, or \codestr{down}). The new status is returned
+ * (and \code{false} also on error).
*/
EXTL_EXPORT_AS(WTiling, set_floating_at)
bool tiling_set_floating_at_extl(WTiling *ws, WRegion *reg, const char *how,
{(DynFun*)region_xwindow,
(DynFun*)tiling_xwindow},
- {(DynFun*)region_prepare_manage_transient,
- (DynFun*)tiling_prepare_manage_transient},
-
END_DYNFUNTAB
};