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_IONCORE_MPLEX_H
13 #define ION_IONCORE_MPLEX_H
15 #include <libextl/extl.h>
16 #include <libmainloop/hooks.h>
21 #include "rectangle.h"
23 #include "sizepolicy.h"
26 #define MPLEX_ADD_TO_END 0x0001
27 #define MPLEX_MANAGED_UNVIEWABLE 0x0002
29 #define MPLEX_MGD_UNVIEWABLE(MPLEX) \
30 ((MPLEX)->flags&MPLEX_MANAGED_UNVIEWABLE)
33 #define MPLEX_ATTACH_SWITCHTO 0x0001 /* switch to region */
34 #define MPLEX_ATTACH_UNNUMBERED 0x0002 /* do not put on mut.ex list */
35 #define MPLEX_ATTACH_HIDDEN 0x0004 /* should be hidden */
36 #define MPLEX_ATTACH_MODAL 0x0008 /* shortcut.. */
37 #define MPLEX_ATTACH_LEVEL 0x0010 /* level field set */
38 #define MPLEX_ATTACH_GEOM 0x0020 /* geometry field is set */
39 #define MPLEX_ATTACH_SIZEPOLICY 0x0040 /* size policy field is set */
40 #define MPLEX_ATTACH_INDEX 0x0080 /* index field is set */
41 #define MPLEX_ATTACH_WHATEVER 0x0100 /* set REGION_FIT_WHATEVER */
45 MPLEX_CHANGE_SWITCHONLY=0,
46 MPLEX_CHANGE_REORDER=1,
60 INTRSTRUCT(WMPlexSTDispInfo);
61 INTRSTRUCT(WMPlexChangedParams);
62 INTRSTRUCT(WMPlexAttachParams);
65 DECLSTRUCT(WMPlexSTDispInfo){
71 DECLSTRUCT(WMPlexChangedParams){
79 #define MPLEXATTACHPARAMS_INIT {0, 0, {0, 0, 0, 0}, 0, 0}
81 DECLSTRUCT(WMPlexAttachParams){
97 WLListNode *mx_current;
99 WMPlexPHolder *mx_phs;
102 WMPlexSTDispInfo stdispinfo;
108 extern WMPlex *create_mplex(WWindow *parent, const WFitParams *fp);
109 extern bool mplex_init(WMPlex *mplex, WWindow *parent,
110 const WFitParams *fp);
111 extern bool mplex_do_init(WMPlex *mplex, WWindow *parent,
112 const WFitParams *fp, Window win);
113 extern void mplex_deinit(WMPlex *mplex);
115 /* Resize and reparent */
117 extern bool mplex_fitrep(WMPlex *mplex, WWindow *par, const WFitParams *fp);
118 extern void mplex_do_fit_managed(WMPlex *mplex, WFitParams *fp);
119 extern void mplex_fit_managed(WMPlex *mplex);
123 extern void mplex_map(WMPlex *mplex);
124 extern void mplex_unmap(WMPlex *mplex);
128 extern WRegion *mplex_attach_simple(WMPlex *mplex, WRegion *reg,
131 extern WRegion *mplex_attach(WMPlex *mplex, WRegion *reg, ExtlTab param);
132 extern WRegion *mplex_attach_new_(WMPlex *mplex, WMPlexAttachParams *partmpl,
133 int mask, ExtlTab param);
134 extern WRegion *mplex_attach_new(WMPlex *mplex, ExtlTab param);
136 extern WRegion *mplex_do_attach_pholder(WMPlex *mplex, WMPlexPHolder *ph,
137 WRegionAttachData *data);
138 extern WRegion *mplex_do_attach(WMPlex *mplex, WMPlexAttachParams *param,
139 WRegionAttachData *data);
140 extern WRegion *mplex_do_attach_new(WMPlex *mplex, WMPlexAttachParams *param,
141 WRegionCreateFn *fn, void *fn_param);
143 extern void mplex_managed_remove(WMPlex *mplex, WRegion *reg);
144 extern void mplex_child_removed(WMPlex *mplex, WRegion *sub);
146 extern bool mplex_rescue_clientwins(WMPlex *mplex, WRescueInfo *info);
148 extern WPHolder *mplex_prepare_manage(WMPlex *mplex, const WClientWin *cwin,
149 const WManageParams *param, int redir);
153 extern bool mplex_managed_prepare_focus(WMPlex *mplex, WRegion *sub,
154 int flags, WPrepareFocusResult *res);
155 extern bool mplex_do_prepare_focus(WMPlex *mplex, WStacking *disp,
156 WStacking *sub, int flags,
157 WPrepareFocusResult *res);
159 extern void mplex_switch_nth(WMPlex *mplex, uint n);
160 extern void mplex_switch_next(WMPlex *mplex);
161 extern void mplex_switch_prev(WMPlex *mplex);
162 extern bool mplex_is_hidden(WMPlex *mplex, WRegion *reg);
163 extern bool mplex_set_hidden(WMPlex *mplex, WRegion *reg, int sp);
167 extern void mplex_do_set_focus(WMPlex *mplex, bool warp);
171 extern bool mplex_managed_rqorder(WMPlex *mplex, WRegion *sub,
176 extern WRegion *mplex_current(WMPlex *mplex);
178 extern bool mplex_managed_i(WMPlex *mplex, ExtlFn iterfn);
180 extern int mplex_mx_count(WMPlex *mplex);
181 extern WRegion *mplex_mx_nth(WMPlex *mplex, uint n);
182 extern bool mplex_mx_i(WMPlex *mplex, ExtlFn iterfn);
183 extern WRegion *mplex_mx_current(WMPlex *mplex);
185 extern void mplex_call_changed_hook(WMPlex *mplex, WHook *hook,
186 int mode, bool sw, WRegion *reg);
188 extern void mplex_remanage_stdisp(WMPlex *mplex);
192 DYNFUN void mplex_managed_geom(const WMPlex *mplex, WRectangle *geom);
193 DYNFUN void mplex_size_changed(WMPlex *mplex, bool wchg, bool hchg);
194 DYNFUN void mplex_managed_changed(WMPlex *mplex, int what, bool sw,
196 DYNFUN int mplex_default_index(WMPlex *mplex);
200 extern ExtlTab mplex_get_configuration(WMPlex *mplex);
201 extern WRegion *mplex_load(WWindow *par, const WFitParams *fp, ExtlTab tab);
202 extern void mplex_load_contents(WMPlex *frame, ExtlTab tab);
205 /* Sticky status display support */
207 extern bool mplex_set_stdisp(WMPlex *mplex, WRegion *stdisp,
208 const WMPlexSTDispInfo *info);
209 extern void mplex_get_stdisp(WMPlex *mplex, WRegion **stdisp,
210 WMPlexSTDispInfo *info);
212 extern WRegion *mplex_set_stdisp_extl(WMPlex *mplex, ExtlTab t);
213 extern ExtlTab mplex_get_stdisp_extl(WMPlex *mplex);
215 DYNFUN void region_manage_stdisp(WRegion *reg, WRegion *stdisp,
216 const WMPlexSTDispInfo *info);
217 DYNFUN void region_unmanage_stdisp(WRegion *reg, bool permanent, bool nofocus);
219 /* Stacking list stuff */
221 typedef WStackingIterTmp WMPlexIterTmp;
223 extern void mplex_iter_init(WMPlexIterTmp *tmp, WMPlex *ws);
224 extern WRegion *mplex_iter(WMPlexIterTmp *tmp);
225 extern WStacking *mplex_iter_nodes(WMPlexIterTmp *tmp);
227 extern WStacking *mplex_get_stacking(WMPlex *ws);
228 extern WStacking **mplex_get_stackingp(WMPlex *ws);
230 #define FOR_ALL_MANAGED_BY_MPLEX(MPLEX, VAR, TMP) \
231 for(mplex_iter_init(&(TMP), MPLEX), \
232 VAR=mplex_iter(&(TMP)); \
234 VAR=mplex_iter(&(TMP)))
236 #define FOR_ALL_NODES_IN_MPLEX(MPLEX, VAR, TMP) \
237 for(mplex_iter_init(&(TMP), MPLEX), \
238 VAR=mplex_iter_nodes(&(TMP)); \
240 VAR=mplex_iter_nodes(&(TMP)))
242 extern WStacking *mplex_find_stacking(WMPlex *mplex, WRegion *reg);
244 #endif /* ION_IONCORE_MPLEX_H */