1706f2543Smrg/*********************************************************** 2706f2543Smrg 3706f2543SmrgCopyright 1987, 1998 The Open Group 4706f2543Smrg 5706f2543SmrgPermission to use, copy, modify, distribute, and sell this software and its 6706f2543Smrgdocumentation for any purpose is hereby granted without fee, provided that 7706f2543Smrgthe above copyright notice appear in all copies and that both that 8706f2543Smrgcopyright notice and this permission notice appear in supporting 9706f2543Smrgdocumentation. 10706f2543Smrg 11706f2543SmrgThe above copyright notice and this permission notice shall be included in 12706f2543Smrgall copies or substantial portions of the Software. 13706f2543Smrg 14706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15706f2543SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16706f2543SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17706f2543SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18706f2543SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19706f2543SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20706f2543Smrg 21706f2543SmrgExcept as contained in this notice, the name of The Open Group shall not be 22706f2543Smrgused in advertising or otherwise to promote the sale, use or other dealings 23706f2543Smrgin this Software without prior written authorization from The Open Group. 24706f2543Smrg 25706f2543Smrg 26706f2543SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 27706f2543Smrg 28706f2543Smrg All Rights Reserved 29706f2543Smrg 30706f2543SmrgPermission to use, copy, modify, and distribute this software and its 31706f2543Smrgdocumentation for any purpose and without fee is hereby granted, 32706f2543Smrgprovided that the above copyright notice appear in all copies and that 33706f2543Smrgboth that copyright notice and this permission notice appear in 34706f2543Smrgsupporting documentation, and that the name of Digital not be 35706f2543Smrgused in advertising or publicity pertaining to distribution of the 36706f2543Smrgsoftware without specific, written prior permission. 37706f2543Smrg 38706f2543SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 39706f2543SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 40706f2543SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 41706f2543SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42706f2543SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43706f2543SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44706f2543SmrgSOFTWARE. 45706f2543Smrg 46706f2543Smrg******************************************************************/ 47706f2543Smrg 48706f2543Smrg#ifndef WINDOWSTRUCT_H 49706f2543Smrg#define WINDOWSTRUCT_H 50706f2543Smrg 51706f2543Smrg#include "window.h" 52706f2543Smrg#include "pixmapstr.h" 53706f2543Smrg#include "regionstr.h" 54706f2543Smrg#include "cursor.h" 55706f2543Smrg#include "property.h" 56706f2543Smrg#include "resource.h" /* for ROOT_WINDOW_ID_BASE */ 57706f2543Smrg#include "dix.h" 58706f2543Smrg#include "privates.h" 59706f2543Smrg#include "miscstruct.h" 60706f2543Smrg#include <X11/Xprotostr.h> 61706f2543Smrg#include "opaque.h" 62706f2543Smrg 63706f2543Smrg#define GuaranteeNothing 0 64706f2543Smrg#define GuaranteeVisBack 1 65706f2543Smrg 66706f2543Smrg#define SameBackground(as, a, bs, b) \ 67706f2543Smrg ((as) == (bs) && ((as) == None || \ 68706f2543Smrg (as) == ParentRelative || \ 69706f2543Smrg SamePixUnion(a,b,as == BackgroundPixel))) 70706f2543Smrg 71706f2543Smrg#define SameBorder(as, a, bs, b) \ 72706f2543Smrg EqualPixUnion(as, a, bs, b) 73706f2543Smrg 74706f2543Smrg/* used as NULL-terminated list */ 75706f2543Smrgtypedef struct _DevCursorNode { 76706f2543Smrg CursorPtr cursor; 77706f2543Smrg DeviceIntPtr dev; 78706f2543Smrg struct _DevCursorNode* next; 79706f2543Smrg} DevCursNodeRec, *DevCursNodePtr, *DevCursorList; 80706f2543Smrg 81706f2543Smrgtypedef struct _WindowOpt { 82706f2543Smrg CursorPtr cursor; /* default: window.cursorNone */ 83706f2543Smrg VisualID visual; /* default: same as parent */ 84706f2543Smrg Colormap colormap; /* default: same as parent */ 85706f2543Smrg Mask dontPropagateMask; /* default: window.dontPropagate */ 86706f2543Smrg Mask otherEventMasks; /* default: 0 */ 87706f2543Smrg struct _OtherClients *otherClients; /* default: NULL */ 88706f2543Smrg struct _GrabRec *passiveGrabs; /* default: NULL */ 89706f2543Smrg PropertyPtr userProps; /* default: NULL */ 90706f2543Smrg unsigned long backingBitPlanes; /* default: ~0L */ 91706f2543Smrg unsigned long backingPixel; /* default: 0 */ 92706f2543Smrg RegionPtr boundingShape; /* default: NULL */ 93706f2543Smrg RegionPtr clipShape; /* default: NULL */ 94706f2543Smrg RegionPtr inputShape; /* default: NULL */ 95706f2543Smrg struct _OtherInputMasks *inputMasks; /* default: NULL */ 96706f2543Smrg DevCursorList deviceCursors; /* default: NULL */ 97706f2543Smrg} WindowOptRec, *WindowOptPtr; 98706f2543Smrg 99706f2543Smrg#define BackgroundPixel 2L 100706f2543Smrg#define BackgroundPixmap 3L 101706f2543Smrg 102706f2543Smrg/* 103706f2543Smrg * The redirectDraw field can have one of three values: 104706f2543Smrg * 105706f2543Smrg * RedirectDrawNone 106706f2543Smrg * A normal window; painted into the same pixmap as the parent 107706f2543Smrg * and clipping parent and siblings to its geometry. These 108706f2543Smrg * windows get a clip list equal to the intersection of their 109706f2543Smrg * geometry with the parent geometry, minus the geometry 110706f2543Smrg * of overlapping None and Clipped siblings. 111706f2543Smrg * RedirectDrawAutomatic 112706f2543Smrg * A redirected window which clips parent and sibling drawing. 113706f2543Smrg * Contents for these windows are manage inside the server. 114706f2543Smrg * These windows get an internal clip list equal to their 115706f2543Smrg * geometry. 116706f2543Smrg * RedirectDrawManual 117706f2543Smrg * A redirected window which does not clip parent and sibling 118706f2543Smrg * drawing; the window must be represented within the parent 119706f2543Smrg * geometry by the client performing the redirection management. 120706f2543Smrg * Contents for these windows are managed outside the server. 121706f2543Smrg * These windows get an internal clip list equal to their 122706f2543Smrg * geometry. 123706f2543Smrg */ 124706f2543Smrg 125706f2543Smrg#define RedirectDrawNone 0 126706f2543Smrg#define RedirectDrawAutomatic 1 127706f2543Smrg#define RedirectDrawManual 2 128706f2543Smrg 129706f2543Smrgtypedef struct _Window { 130706f2543Smrg DrawableRec drawable; 131706f2543Smrg PrivateRec *devPrivates; 132706f2543Smrg WindowPtr parent; /* ancestor chain */ 133706f2543Smrg WindowPtr nextSib; /* next lower sibling */ 134706f2543Smrg WindowPtr prevSib; /* next higher sibling */ 135706f2543Smrg WindowPtr firstChild; /* top-most child */ 136706f2543Smrg WindowPtr lastChild; /* bottom-most child */ 137706f2543Smrg RegionRec clipList; /* clipping rectangle for output */ 138706f2543Smrg RegionRec borderClip; /* NotClippedByChildren + border */ 139706f2543Smrg union _Validate *valdata; 140706f2543Smrg RegionRec winSize; 141706f2543Smrg RegionRec borderSize; 142706f2543Smrg DDXPointRec origin; /* position relative to parent */ 143706f2543Smrg unsigned short borderWidth; 144706f2543Smrg unsigned short deliverableEvents; /* all masks from all clients */ 145706f2543Smrg Mask eventMask; /* mask from the creating client */ 146706f2543Smrg PixUnion background; 147706f2543Smrg PixUnion border; 148706f2543Smrg pointer backStorage; /* null when BS disabled */ 149706f2543Smrg WindowOptPtr optional; 150706f2543Smrg unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ 151706f2543Smrg unsigned borderIsPixel:1; 152706f2543Smrg unsigned cursorIsNone:1; /* else real cursor (might inherit) */ 153706f2543Smrg unsigned backingStore:2; 154706f2543Smrg unsigned saveUnder:1; 155706f2543Smrg unsigned DIXsaveUnder:1; 156706f2543Smrg unsigned bitGravity:4; 157706f2543Smrg unsigned winGravity:4; 158706f2543Smrg unsigned overrideRedirect:1; 159706f2543Smrg unsigned visibility:2; 160706f2543Smrg unsigned mapped:1; 161706f2543Smrg unsigned realized:1; /* ancestors are all mapped */ 162706f2543Smrg unsigned viewable:1; /* realized && InputOutput */ 163706f2543Smrg unsigned dontPropagate:3;/* index into DontPropagateMasks */ 164706f2543Smrg unsigned forcedBS:1; /* system-supplied backingStore */ 165706f2543Smrg unsigned redirectDraw:2; /* COMPOSITE rendering redirect */ 166706f2543Smrg unsigned forcedBG:1; /* must have an opaque background */ 167706f2543Smrg#ifdef ROOTLESS 168706f2543Smrg unsigned rootlessUnhittable:1; /* doesn't hit-test */ 169706f2543Smrg#endif 170706f2543Smrg#ifdef COMPOSITE 171706f2543Smrg unsigned damagedDescendants:1; /* some descendants are damaged */ 172706f2543Smrg#endif 173706f2543Smrg} WindowRec; 174706f2543Smrg 175706f2543Smrg/* 176706f2543Smrg * Ok, a bunch of macros for accessing the optional record 177706f2543Smrg * fields (or filling the appropriate default value) 178706f2543Smrg */ 179706f2543Smrg 180706f2543Smrgextern _X_EXPORT Mask DontPropagateMasks[]; 181706f2543Smrg 182706f2543Smrg#define wTrackParent(w,field) ((w)->optional ? \ 183706f2543Smrg (w)->optional->field \ 184706f2543Smrg : FindWindowWithOptional(w)->optional->field) 185706f2543Smrg#define wUseDefault(w,field,def) ((w)->optional ? \ 186706f2543Smrg (w)->optional->field \ 187706f2543Smrg : def) 188706f2543Smrg 189706f2543Smrg#define wVisual(w) wTrackParent(w, visual) 190706f2543Smrg#define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor)) 191706f2543Smrg#define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap)) 192706f2543Smrg#define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate]) 193706f2543Smrg#define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0) 194706f2543Smrg#define wOtherClients(w) wUseDefault(w, otherClients, NULL) 195706f2543Smrg#define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL) 196706f2543Smrg#define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL) 197706f2543Smrg#define wUserProps(w) wUseDefault(w, userProps, NULL) 198706f2543Smrg#define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L) 199706f2543Smrg#define wBackingPixel(w) wUseDefault(w, backingPixel, 0) 200706f2543Smrg#define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) 201706f2543Smrg#define wClipShape(w) wUseDefault(w, clipShape, NULL) 202706f2543Smrg#define wInputShape(w) wUseDefault(w, inputShape, NULL) 203706f2543Smrg#define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) 204706f2543Smrg#define wBorderWidth(w) ((int) (w)->borderWidth) 205706f2543Smrg 206706f2543Smrg/* true when w needs a border drawn. */ 207706f2543Smrg 208706f2543Smrg#define HasBorder(w) ((w)->borderWidth || wClipShape(w)) 209706f2543Smrg 210706f2543Smrgtypedef struct _ScreenSaverStuff *ScreenSaverStuffPtr; 211706f2543Smrg 212706f2543Smrg#define SCREEN_IS_BLANKED 0 213706f2543Smrg#define SCREEN_ISNT_SAVED 1 214706f2543Smrg#define SCREEN_IS_TILED 2 215706f2543Smrg#define SCREEN_IS_BLACK 3 216706f2543Smrg 217706f2543Smrg#define HasSaverWindow(pScreen) (pScreen->screensaver.pWindow != NullWindow) 218706f2543Smrg 219706f2543Smrgextern _X_EXPORT int screenIsSaved; 220706f2543Smrg 221706f2543Smrg#endif /* WINDOWSTRUCT_H */ 222