2 * ion/mod_tiling/tiling.h
4 * Copyright (c) Tuomo Valkonen 1999-2007.
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.
12 #ifndef ION_MOD_TILING_TILING_H
13 #define ION_MOD_TILING_TILING_H
15 #include <libtu/ptrlist.h>
16 #include <libextl/extl.h>
17 #include <ioncore/common.h>
18 #include <ioncore/region.h>
19 #include <ioncore/screen.h>
20 #include <ioncore/rectangle.h>
21 #include <ioncore/pholder.h>
22 #include <ioncore/navi.h>
23 #include <ioncore/manage.h>
32 PtrList *managed_list;
33 WRegionSimpleCreateFn *create_frame_fn;
39 extern bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp,
40 WRegionSimpleCreateFn *create_frame_fn, bool ci);
41 extern WTiling *create_tiling(WWindow *parent, const WFitParams *fp,
42 WRegionSimpleCreateFn *create_frame_fn, bool ci);
43 extern WTiling *create_tiling_simple(WWindow *parent, const WFitParams *fp);
44 extern void tiling_deinit(WTiling *ws);
46 extern bool tiling_do_attach_initial(WTiling *tiling, WRegion *reg);
48 extern ExtlTab tiling_resize_tree(WTiling *ws, WSplit *node, ExtlTab g);
50 extern WRegion *tiling_current(WTiling *ws);
51 extern WRegion *tiling_nextto(WTiling *ws, WRegion *reg, const char *str, bool any);
52 extern WRegion *tiling_farthest(WTiling *ws, const char *str, bool any);
53 extern WRegion *tiling_region_at(WTiling *ws, int x, int y);
55 extern WFrame *tiling_split_top(WTiling *ws, const char *dirstr);
56 extern WFrame *tiling_split_at(WTiling *ws, WFrame *frame,
57 const char *dirstr, bool attach_current);
58 extern void tiling_unsplit_at(WTiling *ws, WRegion *reg);
60 extern WSplitSplit *tiling_set_floating(WTiling *ws, WSplitSplit *split,
63 extern WSplit *tiling_split_tree(WTiling *ws);
64 extern WSplit *tiling_split_of(WTiling *ws, WRegion *reg);
66 extern void tiling_do_managed_remove(WTiling *ws, WRegion *reg);
68 DYNFUN bool tiling_managed_add(WTiling *ws, WRegion *reg);
69 extern bool tiling_managed_add_default(WTiling *ws, WRegion *reg);
71 extern WRegion *tiling_do_navi_next(WTiling *ws, WRegion *reg,
72 WRegionNavi nh, bool nowrap,
74 extern WRegion *tiling_do_navi_first(WTiling *ws, WRegionNavi nh,
76 extern WRegion *tiling_navi_next(WTiling *ws, WRegion *reg,
77 WRegionNavi nh, WRegionNaviData *data);
78 extern WRegion *tiling_navi_first(WTiling *ws, WRegionNavi nh,
79 WRegionNaviData *data);
81 /* Inherited dynfun implementations */
83 extern bool tiling_fitrep(WTiling *ws, WWindow *par, const WFitParams *fp);
84 extern void tiling_map(WTiling *ws);
85 extern void tiling_unmap(WTiling *ws);
86 extern ExtlTab tiling_get_configuration(WTiling *ws);
87 extern void tiling_managed_rqgeom(WTiling *ws, WRegion *reg,
88 const WRQGeomParams *rq,
90 extern void tiling_managed_remove(WTiling *ws, WRegion *reg);
91 extern void tiling_managed_activated(WTiling *ws, WRegion *reg);
92 extern bool tiling_rescue_clientwins(WTiling *ws, WRescueInfo *ph);
93 extern WPHolder *tiling_get_rescue_pholder_for(WTiling *ws, WRegion *mgd);
94 extern void tiling_do_set_focus(WTiling *ws, bool warp);
95 extern bool tiling_managed_prepare_focus(WTiling *ws, WRegion *reg,
96 int flags, WPrepareFocusResult *res);
97 extern void tiling_manage_stdisp(WTiling *ws, WRegion *stdisp,
98 const WMPlexSTDispInfo *di);
99 extern void tiling_unmanage_stdisp(WTiling *ws, bool permanent, bool nofocus);
101 extern void tiling_fallback_focus(WTiling *ws, bool warp);
105 /* Stupid C can't handle recursive 'WSplitLoadFn *fn' here, so we have
106 * to use the void pointer.
108 typedef WSplit *WSplitLoadFn(WTiling *ws, const WRectangle *geom, ExtlTab tab);
110 extern WRegion *tiling_load(WWindow *par, const WFitParams *fp, ExtlTab tab);
112 DYNFUN WSplit *tiling_load_node(WTiling *ws, const WRectangle *geom, ExtlTab tab);
113 extern WSplit *tiling_load_node_default(WTiling *ws, const WRectangle *geom, ExtlTab tab);
115 extern WSplit *load_splitregion(WTiling *ws, const WRectangle *geom, ExtlTab tab);
116 extern WSplit *load_splitsplit(WTiling *ws, const WRectangle *geom, ExtlTab tab);
117 extern WSplit *load_splitst(WTiling *ws, const WRectangle *geom, ExtlTab tab);
121 typedef PtrListIterTmp WTilingIterTmp;
123 #define FOR_ALL_MANAGED_BY_TILING(VAR, WS, TMP) \
124 FOR_ALL_ON_PTRLIST(WRegion*, VAR, (WS)->managed_list, TMP)
126 #define FOR_ALL_MANAGED_BY_TILING_UNSAFE(VAR, WS) \
127 FOR_ALL_ON_PTRLIST_UNSAFE(WRegion*, VAR, (WS)->managed_list)
131 #define TILING_STDISP_OF(WS) \
132 ((WS)->stdispnode!=NULL ? (WS)->stdispnode->regnode.reg : NULL)
135 #endif /* ION_MOD_TILING_TILING_H */