X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=mod_tiling%2Fsplit.c;h=d05cc587153731cb46dd95a212756a4ac003c041;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=54864d7b93bfbb2ea71b711cf5b773e44f69144c;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/mod_tiling/split.c b/mod_tiling/split.c index 54864d7..d05cc58 100644 --- a/mod_tiling/split.c +++ b/mod_tiling/split.c @@ -1,12 +1,9 @@ /* * ion/mod_tiling/split.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2007. * - * 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 @@ -1029,6 +1026,7 @@ err: void splittree_changeroot(WSplit *root, WSplit *node) { WTiling *ws=(WTiling*)(root->ws_if_root); + assert(ws!=NULL); assert(ws->split_tree==root); root->ws_if_root=NULL; @@ -1340,6 +1338,11 @@ WSplit *split_current_todir(WSplit *node, WPrimn hprimn, WPrimn vprimn, } +/* Note: both hprimn and vprimn are inverted when descending. Therefore + * one should be either PRIMN_NONE or PRIMN_ANY for sensible geometric + * navigation. (Both are PRIMN_TL or PRIMN_BR for pseudo-linear + * next/previous navigation.) + */ WSplit *splitsplit_nextto(WSplitSplit *node, WSplit *child, WPrimn hprimn, WPrimn vprimn, WSplitFilter *filter) @@ -1347,26 +1350,21 @@ WSplit *splitsplit_nextto(WSplitSplit *node, WSplit *child, WPrimn primn=(node->dir==SPLIT_HORIZONTAL ? hprimn : vprimn); WSplit *split=NULL, *nnode=NULL; - if(node->tl==child && (primn==PRIMN_BR || primn==PRIMN_ANY)){ + if(node->tl==child && (primn==PRIMN_BR || primn==PRIMN_ANY)) split=node->br; - primn=PRIMN_TL; - }else if(node->br==child && (primn==PRIMN_TL || primn==PRIMN_ANY)){ + else if(node->br==child && (primn==PRIMN_TL || primn==PRIMN_ANY)) split=node->tl; - primn=PRIMN_BR; - } if(split!=NULL){ - if(node->dir==SPLIT_HORIZONTAL){ - hprimn=primn; - vprimn=primn_none2any(vprimn); - }else{ - vprimn=primn; - hprimn=primn_none2any(vprimn); - } - - nnode=split_current_todir(split, hprimn, vprimn, filter); + nnode=split_current_todir(split, + primn_none2any(primn_invert(hprimn)), + primn_none2any(primn_invert(vprimn)), + filter); } - + + if(nnode==NULL) + nnode=split_nextto((WSplit*)node, hprimn, vprimn, filter); + return nnode; } @@ -1817,8 +1815,8 @@ WSplit *splitsplit_br(WSplitSplit *split) } /*EXTL_DOC - * Returns the direction of \var{split}; either ''vertical'' or - * ''horizontal''. + * Returns the direction of \var{split}; either \codestr{vertical} or + * \codestr{horizontal}. */ EXTL_SAFE EXTL_EXPORT_MEMBER