Add fake-xinerama, create test that tests spurious screens are removed
[notion/jeffpc.git] / mod_tiling / split.h
blob162a1e1fcd2b792c3c0407c57f83b7bef90d0654
1 /*
2 * ion/mod_tiling/split.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_MOD_TILING_SPLIT_H
10 #define ION_MOD_TILING_SPLIT_H
12 #include <ioncore/common.h>
13 #include <ioncore/window.h>
14 #include <ioncore/reginfo.h>
15 #include <ioncore/attach.h>
16 #include <ioncore/rectangle.h>
17 #include <libextl/extl.h>
20 INTRCLASS(WSplit);
21 INTRCLASS(WSplitInner);
22 INTRCLASS(WSplitSplit);
23 INTRCLASS(WSplitRegion);
24 INTRCLASS(WSplitST);
27 typedef enum{
28 SPLIT_HORIZONTAL,
29 SPLIT_VERTICAL
30 } WSplitDir;
33 typedef enum{
34 PRIMN_ANY,
35 PRIMN_TL,
36 PRIMN_BR,
37 PRIMN_NONE
38 } WPrimn;
41 typedef enum {
42 SPLIT_CURRENT_TL,
43 SPLIT_CURRENT_BR
44 } WSplitCurrent;
47 DECLCLASS(WSplit){
48 Obj obj;
49 WRectangle geom;
50 WSplitInner *parent;
51 void *ws_if_root;
53 int min_w, min_h;
54 int max_w, max_h;
55 int unused_w, unused_h;
59 DECLCLASS(WSplitInner){
60 WSplit split;
64 DECLCLASS(WSplitSplit){
65 WSplitInner isplit;
66 int dir;
67 WSplit *tl, *br;
68 int current;
72 DECLCLASS(WSplitRegion){
73 WSplit split;
74 WRegion *reg;
78 DECLCLASS(WSplitST){
79 WSplitRegion regnode;
80 int orientation;
81 int corner;
82 bool fullsize;
86 typedef struct{
87 int tl, br;
88 bool any;
89 } RootwardAmount;
92 typedef bool WSplitFilter(WSplit *split);
93 typedef void WSplitFn(WSplit *split);
96 /* Misc. */
98 extern int split_size(WSplit *split, int dir);
99 extern int split_pos(WSplit *split, int dir);
100 extern int split_other_size(WSplit *split, int dir);
101 extern int split_other_pos(WSplit *split, int dir);
103 extern WSplitRegion *splittree_node_of(WRegion *reg);
104 extern bool splittree_set_node_of(WRegion *reg, WSplitRegion *split);
106 extern WPrimn primn_invert(WPrimn primn);
107 extern WPrimn primn_none2any(WPrimn primn);
109 /* Init/deinit */
111 extern bool split_init(WSplit *split, const WRectangle *geom);
112 extern bool splitinner_init(WSplitInner *split, const WRectangle *geom);
113 extern bool splitsplit_init(WSplitSplit *split, const WRectangle *geom,
114 int dir);
115 extern bool splitregion_init(WSplitRegion *split, const WRectangle *geom,
116 WRegion *reg);
117 extern bool splitst_init(WSplitST *split, const WRectangle *geom,
118 WRegion *reg);
121 extern WSplitSplit *create_splitsplit(const WRectangle *geom, int dir);
122 extern WSplitRegion *create_splitregion(const WRectangle *geom, WRegion *reg);
123 extern WSplitST *create_splitst(const WRectangle *geom, WRegion *reg);
126 extern void split_deinit(WSplit *split);
127 extern void splitsplit_deinit(WSplitSplit *split);
128 extern void splitinner_deinit(WSplitInner *split);
129 extern void splitregion_deinit(WSplitRegion *split);
130 extern void splitst_deinit(WSplitST *split);
132 /* Geometry */
134 DYNFUN void split_update_bounds(WSplit *node, bool recursive);
135 extern void splitsplit_update_geom_from_children(WSplitSplit *node);
136 DYNFUN void split_do_resize(WSplit *node, const WRectangle *ng,
137 WPrimn hprimn, WPrimn vprimn, bool transpose);
138 extern void splitsplit_do_resize(WSplitSplit *node, const WRectangle *ng,
139 WPrimn hprimn, WPrimn vprimn, bool transpose);
140 extern void split_resize(WSplit *node, const WRectangle *ng,
141 WPrimn hprimn, WPrimn vprimn);
142 DYNFUN void split_do_maxhelper(WSplit *node, int dir, int action);
143 DYNFUN bool split_do_restore(WSplit *node, int dir);
144 DYNFUN bool split_do_verify(WSplit *node, int dir);
145 extern bool split_maximize(WSplit *node, int dir, int action);
146 DYNFUN void splitinner_do_rqsize(WSplitInner *p, WSplit *node,
147 RootwardAmount *ha, RootwardAmount *va,
148 WRectangle *rg, bool tryonly);
149 extern ExtlTab split_rqgeom(WSplit *node, ExtlTab g);
151 /* Split */
153 extern void splittree_rqgeom(WSplit *node, int flags,
154 const WRectangle *geom, WRectangle *geomret);
157 DYNFUN void splitinner_replace(WSplitInner *node, WSplit *child, WSplit *what);
158 extern WSplitRegion *splittree_split(WSplit *node, int dir,
159 WPrimn primn, int minsize,
160 WRegionSimpleCreateFn *fn,
161 WWindow *parent);
163 extern void splittree_changeroot(WSplit *root, WSplit *node);
165 /* Remove */
167 DYNFUN void splitinner_remove(WSplitInner *node, WSplit *child,
168 bool reclaim_space);
169 extern void splittree_remove(WSplit *node, bool reclaim_space);
171 /* Tree traversal */
173 extern WSplit *split_find_root(WSplit *split);
174 DYNFUN WSplit *split_current_todir(WSplit *node,
175 WPrimn hprimn, WPrimn vprimn,
176 WSplitFilter *filter);
177 DYNFUN WSplit *splitinner_nextto(WSplitInner *node, WSplit *child,
178 WPrimn hprimn, WPrimn vprimn,
179 WSplitFilter *filter);
180 DYNFUN WSplit *splitinner_current(WSplitInner *node);
181 DYNFUN void splitinner_mark_current(WSplitInner *split, WSplit *child);
182 DYNFUN void splitinner_forall(WSplitInner *node, WSplitFn *fn);
183 extern WSplit *split_nextto(WSplit *node,
184 WPrimn hprimn, WPrimn vprimn,
185 WSplitFilter *filter);
187 /* X window handling */
189 void split_restack(WSplit *split, Window win, int mode);
190 void split_stacking(WSplit *split, Window *bottom_ret, Window *top_ret);
191 void split_map(WSplit *split);
192 void split_unmap(WSplit *split);
193 void split_reparent(WSplit *split, WWindow *wwin);
195 /* Transpose, flip, rotate */
197 extern void split_transpose(WSplit *split);
198 extern bool split_transpose_to(WSplit *split, const WRectangle *geom);
200 extern void splitsplit_flip_default(WSplitSplit *split);
201 DYNFUN void splitsplit_flip(WSplitSplit *split);
203 extern bool split_rotate_to(WSplit *node, const WRectangle *geom,
204 int rotation);
206 /* Save support */
208 extern bool split_get_config(WSplit *node, ExtlTab *ret);
209 extern ExtlTab split_base_config(WSplit *node);
211 /* Internal. */
213 extern void splittree_begin_resize();
214 extern void splittree_end_resize();
215 extern void splittree_scan_stdisp_rootward(WSplit *node);
217 extern void split_do_rqgeom_(WSplit *node, const WRectangle *ng,
218 bool hany, bool vany, WRectangle *rg,
219 bool tryonly);
222 #endif /* ION_MOD_TILING_SPLIT_H */