X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=mod_tiling%2Ftiling.c;h=48bbb86f506a3976f57258831660bb12a4710544;hp=bbefef74855029cbab2a722fed77d5e87d29b6dc;hb=e3aec18706513a87eaa7839dfdaf7e0fcd0d8d2a;hpb=de22e45179cb3bafa490294d31d47f361047a30a diff --git a/mod_tiling/tiling.c b/mod_tiling/tiling.c index bbefef7..48bbb86 100644 --- a/mod_tiling/tiling.c +++ b/mod_tiling/tiling.c @@ -1,12 +1,9 @@ /* * ion/mod_tiling/tiling.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2009. * - * 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 @@ -262,25 +259,6 @@ Window tiling_xwindow(const WTiling *ws) } -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; - } -} - - /*}}}*/ @@ -454,6 +432,8 @@ void tiling_manage_stdisp(WTiling *ws, WRegion *stdisp, tiling_unmanage_stdisp(ws, TRUE, TRUE); return; } + + stdisp->flags|=REGION_SKIP_FOCUS; dg=((WSplit*)(ws->stdispnode))->geom; @@ -498,8 +478,7 @@ bool tiling_managed_add_default(WTiling *ws, WRegion *reg) 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); } @@ -682,6 +661,7 @@ void tiling_do_managed_remove(WTiling *ws, WRegion *reg) } region_unset_manager(reg, (WRegion*)ws); + splittree_set_node_of(reg, NULL); } @@ -723,6 +703,7 @@ void tiling_managed_remove(WTiling *ws, WRegion *reg) if(other!=NULL){ node->reg=other; + splittree_set_node_of(other, node); tiling_managed_add(ws, other); reused=TRUE; }else{ @@ -1011,19 +992,16 @@ static WFrame *tiling_do_split(WTiling *ws, WSplit *node, 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) @@ -1049,11 +1027,12 @@ WFrame *tiling_split_top(WTiling *ws, 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, @@ -1087,45 +1066,26 @@ 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); } @@ -1149,7 +1109,8 @@ WRegion *tiling_current(WTiling *ws) /*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 @@ -1177,7 +1138,8 @@ WSplit *tiling_split_tree(WTiling *ws) /*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. */ @@ -1198,8 +1160,8 @@ WRegion *tiling_nextto(WTiling *ws, WRegion *reg, const char *dirstr, /*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 @@ -1375,8 +1337,8 @@ WSplitSplit *tiling_set_floating(WTiling *ws, WSplitSplit *split, int sp) /*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, @@ -1390,9 +1352,10 @@ 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, @@ -1771,9 +1734,6 @@ static DynFunTab tiling_dynfuntab[]={ {(DynFun*)region_xwindow, (DynFun*)tiling_xwindow}, - {(DynFun*)region_prepare_manage_transient, - (DynFun*)tiling_prepare_manage_transient}, - END_DYNFUNTAB };