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