4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * See the included file LICENSE for details.
9 #ifndef ION_IONCORE_MPLEX_H
10 #define ION_IONCORE_MPLEX_H
12 #include <libextl/extl.h>
13 #include <libmainloop/hooks.h>
18 #include "rectangle.h"
20 #include "sizepolicy.h"
23 #define MPLEX_ADD_TO_END 0x0001
24 #define MPLEX_MANAGED_UNVIEWABLE 0x0002
26 #define MPLEX_MGD_UNVIEWABLE(MPLEX) \
27 ((MPLEX)->flags&MPLEX_MANAGED_UNVIEWABLE)
30 #define MPLEX_ATTACH_SWITCHTO 0x0001 /* switch to region */
31 #define MPLEX_ATTACH_UNNUMBERED 0x0002 /* do not put on mut.ex list */
32 #define MPLEX_ATTACH_HIDDEN 0x0004 /* should be hidden */
33 #define MPLEX_ATTACH_PSEUDOMODAL 0x0008 /* pseudomodal (if modal) */
34 #define MPLEX_ATTACH_LEVEL 0x0010 /* level field set */
35 #define MPLEX_ATTACH_GEOM 0x0020 /* geometry field is set */
36 #define MPLEX_ATTACH_SIZEPOLICY 0x0040 /* size policy field is set */
37 #define MPLEX_ATTACH_INDEX 0x0080 /* index field is set */
38 #define MPLEX_ATTACH_WHATEVER 0x0100 /* set REGION_FIT_WHATEVER */
42 MPLEX_CHANGE_SWITCHONLY=0,
43 MPLEX_CHANGE_REORDER=1,
57 INTRSTRUCT(WMPlexSTDispInfo);
58 INTRSTRUCT(WMPlexChangedParams);
59 INTRSTRUCT(WMPlexAttachParams);
62 DECLSTRUCT(WMPlexSTDispInfo){
68 DECLSTRUCT(WMPlexChangedParams){
76 #define MPLEXATTACHPARAMS_INIT {0, 0, {0, 0, 0, 0}, 0, 0}
78 DECLSTRUCT(WMPlexAttachParams){
94 WLListNode *mx_current;
96 WMPlexPHolder *mx_phs;
99 WMPlexSTDispInfo stdispinfo;
105 extern WMPlex *create_mplex(WWindow *parent, const WFitParams *fp);
106 extern bool mplex_init(WMPlex *mplex, WWindow *parent,
107 const WFitParams *fp);
108 extern bool mplex_do_init(WMPlex *mplex, WWindow *parent,
109 const WFitParams *fp, Window win);
110 extern void mplex_deinit(WMPlex *mplex);
112 /* Resize and reparent */
114 extern bool mplex_fitrep(WMPlex *mplex, WWindow *par, const WFitParams *fp);
115 extern void mplex_do_fit_managed(WMPlex *mplex, WFitParams *fp);
116 extern void mplex_fit_managed(WMPlex *mplex);
120 extern void mplex_map(WMPlex *mplex);
121 extern void mplex_unmap(WMPlex *mplex);
125 extern WRegion *mplex_attach_simple(WMPlex *mplex, WRegion *reg,
128 extern WRegion *mplex_attach(WMPlex *mplex, WRegion *reg, ExtlTab param);
129 extern WRegion *mplex_attach_new_(WMPlex *mplex, WMPlexAttachParams *partmpl,
130 int mask, ExtlTab param);
131 extern WRegion *mplex_attach_new(WMPlex *mplex, ExtlTab param);
133 extern WRegion *mplex_do_attach_pholder(WMPlex *mplex, WMPlexPHolder *ph,
134 WRegionAttachData *data);
135 extern WRegion *mplex_do_attach(WMPlex *mplex, WMPlexAttachParams *param,
136 WRegionAttachData *data);
137 extern WRegion *mplex_do_attach_new(WMPlex *mplex, WMPlexAttachParams *param,
138 WRegionCreateFn *fn, void *fn_param);
140 extern void mplex_managed_remove(WMPlex *mplex, WRegion *reg);
141 extern void mplex_child_removed(WMPlex *mplex, WRegion *sub);
143 extern bool mplex_rescue_clientwins(WMPlex *mplex, WRescueInfo *info);
145 extern WPHolder *mplex_prepare_manage(WMPlex *mplex, const WClientWin *cwin,
146 const WManageParams *param, int redir);
150 extern bool mplex_managed_prepare_focus(WMPlex *mplex, WRegion *sub,
151 int flags, WPrepareFocusResult *res);
152 extern bool mplex_do_prepare_focus(WMPlex *mplex, WStacking *disp,
153 WStacking *sub, int flags,
154 WPrepareFocusResult *res);
156 extern void mplex_switch_nth(WMPlex *mplex, uint n);
157 extern void mplex_switch_next(WMPlex *mplex);
158 extern void mplex_switch_prev(WMPlex *mplex);
159 extern bool mplex_is_hidden(WMPlex *mplex, WRegion *reg);
160 extern bool mplex_set_hidden(WMPlex *mplex, WRegion *reg, int sp);
164 extern void mplex_do_set_focus(WMPlex *mplex, bool warp);
168 extern bool mplex_managed_rqorder(WMPlex *mplex, WRegion *sub,
173 extern WRegion *mplex_current(WMPlex *mplex);
175 extern bool mplex_managed_i(WMPlex *mplex, ExtlFn iterfn);
177 extern int mplex_mx_count(WMPlex *mplex);
178 extern WRegion *mplex_mx_nth(WMPlex *mplex, uint n);
179 extern bool mplex_mx_i(WMPlex *mplex, ExtlFn iterfn);
180 extern WRegion *mplex_mx_current(WMPlex *mplex);
182 extern void mplex_call_changed_hook(WMPlex *mplex, WHook *hook,
183 int mode, bool sw, WRegion *reg);
185 extern void mplex_remanage_stdisp(WMPlex *mplex);
189 DYNFUN void mplex_managed_geom(const WMPlex *mplex, WRectangle *geom);
190 DYNFUN void mplex_size_changed(WMPlex *mplex, bool wchg, bool hchg);
191 DYNFUN void mplex_managed_changed(WMPlex *mplex, int what, bool sw,
193 DYNFUN int mplex_default_index(WMPlex *mplex);
197 extern ExtlTab mplex_get_configuration(WMPlex *mplex);
198 extern WRegion *mplex_load(WWindow *par, const WFitParams *fp, ExtlTab tab);
199 extern void mplex_load_contents(WMPlex *frame, ExtlTab tab);
202 /* Sticky status display support */
204 extern bool mplex_set_stdisp(WMPlex *mplex, WRegion *stdisp,
205 const WMPlexSTDispInfo *info);
206 extern void mplex_get_stdisp(WMPlex *mplex, WRegion **stdisp,
207 WMPlexSTDispInfo *info);
209 extern WRegion *mplex_set_stdisp_extl(WMPlex *mplex, ExtlTab t);
210 extern ExtlTab mplex_get_stdisp_extl(WMPlex *mplex);
212 DYNFUN void region_manage_stdisp(WRegion *reg, WRegion *stdisp,
213 const WMPlexSTDispInfo *info);
214 DYNFUN void region_unmanage_stdisp(WRegion *reg, bool permanent, bool nofocus);
216 /* Stacking list stuff */
218 typedef WStackingIterTmp WMPlexIterTmp;
220 extern void mplex_iter_init(WMPlexIterTmp *tmp, WMPlex *ws);
221 extern WRegion *mplex_iter(WMPlexIterTmp *tmp);
222 extern WStacking *mplex_iter_nodes(WMPlexIterTmp *tmp);
224 extern WStacking *mplex_get_stacking(WMPlex *ws);
225 extern WStacking **mplex_get_stackingp(WMPlex *ws);
227 #define FOR_ALL_MANAGED_BY_MPLEX(MPLEX, VAR, TMP) \
228 for(mplex_iter_init(&(TMP), MPLEX), \
229 VAR=mplex_iter(&(TMP)); \
231 VAR=mplex_iter(&(TMP)))
233 #define FOR_ALL_NODES_IN_MPLEX(MPLEX, VAR, TMP) \
234 for(mplex_iter_init(&(TMP), MPLEX), \
235 VAR=mplex_iter_nodes(&(TMP)); \
237 VAR=mplex_iter_nodes(&(TMP)))
239 extern WStacking *mplex_find_stacking(WMPlex *mplex, WRegion *reg);
241 #endif /* ION_IONCORE_MPLEX_H */