]> git.decadent.org.uk Git - ion3.git/blob - mod_tiling/split-stdisp.c
352ba412147bb8f27da9bfe8c20536354cd9facb
[ion3.git] / mod_tiling / split-stdisp.c
1 /*
2  * ion/mod_tiling/split-stdisp.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #include <libtu/minmax.h>
13 #include <ioncore/common.h>
14 #include <ioncore/mplex.h>
15 #include <ioncore/resize.h>
16 #include "split.h"
17 #include "split-stdisp.h"
18 #include "tiling.h"
19
20
21 /*{{{ Helper routines */
22
23
24 #define STDISP_IS_HORIZONTAL(STDISP) \
25         ((STDISP)->orientation==REGION_ORIENTATION_HORIZONTAL)
26
27 #define STDISP_IS_VERTICAL(STDISP) \
28         ((STDISP)->orientation==REGION_ORIENTATION_VERTICAL)
29
30 #define STDISP_GROWS_L_TO_R(STDISP) (STDISP_IS_HORIZONTAL(STDISP) && \
31     ((STDISP)->corner==MPLEX_STDISP_TL ||                            \
32      (STDISP)->corner==MPLEX_STDISP_BL))
33
34 #define STDISP_GROWS_R_TO_L(STDISP) (STDISP_IS_HORIZONTAL(STDISP) && \
35     ((STDISP)->corner==MPLEX_STDISP_TR ||                            \
36      (STDISP)->corner==MPLEX_STDISP_BR))
37
38 #define STDISP_GROWS_T_TO_B(STDISP) (STDISP_IS_VERTICAL(STDISP) && \
39     ((STDISP)->corner==MPLEX_STDISP_TL ||                          \
40      (STDISP)->corner==MPLEX_STDISP_TR))
41
42 #define STDISP_GROWS_B_TO_T(STDISP) (STDISP_IS_VERTICAL(STDISP) && \
43     ((STDISP)->corner==MPLEX_STDISP_BL ||                          \
44      (STDISP)->corner==MPLEX_STDISP_BR))
45
46 #define GEOM(S) (((WSplit*)S)->geom)
47
48 #define IMPLIES(X, Y) (!(X) || (Y))
49
50
51 static int other_dir(int dir)
52 {
53     return (dir==SPLIT_VERTICAL ? SPLIT_HORIZONTAL : SPLIT_VERTICAL);
54 }
55
56
57 static void swap(int *x, int *y)
58 {
59     int z=*x;
60     *x=*y;
61     *y=z;
62 }
63
64
65 static void swapptr(WSplit **x, WSplit **y)
66 {
67     void *z=*x;
68     *x=*y;
69     *y=z;
70 }
71
72
73 static void swapgeom(WRectangle *g, WRectangle *h)
74 {
75     WRectangle tmp=*g;
76     *g=*h;
77     *h=tmp;
78 }
79
80
81 int stdisp_recommended_w(WSplitST *stdisp)
82 {
83     if(stdisp->regnode.reg==NULL)
84         return CF_STDISP_MIN_SZ;
85     
86     if(stdisp->fullsize && stdisp->orientation==REGION_ORIENTATION_HORIZONTAL){
87         WTiling *ws=REGION_MANAGER_CHK(stdisp->regnode.reg, WTiling);
88         assert(ws!=NULL);
89         return REGION_GEOM(ws).w;
90     }
91     
92     return maxof(CF_STDISP_MIN_SZ, region_min_w(stdisp->regnode.reg));
93 }
94
95
96 int stdisp_recommended_h(WSplitST *stdisp)
97 {
98     if(stdisp->regnode.reg==NULL)
99         return CF_STDISP_MIN_SZ;
100     
101     if(stdisp->fullsize && stdisp->orientation==REGION_ORIENTATION_VERTICAL){
102         WTiling *ws=REGION_MANAGER_CHK(stdisp->regnode.reg, WTiling);
103         assert(ws!=NULL);
104         return REGION_GEOM(ws).h;
105     }
106
107     return maxof(CF_STDISP_MIN_SZ, region_min_h(stdisp->regnode.reg));
108 }
109
110
111 static bool stdisp_dir_ok(WSplitSplit *p, WSplitST *stdisp)
112 {
113     assert(p->tl==(WSplit*)stdisp || p->br==(WSplit*)stdisp);
114     
115     return (IMPLIES(STDISP_IS_HORIZONTAL(stdisp), p->dir==SPLIT_VERTICAL) &&
116             IMPLIES(STDISP_IS_VERTICAL(stdisp), p->dir==SPLIT_HORIZONTAL));
117 }
118
119
120 /*}}}*/
121
122
123 /*{{{ New rotation and flipping primitives */
124
125
126 static void replace(WSplitSplit *a, WSplitSplit *p)
127 {
128     if(((WSplit*)a)->parent!=NULL)
129         splitinner_replace(((WSplit*)a)->parent, (WSplit*)a, (WSplit*)p);
130     else
131         splittree_changeroot((WSplit*)a, (WSplit*)p);
132 }
133
134
135 /* Yes, it is overparametrised */
136 static void rotate_right(WSplitSplit *a, WSplitSplit *p, WSplit *y)
137 {
138     assert(a->tl==(WSplit*)p && p->tl==y);
139     
140     /* Right rotation:
141      *        a             p
142      *      /  \          /   \
143      *     p    x   =>   y     a
144      *   /   \               /   \
145      *  y     ?             ?     x
146      */
147     
148     a->tl=p->br;
149     a->tl->parent=(WSplitInner*)a;
150     replace(a, p);
151     p->br=(WSplit*)a;
152     ((WSplit*)a)->parent=(WSplitInner*)p;
153 }
154
155
156 static void rot_rs_rotate_right(WSplitSplit *a, WSplitSplit *p, WSplit *y)
157 {
158     WRectangle xg, yg, pg, ag, qg;
159     WSplit *x=a->br, *q=p->br;
160     
161     assert(a->dir==other_dir(p->dir));
162
163     qg=GEOM(q);
164     xg=GEOM(x);
165     yg=GEOM(y);
166     pg=GEOM(p);
167     ag=GEOM(a);
168     
169     if(a->dir==SPLIT_HORIZONTAL){
170         /* yyxx    yyyy
171          * ??xx => ??xx
172          * ??xx    ??xx
173          */
174         yg.w=ag.w;
175         pg.w=ag.w;
176         xg.h=qg.h;
177         ag.h=qg.h;
178         xg.y=qg.y;
179         ag.y=qg.y;
180     }else{
181         /* y??    y??
182          * y??    y??
183          * xxx => yxx
184          * xxx    yxx
185          */
186         yg.h=ag.h;
187         pg.h=ag.h;
188         xg.w=qg.w;
189         ag.w=qg.w;
190         xg.x=qg.x;
191         ag.x=qg.x;
192     }
193     
194     rotate_right(a, p, y);
195     
196     GEOM(p)=pg;
197     GEOM(a)=ag;
198     
199     split_do_resize(x, &xg, PRIMN_TL, PRIMN_TL, FALSE);
200     split_do_resize(y, &yg, PRIMN_BR, PRIMN_BR, FALSE);
201 }
202
203
204
205 static void rotate_left(WSplitSplit *a, WSplitSplit *p, WSplit *y)
206 {
207     assert(a->br==(WSplit*)p && p->br==y);
208     
209     /* Left rotation:
210      *     a                  p
211      *   /   \              /   \
212      *  x     p     =>     a     y
213      *      /   \        /  \
214      *     ?     y      x    ?
215      */
216     
217     a->br=p->tl;
218     a->br->parent=(WSplitInner*)a;
219     replace(a, p);
220     p->tl=(WSplit*)a;
221     ((WSplit*)a)->parent=(WSplitInner*)p;
222 }
223
224
225 static void rot_rs_rotate_left(WSplitSplit *a, WSplitSplit *p, WSplit *y)
226 {
227     WRectangle xg, yg, pg, ag, qg;
228     WSplit *x=a->tl, *q=p->tl;
229     
230     assert(a->dir==other_dir(p->dir));
231
232     qg=GEOM(q);
233     xg=GEOM(x);
234     yg=GEOM(y);
235     pg=GEOM(p);
236     ag=GEOM(a);
237     
238     if(a->dir==SPLIT_HORIZONTAL){
239         /* xx??    xx??
240          * xx?? => xx??
241          * xxyy    yyyy
242          */
243         yg.w=ag.w;
244         yg.x=ag.x;
245         pg.w=ag.w;
246         pg.x=ag.x;
247         xg.h=qg.h;
248         ag.h=qg.h;
249     }else{
250         /* xxx    xxy
251          * xxx    xxy
252          * ??y => ??y
253          * ??y    ??y
254          */
255         yg.h=ag.h;
256         yg.y=ag.y;
257         pg.h=ag.h;
258         pg.y=ag.y;
259         xg.w=qg.w;
260         ag.w=qg.w;
261     }
262
263     rotate_left(a, p, y);
264     
265     GEOM(p)=pg;
266     GEOM(a)=ag;
267     
268     split_do_resize(x, &xg, PRIMN_BR, PRIMN_BR, FALSE);
269     split_do_resize(y, &yg, PRIMN_TL, PRIMN_TL, FALSE);
270 }
271
272
273
274 static void flip_right(WSplitSplit *a, WSplitSplit *p)
275 {
276     WSplit *tmp;
277     
278     assert(a->tl==(WSplit*)p);
279     
280     /* Right flip:
281      *        a               p 
282      *      /   \           /   \
283      *     p     x   =>    a     y
284      *   /  \            /  \
285      *  ?    y          ?    x
286      */
287
288     a->tl=p->tl;
289     a->tl->parent=(WSplitInner*)a;
290     replace(a, p);
291     p->tl=(WSplit*)a;
292     ((WSplit*)a)->parent=(WSplitInner*)p;
293 }
294
295
296 static void rot_rs_flip_right(WSplitSplit *a, WSplitSplit *p)
297 {
298     WRectangle xg, yg, pg, ag, qg;
299     WSplit *x=a->br, *q=p->tl, *y=p->br;
300     
301     assert(a->dir==other_dir(p->dir));
302
303     qg=GEOM(q);
304     xg=GEOM(x);
305     yg=GEOM(y);
306     pg=GEOM(p);
307     ag=GEOM(a);
308     
309     if(a->dir==SPLIT_HORIZONTAL){
310         /* ??xx    ??xx
311          * ??xx => ??xx
312          * yyxx    yyyy
313          */
314         yg.w=ag.w;
315         pg.w=ag.w;
316         ag.h=qg.h;
317         xg.h=qg.h;
318     }else{
319         /* ??y    ??y
320          * ??y    ??y
321          * xxx => xxy
322          * xxx    xxy
323          */
324         yg.h=ag.h;
325         pg.h=ag.h;
326         ag.w=qg.w;
327         xg.w=qg.w;
328     }
329     
330     flip_right(a, p);
331     
332     GEOM(p)=pg;
333     GEOM(a)=ag;
334     
335     split_do_resize(x, &xg, PRIMN_BR, PRIMN_BR, FALSE);
336     split_do_resize(y, &yg, PRIMN_BR, PRIMN_BR, FALSE);
337 }
338
339
340 static void flip_left(WSplitSplit *a, WSplitSplit *p)
341 {
342     WSplit *tmp;
343     
344     assert(a->br==(WSplit*)p);
345     
346     /* Left flip:
347      *     a               p 
348      *   /   \           /   \
349      *  x     p    =>   y     a
350      *      /  \            /  \
351      *     y    ?          x    ?
352      */
353     
354     a->br=p->br;
355     a->br->parent=(WSplitInner*)a;
356     replace(a, p);
357     p->br=(WSplit*)a;
358     ((WSplit*)a)->parent=(WSplitInner*)p;
359 }
360
361
362 static void rot_rs_flip_left(WSplitSplit *a, WSplitSplit *p)
363 {
364     WRectangle xg, yg, pg, ag, qg;
365     WSplit *x=a->tl, *q=p->br, *y=p->tl;
366     
367     assert(a->dir==other_dir(p->dir));
368
369     qg=GEOM(q);
370     xg=GEOM(x);
371     yg=GEOM(y);
372     pg=GEOM(p);
373     ag=GEOM(a);
374     
375     if(a->dir==SPLIT_HORIZONTAL){
376         /* xxyy    yyyy
377          * xx?? => xx??
378          * xx??    xx??
379          */
380         yg.x=ag.x;
381         yg.w=ag.w;
382         pg.x=ag.x;
383         pg.w=ag.w;
384         xg.h=qg.h;
385         xg.y=qg.y;
386         ag.h=qg.h;
387         ag.y=qg.y;
388     }else{
389         /* xxx    yxx
390          * xxx    yxx
391          * y?? => y??
392          * y??    y??
393          */
394         yg.y=ag.y;
395         yg.h=ag.h;
396         pg.y=ag.y;
397         pg.h=ag.h;
398         xg.w=qg.w;
399         xg.x=qg.x;
400         ag.w=qg.w;
401         ag.x=qg.x;
402     }
403     
404     flip_left(a, p);
405     
406     GEOM(p)=pg;
407     GEOM(a)=ag;
408     
409     split_do_resize(x, &xg, PRIMN_TL, PRIMN_TL, FALSE);
410     split_do_resize(y, &yg, PRIMN_TL, PRIMN_TL, FALSE);
411 }
412
413
414 static void rot_para_right(WSplitSplit *a, WSplitSplit *p,
415                            WSplit *y)
416 {
417     rotate_right(a, p, y);
418     if(a->dir==SPLIT_VERTICAL){
419         GEOM(p).y=GEOM(a).y;
420         GEOM(p).h=GEOM(a).h;
421         GEOM(a).y=GEOM(a->tl).y;
422         GEOM(a).h=GEOM(a->br).y+GEOM(a->br).h-GEOM(a).y;
423     }else{
424         GEOM(p).x=GEOM(a).x;
425         GEOM(p).w=GEOM(a).w;
426         GEOM(a).x=GEOM(a->tl).x;
427         GEOM(a).w=GEOM(a->br).x+GEOM(a->br).w-GEOM(a).x;
428     }
429 }
430
431
432 static void rot_para_left(WSplitSplit *a, WSplitSplit *p,
433                           WSplit *y)
434 {
435     rotate_left(a, p, y);
436     if(a->dir==SPLIT_VERTICAL){
437         GEOM(p).y=GEOM(a).y;
438         GEOM(p).h=GEOM(a).h;
439         GEOM(a).h=GEOM(a->br).y+GEOM(a->br).h-GEOM(a).y;
440     }else{
441         GEOM(p).x=GEOM(a).x;
442         GEOM(p).w=GEOM(a).w;
443         GEOM(a).w=GEOM(a->br).x+GEOM(a->br).w-GEOM(a).x;
444     }
445 }
446
447
448 /*}}}*/
449
450
451 /*{{{ Sink */
452
453
454 static bool do_try_sink_stdisp_orth(WSplitSplit *p, WSplitST *stdisp, 
455                                     WSplitSplit *other, bool force)
456 {
457     bool doit=force;
458     
459     assert(p->dir==other_dir(other->dir));
460     assert(stdisp_dir_ok(p, stdisp));
461     
462     if(STDISP_GROWS_T_TO_B(stdisp) || STDISP_GROWS_L_TO_R(stdisp)){
463         if(STDISP_GROWS_L_TO_R(stdisp)){
464             assert(other->dir==SPLIT_HORIZONTAL);
465             if(other->tl->geom.w>=stdisp_recommended_w(stdisp))
466                 doit=TRUE;
467         }else{ /* STDISP_GROWS_T_TO_B */
468             assert(other->dir==SPLIT_VERTICAL);
469             if(other->tl->geom.h>=stdisp_recommended_h(stdisp))
470                 doit=TRUE;
471         }
472         
473         if(doit){
474             if(p->br==(WSplit*)stdisp)
475                 rot_rs_flip_right(p, other);
476             else /* p->tl==stdisp */
477                 rot_rs_rotate_left(p, other, other->br);
478         }
479     }else{ /* STDISP_GROWS_B_TO_T or STDISP_GROW_R_TO_L */
480         if(STDISP_GROWS_R_TO_L(stdisp)){
481             assert(other->dir==SPLIT_HORIZONTAL);
482             if(other->br->geom.w>=stdisp_recommended_w(stdisp))
483                 doit=TRUE;
484         }else{ /* STDISP_GROWS_B_TO_T */
485             assert(other->dir==SPLIT_VERTICAL);
486             if(other->br->geom.h>=stdisp_recommended_h(stdisp))
487                 doit=TRUE;
488         }
489         
490         if(doit){
491             if(p->tl==(WSplit*)stdisp)
492                 rot_rs_flip_left(p, other);
493             else /* p->br==stdisp */
494                 rot_rs_rotate_right(p, other, other->tl);
495         }
496     }
497     
498     return doit;
499 }
500
501
502 static bool do_try_sink_stdisp_para(WSplitSplit *p, WSplitST *stdisp, 
503                                     WSplitSplit *other, bool force)
504 {
505     if(!force){
506         if(STDISP_IS_HORIZONTAL(stdisp)){
507             if(stdisp_recommended_w(stdisp)>=GEOM(p).w)
508                 return FALSE;
509         }else{
510             if(stdisp_recommended_h(stdisp)>=GEOM(p).h)
511                 return FALSE;
512         }
513     }
514     
515     if(p->tl==(WSplit*)stdisp)
516         rot_para_left(p, other, other->br);
517     else
518         rot_para_right(p, other, other->tl);
519     
520     return TRUE;
521 }
522
523
524 bool split_try_sink_stdisp(WSplitSplit *node, bool iterate, bool force)
525 {
526     bool didsomething=FALSE;
527     bool more=TRUE;
528     
529     /*assert(OBJ_IS_EXACTLY(node, WSplitSplit));*/
530     
531     while(more){
532         WSplit *tl=node->tl;
533         WSplit *br=node->br;
534         WSplitSplit *other=NULL;
535         WSplitST *st;
536         
537         if(OBJ_IS(tl, WSplitST)){
538             st=(WSplitST*)tl;
539             other=OBJ_CAST(br, WSplitSplit);
540         }else if(OBJ_IS(br, WSplitST)){
541             st=(WSplitST*)br;
542             other=OBJ_CAST(tl, WSplitSplit);
543         }else{
544             break;
545         }
546         
547         if(other==NULL)
548             break;
549         
550         if(!stdisp_dir_ok(node, st))
551             break;
552         
553         if(other->dir==other_dir(node->dir)){
554             if(!do_try_sink_stdisp_orth(node, st, other, force))
555                 break;
556         }else /*if(br->dir==node->dir)*/{
557             if(!do_try_sink_stdisp_para(node, st, other, force))
558                 break;
559         }
560         didsomething=TRUE;
561         more=iterate;
562     }
563     
564     return didsomething;
565 }
566
567
568 /*}}}*/
569
570
571 /*{{{ Unsink */
572
573
574 static bool do_try_unsink_stdisp_orth(WSplitSplit *a, WSplitSplit *p,
575                                       WSplitST *stdisp, bool force)
576 {
577     bool doit=force;
578     
579     assert(p->dir==other_dir(a->dir));
580     assert(stdisp_dir_ok(p, stdisp));
581     
582     if(STDISP_GROWS_T_TO_B(stdisp) || STDISP_GROWS_L_TO_R(stdisp)){
583         if(STDISP_GROWS_L_TO_R(stdisp)){
584             assert(a->dir==SPLIT_HORIZONTAL);
585             if(GEOM(stdisp).w<stdisp_recommended_w(stdisp))
586                 doit=TRUE;
587         }else{ /* STDISP_GROWS_T_TO_B */
588             assert(a->dir==SPLIT_VERTICAL);
589             if(GEOM(stdisp).h<stdisp_recommended_h(stdisp))
590                 doit=TRUE;
591         }
592         
593         if(doit){
594             if((WSplit*)p==a->tl){
595                 if((WSplit*)stdisp==p->br)
596                     rot_rs_flip_right(a, p);
597                 else /*stdisp==p->tl*/
598                     rot_rs_rotate_right(a, p, (WSplit*)stdisp);
599             }else{ /*p==a->br*/
600 #if 0
601                 /* abnormal cases. */
602                 warn(TR("Status display in bad split configuration."));
603                 return FALSE;
604 #else                
605                 if((WSplit*)stdisp==p->br)
606                     rot_rs_rotate_left(a, p, (WSplit*)stdisp);
607                 else /*stdisp==p->tl*/
608                     rot_rs_flip_left(a, p);
609 #endif
610             }
611         }
612     }else{ /*STDISP_GROWS_B_TO_T || STDISP_GROWS_R_TO_L*/
613         if(STDISP_GROWS_R_TO_L(stdisp)){
614             assert(a->dir==SPLIT_HORIZONTAL);
615             if(GEOM(stdisp).w<stdisp_recommended_w(stdisp))
616                 doit=TRUE;
617         }else{ /* STDISP_GROWS_B_TO_T */
618             assert(a->dir==SPLIT_VERTICAL);
619             if(GEOM(stdisp).h<stdisp_recommended_h(stdisp))
620                 doit=TRUE;
621         }
622         
623         if(doit){
624             if((WSplit*)p==a->tl){
625 #if 0
626                 /* abnormal cases. */
627                 warn(TR("Status display in bad split configuration."));
628                 return FALSE;
629 #else                
630                 if((WSplit*)stdisp==p->br)
631                     rot_rs_flip_right(a, p);
632                 else /*stdisp==p->tl*/
633                     rot_rs_rotate_right(a, p, (WSplit*)stdisp);
634 #endif                
635             }else{ /*p==a->br*/
636                 if((WSplit*)stdisp==p->br)
637                     rot_rs_rotate_left(a, p, (WSplit*)stdisp);
638                 else /*stdisp==p->tl*/
639                     rot_rs_flip_left(a, p);
640             }
641         }
642     }
643     
644     return doit;
645 }
646
647
648 static bool do_try_unsink_stdisp_para(WSplitSplit *a, WSplitSplit *p,
649                                       WSplitST *stdisp,  bool force)
650 {
651     if(!force){
652         if(STDISP_IS_HORIZONTAL(stdisp)){
653             if(stdisp_recommended_w(stdisp)<=GEOM(p).w)
654                 return FALSE;
655         }else{
656             if(stdisp_recommended_h(stdisp)<=GEOM(p).h)
657                 return FALSE;
658         }
659     }
660     
661     
662     if(a->tl==(WSplit*)p && p->tl==(WSplit*)stdisp){
663         rot_para_right(a, p, (WSplit*)stdisp);
664     }else if(a->br==(WSplit*)p && p->br==(WSplit*)stdisp){
665         rot_para_left(a, p, (WSplit*)stdisp);
666     }else{
667         warn(TR("Status display badly located in split tree."));
668         return FALSE;
669     }
670     
671     return TRUE;
672 }
673
674
675 bool split_try_unsink_stdisp(WSplitSplit *node, bool iterate, bool force)
676 {
677     bool didsomething=FALSE;
678     bool more=TRUE;
679     
680     /*assert(OBJ_IS_EXACTLY(node, WSplitSplit));*/
681
682     while(more){
683         WSplitSplit *p=OBJ_CAST(((WSplit*)node)->parent, WSplitSplit);
684         WSplit *tl=node->tl;
685         WSplit *br=node->br;
686         WSplitST *st;
687
688         if(p==NULL)
689             break;
690         
691         if(OBJ_IS(tl, WSplitST))
692             st=(WSplitST*)tl;
693         else if(OBJ_IS(br, WSplitST))
694             st=(WSplitST*)br;
695         else
696             break;
697         
698         if(!stdisp_dir_ok(node, st))
699             break;
700         
701         if(p->dir==other_dir(node->dir)){
702             if(!do_try_unsink_stdisp_orth(p, node, st, force))
703                 break;
704         }else /*if(p->dir==node->dir)*/{
705             if(!do_try_unsink_stdisp_para(p, node, st, force))
706                 break;
707         }
708         
709         didsomething=TRUE;
710         more=iterate;
711     }
712     
713     return didsomething;
714 }
715
716
717 /*}}}*/
718
719
720 /*{{{ Sink or unsink */
721
722
723 bool split_regularise_stdisp(WSplitST *stdisp)
724 {
725     WSplitSplit *node=OBJ_CAST(((WSplit*)stdisp)->parent, WSplitSplit);
726     
727     if(node==NULL)
728         return FALSE;
729     
730     if(STDISP_IS_HORIZONTAL(stdisp)){
731         if(GEOM(stdisp).w<stdisp_recommended_w(stdisp))
732             return split_try_unsink_stdisp(node, TRUE, FALSE);
733         else if(GEOM(stdisp).w>stdisp_recommended_w(stdisp))
734             return split_try_sink_stdisp(node, TRUE, FALSE);
735     }else{
736         if(GEOM(stdisp).h<stdisp_recommended_h(stdisp))
737             return split_try_unsink_stdisp(node, TRUE, FALSE);
738         else if(GEOM(stdisp).h>stdisp_recommended_h(stdisp))
739             return split_try_sink_stdisp(node, TRUE, FALSE);
740     }
741     
742     return FALSE;
743 }
744
745
746 /*}}}*/
747