4 * Copyright (c) Tuomo Valkonen 1999-2006.
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_REGION_H
13 #define ION_IONCORE_REGION_H
15 #include <libtu/obj.h>
16 #include <libmainloop/hooks.h>
18 #include "rectangle.h"
20 #define REGION_MAPPED 0x0001
21 #define REGION_ACTIVE 0x0002
22 #define REGION_HAS_GRABS 0x0004
23 #define REGION_TAGGED 0x0008
24 #define REGION_BINDINGS_ARE_GRABBED 0x0020
25 #define REGION_GRAB_ON_PARENT 0x0040
26 #define REGION_ACTIVITY 0x0100
27 #define REGION_SKIP_FOCUS 0x0200
28 #define REGION_CWINS_BEING_RESCUED 0x0400
29 #define REGION_PLEASE_WARP 0x0800
30 #define REGION_BINDING_UPDATE_SCHEDULED 0x1000
32 #define REGION_GOTO_FOCUS 0x0001
33 #define REGION_GOTO_NOWARP 0x0002
34 #define REGION_GOTO_ENTERWINDOW 0x0004
36 /* Use region_is_fully_mapped instead for most cases. */
37 #define REGION_IS_MAPPED(R) (((WRegion*)(R))->flags®ION_MAPPED)
38 #define REGION_MARK_MAPPED(R) (((WRegion*)(R))->flags|=REGION_MAPPED)
39 #define REGION_MARK_UNMAPPED(R) (((WRegion*)(R))->flags&=~REGION_MAPPED)
40 #define REGION_IS_ACTIVE(R) (((WRegion*)(R))->flags®ION_ACTIVE)
41 #define REGION_IS_TAGGED(R) (((WRegion*)(R))->flags®ION_TAGGED)
42 #define REGION_IS_URGENT(R) (((WRegion*)(R))->flags®ION_URGENT)
43 #define REGION_GEOM(R) (((WRegion*)(R))->geom)
44 #define REGION_ACTIVE_SUB(R) (((WRegion*)(R))->active_sub)
46 #define REGION_MANAGER(R) (((WRegion*)(R))->manager)
47 #define REGION_MANAGER_CHK(R, TYPE) OBJ_CAST(REGION_MANAGER(R), TYPE)
49 #define REGION_PARENT(REG) (((WRegion*)(REG))->parent)
50 #define REGION_PARENT_REG(REG) ((WRegion*)REGION_PARENT(REG))
52 #define REGION_FIT_BOUNDS 0x0001 /* Geometry is maximum bounds */
53 #define REGION_FIT_ROTATE 0x0002 /* for Xrandr */
54 #define REGION_FIT_WHATEVER 0x0004 /* for attach routines; g is not final */
55 #define REGION_FIT_GRAVITY 0x0008 /* just a hint; for use with BOUNDS */
56 #define REGION_FIT_EXACT 0x0000 /* No flags; exact fit */
59 typedef int WRegionFitMode;
68 INTRSTRUCT(WFitParams);
69 DECLSTRUCT(WFitParams){
77 INTRSTRUCT(WRegionNameInfo);
78 DECLSTRUCT(WRegionNameInfo){
85 INTRSTRUCT(WPrepareFocusResult);
86 DECLSTRUCT(WPrepareFocusResult){
101 WRegion *p_next, *p_prev;
104 WSubmapState *submapstat;
107 WRegion *active_prev, *active_next;
119 extern void region_init(WRegion *reg, WWindow *par, const WFitParams *fp);
120 extern void region_deinit(WRegion *reg);
122 DYNFUN bool region_fitrep(WRegion *reg, WWindow *par, const WFitParams *fp);
123 DYNFUN void region_map(WRegion *reg);
124 DYNFUN void region_unmap(WRegion *reg);
125 DYNFUN Window region_xwindow(const WRegion *reg);
126 DYNFUN void region_activated(WRegion *reg);
127 DYNFUN void region_inactivated(WRegion *reg);
128 DYNFUN void region_updategr(WRegion *reg);
129 DYNFUN bool region_rqclose(WRegion *reg, bool relocate);
130 DYNFUN WRegion *region_rqclose_propagate(WRegion *reg, WRegion *maybe_sub);
131 DYNFUN WRegion *region_current(WRegion *mgr);
132 DYNFUN void region_notify_rootpos(WRegion *reg, int x, int y);
133 DYNFUN bool region_may_destroy(WRegion *reg);
134 DYNFUN WRegion *region_managed_control_focus(WRegion *mgr, WRegion *reg);
135 DYNFUN void region_managed_remove(WRegion *reg, WRegion *sub);
136 DYNFUN bool region_managed_prepare_focus(WRegion *reg, WRegion *sub,
137 int flags, WPrepareFocusResult *res);
138 DYNFUN void region_managed_activated(WRegion *reg, WRegion *sub);
139 DYNFUN void region_managed_inactivated(WRegion *reg, WRegion *sub);
140 DYNFUN void region_managed_notify(WRegion *reg, WRegion *sub, const char *how);
141 DYNFUN bool region_managed_may_destroy(WRegion *mgr, WRegion *reg);
142 DYNFUN bool region_managed_rqorder(WRegion *reg, WRegion *sub,
145 DYNFUN void region_child_removed(WRegion *reg, WRegion *sub);
147 DYNFUN void region_restack(WRegion *reg, Window other, int mode);
148 DYNFUN void region_stacking(WRegion *reg, Window *bottomret, Window *topret);
150 DYNFUN bool region_handle_drop(WRegion *reg, int x, int y, WRegion *dropped);
152 extern bool region_rqorder(WRegion *reg, WRegionOrder order);
154 extern bool region_prepare_focus(WRegion *reg, int flags,
155 WPrepareFocusResult *res);
157 extern void region_fit(WRegion *reg, const WRectangle *geom,
158 WRegionFitMode mode);
159 extern bool region_reparent(WRegion *reg, WWindow *target,
160 const WRectangle *geom, WRegionFitMode mode);
162 extern void region_updategr_default(WRegion *reg);
164 extern void region_rootpos(WRegion *reg, int *xret, int *yret);
165 extern void region_notify_change(WRegion *reg, const char *how);
167 extern bool region_goto(WRegion *reg);
168 extern bool region_goto_flags(WRegion *reg, int flags);
170 extern bool region_is_fully_mapped(WRegion *reg);
172 extern void region_detach_manager(WRegion *reg);
174 extern WWindow *region_parent(WRegion *reg);
175 extern WRegion *region_manager(WRegion *reg);
176 extern WRegion *region_manager_or_parent(WRegion *reg);
177 extern void region_set_parent(WRegion *reg, WWindow *par);
178 extern void region_set_manager(WRegion *reg, WRegion *mgr);
179 extern void region_unset_manager(WRegion *reg, WRegion *mgr);
180 extern void region_unset_parent(WRegion *reg);
182 extern WRootWin *region_rootwin_of(const WRegion *reg);
183 extern Window region_root_of(const WRegion *reg);
184 extern WScreen *region_screen_of(WRegion *reg);
185 extern bool region_same_rootwin(const WRegion *reg1, const WRegion *reg2);
187 extern bool region_manager_allows_destroying(WRegion *reg);
189 extern WRegion *region_managed_within(WRegion *reg, WRegion *mgd);
191 extern WHook *region_notify_hook;
193 #endif /* ION_IONCORE_REGION_H */