Add comments to fork() logic for readibility
[notion/jeffpc.git] / ioncore / manage.h
blobba5473740e1fbdec47e2909c803813777e194a8a
1 /*
2 * ion/ioncore/manage.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_IONCORE_MANAGE_H
10 #define ION_IONCORE_MANAGE_H
12 #include <libextl/extl.h>
13 #include "common.h"
15 INTRSTRUCT(WManageParams);
17 #include "clientwin.h"
18 #include "attach.h"
19 #include "rectangle.h"
20 #include "extlconv.h"
21 #include "pholder.h"
24 #define MANAGEPARAMS_INIT \
25 {FALSE, FALSE, FALSE, FALSE, FALSE, ForgetGravity, {0, 0, 0, 0}, NULL}
27 enum{
28 MANAGE_PRIORITY_NONE,
29 MANAGE_PRIORITY_LOW,
30 MANAGE_PRIORITY_NORMAL,
31 MANAGE_PRIORITY_GROUP,
32 MANAGE_PRIORITY_NO,
33 /* Special */
34 MANAGE_PRIORITY_NOREDIR
37 #define MANAGE_PRIORITY_OK(PRIORITY, OUR) \
38 ((PRIORITY) <= (OUR) || (PRIORITY)==MANAGE_PRIORITY_NOREDIR)
40 #define MANAGE_PRIORITY_SUB(PRIORITY, OUR) \
41 ((PRIORITY)==MANAGE_PRIORITY_NOREDIR \
42 ? MANAGE_PRIORITY_NO \
43 : (PRIORITY) < (OUR) ? (OUR) : (PRIORITY))
45 #define MANAGE_PRIORITY_SUBX(PRIORITY, OUR) \
46 ((PRIORITY)==MANAGE_PRIORITY_NOREDIR || (OUR) < (PRIORITY) \
47 ? MANAGE_PRIORITY_NO \
48 : MANAGE_PRIORITY_NONE)
51 DECLSTRUCT(WManageParams){
52 bool switchto;
53 bool jumpto;
54 bool userpos;
55 bool dockapp;
56 bool maprq;
57 int gravity;
58 WRectangle geom;
59 WClientWin *tfor;
63 typedef WRegion *WRegionIterator(void *st);
66 extern ExtlTab manageparams_to_table(const WManageParams *mp);
69 extern WScreen *clientwin_find_suitable_screen(WClientWin *cwin,
70 const WManageParams *param);
72 /* Manage */
74 extern bool clientwin_do_manage_default(WClientWin *cwin,
75 const WManageParams *param);
77 extern bool region_manage_clientwin(WRegion *reg, WClientWin *cwin,
78 const WManageParams *par, int redir);
80 DYNFUN WPHolder *region_prepare_manage(WRegion *reg, const WClientWin *cwin,
81 const WManageParams *par, int redir);
83 extern WPHolder *region_prepare_manage_default(WRegion *reg,
84 const WClientWin *cwin,
85 const WManageParams *par,
86 int redir);
89 extern WPHolder *region_prepare_manage_transient(WRegion *reg,
90 const WClientWin *cwin,
91 const WManageParams *param,
92 int unused);
94 extern WPHolder *region_prepare_manage_transient_default(WRegion *reg,
95 const WClientWin *cwin,
96 const WManageParams *param,
97 int unused);
99 /* Rescue */
101 #define REGION_RESCUE_PHFLAGS_OK 0x01
102 #define REGION_RESCUE_NODEEP 0x02
104 INTRSTRUCT(WRescueInfo);
106 extern WPHolder *rescueinfo_pholder(WRescueInfo *info);
108 /* if ph is given, it is used, otherwise one is looked for when needed */
109 extern bool region_rescue(WRegion *reg, WPHolder *ph, int flags);
110 extern bool region_rescue_needed(WRegion *reg);
111 extern bool region_rescue_clientwins(WRegion *reg, WRescueInfo *info);
112 extern bool region_rescue_child_clientwins(WRegion *reg, WRescueInfo *info);
113 extern bool region_rescue_some_clientwins(WRegion *reg, WRescueInfo *info,
114 WRegionIterator *iter, void *st);
115 extern bool region_do_rescue_this(WRegion *tosave, WRescueInfo *info, int ph_flags);
118 #endif /* ION_IONCORE_MANAGE_H */