windowstr.h revision 4642e01f
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 25 26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 27 28 All Rights Reserved 29 30Permission to use, copy, modify, and distribute this software and its 31documentation for any purpose and without fee is hereby granted, 32provided that the above copyright notice appear in all copies and that 33both that copyright notice and this permission notice appear in 34supporting documentation, and that the name of Digital not be 35used in advertising or publicity pertaining to distribution of the 36software without specific, written prior permission. 37 38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44SOFTWARE. 45 46******************************************************************/ 47 48#ifndef WINDOWSTRUCT_H 49#define WINDOWSTRUCT_H 50 51#include "window.h" 52#include "pixmapstr.h" 53#include "regionstr.h" 54#include "cursor.h" 55#include "property.h" 56#include "resource.h" /* for ROOT_WINDOW_ID_BASE */ 57#include "dix.h" 58#include "privates.h" 59#include "miscstruct.h" 60#include <X11/Xprotostr.h> 61#include "opaque.h" 62#include "inputstr.h" 63 64#define GuaranteeNothing 0 65#define GuaranteeVisBack 1 66 67#define SameBackground(as, a, bs, b) \ 68 ((as) == (bs) && ((as) == None || \ 69 (as) == ParentRelative || \ 70 SamePixUnion(a,b,as == BackgroundPixel))) 71 72#define SameBorder(as, a, bs, b) \ 73 EqualPixUnion(as, a, bs, b) 74 75/* used as NULL-terminated list */ 76typedef struct _DevCursorNode { 77 CursorPtr cursor; 78 DeviceIntPtr dev; 79 struct _DevCursorNode* next; 80} DevCursNodeRec, *DevCursNodePtr, *DevCursorList; 81 82/* Mask structure for GE extension as stored on the window. 83 * Allows one mask per extension. 84 * .eventMask - Summary mask for all clients, used for quick checking. 85 * .geClients - list of clients with their specific mask. 86 */ 87typedef struct _GenericClientMasks { 88 Mask eventMasks[MAXEXTENSIONS]; 89 GenericMaskPtr geClients; 90} GenericClientMasksRec, *GenericClientMasksPtr; 91 92typedef struct _WindowAccessRec { 93 int defaultRule; /* WindowAccessDenyAll */ 94 DeviceIntPtr* perm; 95 int nperm; 96 DeviceIntPtr* deny; 97 int ndeny; 98} WindowAccessRec, *WindowAccessPtr; 99 100typedef struct _WindowOpt { 101 VisualID visual; /* default: same as parent */ 102 CursorPtr cursor; /* default: window.cursorNone */ 103 Colormap colormap; /* default: same as parent */ 104 Mask dontPropagateMask; /* default: window.dontPropagate */ 105 Mask otherEventMasks; /* default: 0 */ 106 struct _OtherClients *otherClients; /* default: NULL */ 107 struct _GrabRec *passiveGrabs; /* default: NULL */ 108 PropertyPtr userProps; /* default: NULL */ 109 unsigned long backingBitPlanes; /* default: ~0L */ 110 unsigned long backingPixel; /* default: 0 */ 111 RegionPtr boundingShape; /* default: NULL */ 112 RegionPtr clipShape; /* default: NULL */ 113 RegionPtr inputShape; /* default: NULL */ 114 struct _OtherInputMasks *inputMasks; /* default: NULL */ 115 DevCursorList deviceCursors; /* default: NULL */ 116 struct _GenericClientMasks *geMasks; /* default: NULL */ 117 WindowAccessRec access; 118} WindowOptRec, *WindowOptPtr; 119 120#define BackgroundPixel 2L 121#define BackgroundPixmap 3L 122 123/* 124 * The redirectDraw field can have one of three values: 125 * 126 * RedirectDrawNone 127 * A normal window; painted into the same pixmap as the parent 128 * and clipping parent and siblings to its geometry. These 129 * windows get a clip list equal to the intersection of their 130 * geometry with the parent geometry, minus the geometry 131 * of overlapping None and Clipped siblings. 132 * RedirectDrawAutomatic 133 * A redirected window which clips parent and sibling drawing. 134 * Contents for these windows are manage inside the server. 135 * These windows get an internal clip list equal to their 136 * geometry. 137 * RedirectDrawManual 138 * A redirected window which does not clip parent and sibling 139 * drawing; the window must be represented within the parent 140 * geometry by the client performing the redirection management. 141 * Contents for these windows are managed outside the server. 142 * These windows get an internal clip list equal to their 143 * geometry. 144 */ 145 146#define RedirectDrawNone 0 147#define RedirectDrawAutomatic 1 148#define RedirectDrawManual 2 149 150typedef struct _Window { 151 DrawableRec drawable; 152 PrivateRec *devPrivates; 153 WindowPtr parent; /* ancestor chain */ 154 WindowPtr nextSib; /* next lower sibling */ 155 WindowPtr prevSib; /* next higher sibling */ 156 WindowPtr firstChild; /* top-most child */ 157 WindowPtr lastChild; /* bottom-most child */ 158 RegionRec clipList; /* clipping rectangle for output */ 159 RegionRec borderClip; /* NotClippedByChildren + border */ 160 union _Validate *valdata; 161 RegionRec winSize; 162 RegionRec borderSize; 163 DDXPointRec origin; /* position relative to parent */ 164 unsigned short borderWidth; 165 unsigned short deliverableEvents; 166 Mask eventMask; 167 PixUnion background; 168 PixUnion border; 169 pointer backStorage; /* null when BS disabled */ 170 WindowOptPtr optional; 171 unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ 172 unsigned borderIsPixel:1; 173 unsigned cursorIsNone:1; /* else real cursor (might inherit) */ 174 unsigned backingStore:2; 175 unsigned saveUnder:1; 176 unsigned DIXsaveUnder:1; 177 unsigned bitGravity:4; 178 unsigned winGravity:4; 179 unsigned overrideRedirect:1; 180 unsigned visibility:2; 181 unsigned mapped:1; 182 unsigned realized:1; /* ancestors are all mapped */ 183 unsigned viewable:1; /* realized && InputOutput */ 184 unsigned dontPropagate:3;/* index into DontPropagateMasks */ 185 unsigned forcedBS:1; /* system-supplied backingStore */ 186 unsigned redirectDraw:2; /* COMPOSITE rendering redirect */ 187 unsigned forcedBG:1; /* must have an opaque background */ 188#ifdef ROOTLESS 189 unsigned rootlessUnhittable:1; /* doesn't hit-test */ 190#endif 191} WindowRec; 192 193/* 194 * Ok, a bunch of macros for accessing the optional record 195 * fields (or filling the appropriate default value) 196 */ 197 198extern Mask DontPropagateMasks[]; 199 200#define wTrackParent(w,field) ((w)->optional ? \ 201 (w)->optional->field \ 202 : FindWindowWithOptional(w)->optional->field) 203#define wUseDefault(w,field,def) ((w)->optional ? \ 204 (w)->optional->field \ 205 : def) 206 207#define wVisual(w) wTrackParent(w, visual) 208#define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor)) 209#define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap)) 210#define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate]) 211#define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0) 212#define wOtherClients(w) wUseDefault(w, otherClients, NULL) 213#define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL) 214#define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL) 215#define wUserProps(w) wUseDefault(w, userProps, NULL) 216#define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L) 217#define wBackingPixel(w) wUseDefault(w, backingPixel, 0) 218#define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) 219#define wClipShape(w) wUseDefault(w, clipShape, NULL) 220#define wInputShape(w) wUseDefault(w, inputShape, NULL) 221#define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) 222#define wBorderWidth(w) ((int) (w)->borderWidth) 223 224/* true when w needs a border drawn. */ 225 226#define HasBorder(w) ((w)->borderWidth || wClipShape(w)) 227 228typedef struct _ScreenSaverStuff { 229 WindowPtr pWindow; 230 XID wid; 231 char blanked; 232 Bool (*ExternalScreenSaver)( 233 ScreenPtr /*pScreen*/, 234 int /*xstate*/, 235 Bool /*force*/); 236} ScreenSaverStuffRec, *ScreenSaverStuffPtr; 237 238#define SCREEN_IS_BLANKED 0 239#define SCREEN_ISNT_SAVED 1 240#define SCREEN_IS_TILED 2 241#define SCREEN_IS_BLACK 3 242 243#define HasSaverWindow(i) (savedScreenInfo[i].pWindow != NullWindow) 244 245extern int screenIsSaved; 246extern ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; 247 248#endif /* WINDOWSTRUCT_H */ 249