Imported Upstream version 1.15.1
[deb_xorg-server.git] / include / windowstr.h
CommitLineData
a09e091a
JB
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27 All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46
47#ifndef WINDOWSTRUCT_H
48#define WINDOWSTRUCT_H
49
50#include "window.h"
51#include "pixmapstr.h"
52#include "regionstr.h"
53#include "cursor.h"
54#include "property.h"
55#include "resource.h" /* for ROOT_WINDOW_ID_BASE */
56#include "dix.h"
57#include "privates.h"
58#include "miscstruct.h"
59#include <X11/Xprotostr.h>
60#include "opaque.h"
61
62#define GuaranteeNothing 0
63#define GuaranteeVisBack 1
64
65#define SameBackground(as, a, bs, b) \
66 ((as) == (bs) && ((as) == None || \
67 (as) == ParentRelative || \
68 SamePixUnion(a,b,as == BackgroundPixel)))
69
70#define SameBorder(as, a, bs, b) \
71 EqualPixUnion(as, a, bs, b)
72
73/* used as NULL-terminated list */
74typedef struct _DevCursorNode {
75 CursorPtr cursor;
76 DeviceIntPtr dev;
77 struct _DevCursorNode *next;
78} DevCursNodeRec, *DevCursNodePtr, *DevCursorList;
79
80typedef struct _WindowOpt {
81 CursorPtr cursor; /* default: window.cursorNone */
82 VisualID visual; /* default: same as parent */
83 Colormap colormap; /* default: same as parent */
84 Mask dontPropagateMask; /* default: window.dontPropagate */
85 Mask otherEventMasks; /* default: 0 */
86 struct _OtherClients *otherClients; /* default: NULL */
87 struct _GrabRec *passiveGrabs; /* default: NULL */
88 PropertyPtr userProps; /* default: NULL */
89 CARD32 backingBitPlanes; /* default: ~0L */
90 CARD32 backingPixel; /* default: 0 */
91 RegionPtr boundingShape; /* default: NULL */
92 RegionPtr clipShape; /* default: NULL */
93 RegionPtr inputShape; /* default: NULL */
94 struct _OtherInputMasks *inputMasks; /* default: NULL */
95 DevCursorList deviceCursors; /* default: NULL */
96} WindowOptRec, *WindowOptPtr;
97
98#define BackgroundPixel 2L
99#define BackgroundPixmap 3L
100
101/*
102 * The redirectDraw field can have one of three values:
103 *
104 * RedirectDrawNone
105 * A normal window; painted into the same pixmap as the parent
106 * and clipping parent and siblings to its geometry. These
107 * windows get a clip list equal to the intersection of their
108 * geometry with the parent geometry, minus the geometry
109 * of overlapping None and Clipped siblings.
110 * RedirectDrawAutomatic
111 * A redirected window which clips parent and sibling drawing.
112 * Contents for these windows are manage inside the server.
113 * These windows get an internal clip list equal to their
114 * geometry.
115 * RedirectDrawManual
116 * A redirected window which does not clip parent and sibling
117 * drawing; the window must be represented within the parent
118 * geometry by the client performing the redirection management.
119 * Contents for these windows are managed outside the server.
120 * These windows get an internal clip list equal to their
121 * geometry.
122 */
123
124#define RedirectDrawNone 0
125#define RedirectDrawAutomatic 1
126#define RedirectDrawManual 2
127
128typedef struct _Window {
129 DrawableRec drawable;
130 PrivateRec *devPrivates;
131 WindowPtr parent; /* ancestor chain */
132 WindowPtr nextSib; /* next lower sibling */
133 WindowPtr prevSib; /* next higher sibling */
134 WindowPtr firstChild; /* top-most child */
135 WindowPtr lastChild; /* bottom-most child */
136 RegionRec clipList; /* clipping rectangle for output */
137 RegionRec borderClip; /* NotClippedByChildren + border */
138 union _Validate *valdata;
139 RegionRec winSize;
140 RegionRec borderSize;
141 DDXPointRec origin; /* position relative to parent */
142 unsigned short borderWidth;
143 unsigned short deliverableEvents; /* all masks from all clients */
144 Mask eventMask; /* mask from the creating client */
145 PixUnion background;
146 PixUnion border;
147 pointer backStorage; /* null when BS disabled */
148 WindowOptPtr optional;
149 unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */
150 unsigned borderIsPixel:1;
151 unsigned cursorIsNone:1; /* else real cursor (might inherit) */
152 unsigned backingStore:2;
153 unsigned saveUnder:1;
154 unsigned DIXsaveUnder:1;
155 unsigned bitGravity:4;
156 unsigned winGravity:4;
157 unsigned overrideRedirect:1;
158 unsigned visibility:2;
159 unsigned mapped:1;
160 unsigned realized:1; /* ancestors are all mapped */
161 unsigned viewable:1; /* realized && InputOutput */
162 unsigned dontPropagate:3; /* index into DontPropagateMasks */
163 unsigned forcedBS:1; /* system-supplied backingStore */
164 unsigned redirectDraw:2; /* COMPOSITE rendering redirect */
165 unsigned forcedBG:1; /* must have an opaque background */
166#ifdef ROOTLESS
167 unsigned rootlessUnhittable:1; /* doesn't hit-test */
168#endif
169#ifdef COMPOSITE
170 unsigned damagedDescendants:1; /* some descendants are damaged */
171 unsigned inhibitBGPaint:1; /* paint the background? */
172#endif
173} WindowRec;
174
175/*
176 * Ok, a bunch of macros for accessing the optional record
177 * fields (or filling the appropriate default value)
178 */
179
180extern _X_EXPORT Mask DontPropagateMasks[];
181
182#define wTrackParent(w,field) ((w)->optional ? \
183 (w)->optional->field \
184 : FindWindowWithOptional(w)->optional->field)
185#define wUseDefault(w,field,def) ((w)->optional ? \
186 (w)->optional->field \
187 : def)
188
189#define wVisual(w) wTrackParent(w, visual)
190#define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor))
191#define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap))
192#define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate])
193#define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0)
194#define wOtherClients(w) wUseDefault(w, otherClients, NULL)
195#define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL)
196#define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL)
197#define wUserProps(w) wUseDefault(w, userProps, NULL)
198#define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L)
199#define wBackingPixel(w) wUseDefault(w, backingPixel, 0)
200#define wBoundingShape(w) wUseDefault(w, boundingShape, NULL)
201#define wClipShape(w) wUseDefault(w, clipShape, NULL)
202#define wInputShape(w) wUseDefault(w, inputShape, NULL)
203#define wClient(w) (clients[CLIENT_ID((w)->drawable.id)])
204#define wBorderWidth(w) ((int) (w)->borderWidth)
205
206/* true when w needs a border drawn. */
207
208#define HasBorder(w) ((w)->borderWidth || wClipShape(w))
209
210typedef struct _ScreenSaverStuff *ScreenSaverStuffPtr;
211
212#define SCREEN_IS_BLANKED 0
213#define SCREEN_ISNT_SAVED 1
214#define SCREEN_IS_TILED 2
215#define SCREEN_IS_BLACK 3
216
217#define HasSaverWindow(pScreen) (pScreen->screensaver.pWindow != NullWindow)
218
219extern _X_EXPORT int screenIsSaved;
220
221#endif /* WINDOWSTRUCT_H */