]> git.decadent.org.uk Git - ion3.git/blob - ioncore/manage.h
3db5a1f9a06363f0b7705a1e6757a58dbf76c9d4
[ion3.git] / ioncore / manage.h
1 /*
2  * ion/ioncore/manage.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2008. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_IONCORE_MANAGE_H
10 #define ION_IONCORE_MANAGE_H
11
12 #include <libextl/extl.h>
13 #include "common.h"
14
15 INTRSTRUCT(WManageParams);
16
17 #include "clientwin.h"
18 #include "attach.h"
19 #include "rectangle.h"
20 #include "extlconv.h"
21 #include "pholder.h"
22
23
24 #define MANAGEPARAMS_INIT                                                \
25   {FALSE, FALSE, FALSE, FALSE, FALSE, ForgetGravity, {0, 0, 0, 0}, NULL}
26
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
35 };
36
37 #define MANAGE_PRIORITY_OK(PRIORITY, OUR)                        \
38     ((PRIORITY) <= (OUR) || (PRIORITY)==MANAGE_PRIORITY_NOREDIR)
39
40 #define MANAGE_PRIORITY_SUB(PRIORITY, OUR)      \
41     ((PRIORITY)==MANAGE_PRIORITY_NOREDIR        \
42      ? MANAGE_PRIORITY_NO                       \
43      : (PRIORITY) < (OUR) ? (OUR) : (PRIORITY))
44
45 #define MANAGE_PRIORITY_SUBX(PRIORITY, OUR)                    \
46     ((PRIORITY)==MANAGE_PRIORITY_NOREDIR || (OUR) < (PRIORITY) \
47      ? MANAGE_PRIORITY_NO                                      \
48      : MANAGE_PRIORITY_NONE)
49
50
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;
60 };
61
62
63 typedef WRegion *WRegionIterator(void *st);
64
65
66 extern ExtlTab manageparams_to_table(const WManageParams *mp);
67
68
69 extern WScreen *clientwin_find_suitable_screen(WClientWin *cwin,
70                                                const WManageParams *param);
71
72 /* Manage */
73
74 extern bool clientwin_do_manage_default(WClientWin *cwin,
75                                         const WManageParams *param);
76
77 extern bool region_manage_clientwin(WRegion *reg, WClientWin *cwin,
78                                     const WManageParams *par, int redir);
79
80 DYNFUN WPHolder *region_prepare_manage(WRegion *reg, const WClientWin *cwin,
81                                        const WManageParams *par, int redir);
82
83 extern WPHolder *region_prepare_manage_default(WRegion *reg, 
84                                                const WClientWin *cwin,
85                                                const WManageParams *par, 
86                                                int redir);
87
88
89 extern WPHolder *region_prepare_manage_transient(WRegion *reg, 
90                                                  const WClientWin *cwin,
91                                                  const WManageParams *param,
92                                                  int unused);
93
94 extern WPHolder *region_prepare_manage_transient_default(WRegion *reg, 
95                                                          const WClientWin *cwin,
96                                                          const WManageParams *param,
97                                                          int unused);
98
99 /* Rescue */
100
101 #define REGION_RESCUE_PHFLAGS_OK 0x01
102 #define REGION_RESCUE_NODEEP     0x02
103
104 INTRSTRUCT(WRescueInfo);
105
106 extern WPHolder *rescueinfo_pholder(WRescueInfo *info);
107
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);
116
117
118 #endif /* ION_IONCORE_MANAGE_H */