1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 5*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 6*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 7*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 9*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the next 12*4882a593Smuzhiyun * paragraph) shall be included in all copies or substantial portions of the 13*4882a593Smuzhiyun * Software. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*4882a593Smuzhiyun * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*4882a593Smuzhiyun * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20*4882a593Smuzhiyun * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21*4882a593Smuzhiyun * DEALINGS IN THE SOFTWARE. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * Copyright © 2003 Keith Packard 24*4882a593Smuzhiyun * 25*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its 26*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that 27*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that 28*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting 29*4882a593Smuzhiyun * documentation, and that the name of Keith Packard not be used in 30*4882a593Smuzhiyun * advertising or publicity pertaining to distribution of the software without 31*4882a593Smuzhiyun * specific, written prior permission. Keith Packard makes no 32*4882a593Smuzhiyun * representations about the suitability of this software for any purpose. It 33*4882a593Smuzhiyun * is provided "as is" without express or implied warranty. 34*4882a593Smuzhiyun * 35*4882a593Smuzhiyun * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 36*4882a593Smuzhiyun * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 37*4882a593Smuzhiyun * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 38*4882a593Smuzhiyun * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 39*4882a593Smuzhiyun * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 40*4882a593Smuzhiyun * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 41*4882a593Smuzhiyun * PERFORMANCE OF THIS SOFTWARE. 42*4882a593Smuzhiyun */ 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H 45*4882a593Smuzhiyun #include <dix-config.h> 46*4882a593Smuzhiyun #endif 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #ifndef _COMPINT_H_ 49*4882a593Smuzhiyun #define _COMPINT_H_ 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #include "misc.h" 52*4882a593Smuzhiyun #include "scrnintstr.h" 53*4882a593Smuzhiyun #include "os.h" 54*4882a593Smuzhiyun #include "regionstr.h" 55*4882a593Smuzhiyun #include "validate.h" 56*4882a593Smuzhiyun #include "windowstr.h" 57*4882a593Smuzhiyun #include "input.h" 58*4882a593Smuzhiyun #include "resource.h" 59*4882a593Smuzhiyun #include "colormapst.h" 60*4882a593Smuzhiyun #include "cursorstr.h" 61*4882a593Smuzhiyun #include "dixstruct.h" 62*4882a593Smuzhiyun #include "gcstruct.h" 63*4882a593Smuzhiyun #include "servermd.h" 64*4882a593Smuzhiyun #include "dixevents.h" 65*4882a593Smuzhiyun #include "globals.h" 66*4882a593Smuzhiyun #include "picturestr.h" 67*4882a593Smuzhiyun #include "extnsionst.h" 68*4882a593Smuzhiyun #include "privates.h" 69*4882a593Smuzhiyun #include "mi.h" 70*4882a593Smuzhiyun #include "damage.h" 71*4882a593Smuzhiyun #include "damageextint.h" 72*4882a593Smuzhiyun #include "xfixes.h" 73*4882a593Smuzhiyun #include <X11/extensions/compositeproto.h> 74*4882a593Smuzhiyun #include "compositeext.h" 75*4882a593Smuzhiyun #include <assert.h> 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun /* 78*4882a593Smuzhiyun * enable this for debugging 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun #define COMPOSITE_DEBUG 81*4882a593Smuzhiyun */ 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun typedef struct _CompClientWindow { 84*4882a593Smuzhiyun struct _CompClientWindow *next; 85*4882a593Smuzhiyun XID id; 86*4882a593Smuzhiyun int update; 87*4882a593Smuzhiyun } CompClientWindowRec, *CompClientWindowPtr; 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun typedef struct _CompWindow { 90*4882a593Smuzhiyun RegionRec borderClip; 91*4882a593Smuzhiyun DamagePtr damage; /* for automatic update mode */ 92*4882a593Smuzhiyun Bool damageRegistered; 93*4882a593Smuzhiyun Bool damaged; 94*4882a593Smuzhiyun int update; 95*4882a593Smuzhiyun CompClientWindowPtr clients; 96*4882a593Smuzhiyun int oldx; 97*4882a593Smuzhiyun int oldy; 98*4882a593Smuzhiyun PixmapPtr pOldPixmap; 99*4882a593Smuzhiyun int borderClipX, borderClipY; 100*4882a593Smuzhiyun } CompWindowRec, *CompWindowPtr; 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun #define COMP_ORIGIN_INVALID 0x80000000 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun typedef struct _CompSubwindows { 105*4882a593Smuzhiyun int update; 106*4882a593Smuzhiyun CompClientWindowPtr clients; 107*4882a593Smuzhiyun } CompSubwindowsRec, *CompSubwindowsPtr; 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun #ifndef COMP_INCLUDE_RGB24_VISUAL 110*4882a593Smuzhiyun #define COMP_INCLUDE_RGB24_VISUAL 0 111*4882a593Smuzhiyun #endif 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun typedef struct _CompOverlayClientRec *CompOverlayClientPtr; 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun typedef struct _CompOverlayClientRec { 116*4882a593Smuzhiyun CompOverlayClientPtr pNext; 117*4882a593Smuzhiyun ClientPtr pClient; 118*4882a593Smuzhiyun ScreenPtr pScreen; 119*4882a593Smuzhiyun XID resource; 120*4882a593Smuzhiyun } CompOverlayClientRec; 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun typedef struct _CompImplicitRedirectException { 123*4882a593Smuzhiyun XID parentVisual; 124*4882a593Smuzhiyun XID winVisual; 125*4882a593Smuzhiyun } CompImplicitRedirectException; 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun typedef struct _CompScreen { 128*4882a593Smuzhiyun PositionWindowProcPtr PositionWindow; 129*4882a593Smuzhiyun CopyWindowProcPtr CopyWindow; 130*4882a593Smuzhiyun CreateWindowProcPtr CreateWindow; 131*4882a593Smuzhiyun DestroyWindowProcPtr DestroyWindow; 132*4882a593Smuzhiyun RealizeWindowProcPtr RealizeWindow; 133*4882a593Smuzhiyun UnrealizeWindowProcPtr UnrealizeWindow; 134*4882a593Smuzhiyun ClipNotifyProcPtr ClipNotify; 135*4882a593Smuzhiyun /* 136*4882a593Smuzhiyun * Called from ConfigureWindow, these 137*4882a593Smuzhiyun * three track changes to the offscreen storage 138*4882a593Smuzhiyun * geometry 139*4882a593Smuzhiyun */ 140*4882a593Smuzhiyun ConfigNotifyProcPtr ConfigNotify; 141*4882a593Smuzhiyun MoveWindowProcPtr MoveWindow; 142*4882a593Smuzhiyun ResizeWindowProcPtr ResizeWindow; 143*4882a593Smuzhiyun ChangeBorderWidthProcPtr ChangeBorderWidth; 144*4882a593Smuzhiyun /* 145*4882a593Smuzhiyun * Reparenting has an effect on Subwindows redirect 146*4882a593Smuzhiyun */ 147*4882a593Smuzhiyun ReparentWindowProcPtr ReparentWindow; 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun /* 150*4882a593Smuzhiyun * Colormaps for new visuals better not get installed 151*4882a593Smuzhiyun */ 152*4882a593Smuzhiyun InstallColormapProcPtr InstallColormap; 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun /* 155*4882a593Smuzhiyun * Fake backing store via automatic redirection 156*4882a593Smuzhiyun */ 157*4882a593Smuzhiyun ChangeWindowAttributesProcPtr ChangeWindowAttributes; 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun Bool pendingScreenUpdate; 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun CloseScreenProcPtr CloseScreen; 162*4882a593Smuzhiyun int numAlternateVisuals; 163*4882a593Smuzhiyun VisualID *alternateVisuals; 164*4882a593Smuzhiyun int numImplicitRedirectExceptions; 165*4882a593Smuzhiyun CompImplicitRedirectException *implicitRedirectExceptions; 166*4882a593Smuzhiyun 167*4882a593Smuzhiyun WindowPtr pOverlayWin; 168*4882a593Smuzhiyun Window overlayWid; 169*4882a593Smuzhiyun CompOverlayClientPtr pOverlayClients; 170*4882a593Smuzhiyun 171*4882a593Smuzhiyun GetImageProcPtr GetImage; 172*4882a593Smuzhiyun GetSpansProcPtr GetSpans; 173*4882a593Smuzhiyun SourceValidateProcPtr SourceValidate; 174*4882a593Smuzhiyun } CompScreenRec, *CompScreenPtr; 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun extern DevPrivateKeyRec CompScreenPrivateKeyRec; 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun #define CompScreenPrivateKey (&CompScreenPrivateKeyRec) 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun extern DevPrivateKeyRec CompWindowPrivateKeyRec; 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun #define CompWindowPrivateKey (&CompWindowPrivateKeyRec) 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec; 185*4882a593Smuzhiyun 186*4882a593Smuzhiyun #define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec) 187*4882a593Smuzhiyun 188*4882a593Smuzhiyun #define GetCompScreen(s) ((CompScreenPtr) \ 189*4882a593Smuzhiyun dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey)) 190*4882a593Smuzhiyun #define GetCompWindow(w) ((CompWindowPtr) \ 191*4882a593Smuzhiyun dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey)) 192*4882a593Smuzhiyun #define GetCompSubwindows(w) ((CompSubwindowsPtr) \ 193*4882a593Smuzhiyun dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey)) 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun extern RESTYPE CompositeClientSubwindowsType; 196*4882a593Smuzhiyun extern RESTYPE CompositeClientOverlayType; 197*4882a593Smuzhiyun 198*4882a593Smuzhiyun /* 199*4882a593Smuzhiyun * compalloc.c 200*4882a593Smuzhiyun */ 201*4882a593Smuzhiyun 202*4882a593Smuzhiyun Bool 203*4882a593Smuzhiyun compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update); 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun void 206*4882a593Smuzhiyun compFreeClientWindow(WindowPtr pWin, XID id); 207*4882a593Smuzhiyun 208*4882a593Smuzhiyun int 209*4882a593Smuzhiyun compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update); 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun int 212*4882a593Smuzhiyun compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update); 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun void 215*4882a593Smuzhiyun compFreeClientSubwindows(WindowPtr pWin, XID id); 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun int 218*4882a593Smuzhiyun compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update); 219*4882a593Smuzhiyun 220*4882a593Smuzhiyun int 221*4882a593Smuzhiyun compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin); 222*4882a593Smuzhiyun 223*4882a593Smuzhiyun int 224*4882a593Smuzhiyun compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin); 225*4882a593Smuzhiyun 226*4882a593Smuzhiyun Bool 227*4882a593Smuzhiyun compAllocPixmap(WindowPtr pWin); 228*4882a593Smuzhiyun 229*4882a593Smuzhiyun void 230*4882a593Smuzhiyun compSetParentPixmap(WindowPtr pWin); 231*4882a593Smuzhiyun 232*4882a593Smuzhiyun void 233*4882a593Smuzhiyun compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap); 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun Bool 236*4882a593Smuzhiyun 237*4882a593Smuzhiyun compReallocPixmap(WindowPtr pWin, int x, int y, 238*4882a593Smuzhiyun unsigned int w, unsigned int h, int bw); 239*4882a593Smuzhiyun 240*4882a593Smuzhiyun void compMarkAncestors(WindowPtr pWin); 241*4882a593Smuzhiyun 242*4882a593Smuzhiyun /* 243*4882a593Smuzhiyun * compinit.c 244*4882a593Smuzhiyun */ 245*4882a593Smuzhiyun 246*4882a593Smuzhiyun Bool 247*4882a593Smuzhiyun compScreenInit(ScreenPtr pScreen); 248*4882a593Smuzhiyun 249*4882a593Smuzhiyun /* 250*4882a593Smuzhiyun * compoverlay.c 251*4882a593Smuzhiyun */ 252*4882a593Smuzhiyun 253*4882a593Smuzhiyun void 254*4882a593Smuzhiyun compFreeOverlayClient(CompOverlayClientPtr pOcToDel); 255*4882a593Smuzhiyun 256*4882a593Smuzhiyun CompOverlayClientPtr 257*4882a593Smuzhiyun compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient); 258*4882a593Smuzhiyun 259*4882a593Smuzhiyun CompOverlayClientPtr 260*4882a593Smuzhiyun compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient); 261*4882a593Smuzhiyun 262*4882a593Smuzhiyun Bool 263*4882a593Smuzhiyun compCreateOverlayWindow(ScreenPtr pScreen); 264*4882a593Smuzhiyun 265*4882a593Smuzhiyun void 266*4882a593Smuzhiyun compDestroyOverlayWindow(ScreenPtr pScreen); 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun /* 269*4882a593Smuzhiyun * compwindow.c 270*4882a593Smuzhiyun */ 271*4882a593Smuzhiyun 272*4882a593Smuzhiyun #ifdef COMPOSITE_DEBUG 273*4882a593Smuzhiyun void 274*4882a593Smuzhiyun compCheckTree(ScreenPtr pScreen); 275*4882a593Smuzhiyun #else 276*4882a593Smuzhiyun #define compCheckTree(s) 277*4882a593Smuzhiyun #endif 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun void 280*4882a593Smuzhiyun compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap, int bw); 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun Bool 283*4882a593Smuzhiyun compCheckRedirect(WindowPtr pWin); 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun Bool 286*4882a593Smuzhiyun compPositionWindow(WindowPtr pWin, int x, int y); 287*4882a593Smuzhiyun 288*4882a593Smuzhiyun Bool 289*4882a593Smuzhiyun compRealizeWindow(WindowPtr pWin); 290*4882a593Smuzhiyun 291*4882a593Smuzhiyun Bool 292*4882a593Smuzhiyun compUnrealizeWindow(WindowPtr pWin); 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun void 295*4882a593Smuzhiyun compClipNotify(WindowPtr pWin, int dx, int dy); 296*4882a593Smuzhiyun 297*4882a593Smuzhiyun void 298*4882a593Smuzhiyun compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind); 299*4882a593Smuzhiyun 300*4882a593Smuzhiyun void 301*4882a593Smuzhiyun 302*4882a593Smuzhiyun compResizeWindow(WindowPtr pWin, int x, int y, 303*4882a593Smuzhiyun unsigned int w, unsigned int h, WindowPtr pSib); 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun void 306*4882a593Smuzhiyun compChangeBorderWidth(WindowPtr pWin, unsigned int border_width); 307*4882a593Smuzhiyun 308*4882a593Smuzhiyun void 309*4882a593Smuzhiyun compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent); 310*4882a593Smuzhiyun 311*4882a593Smuzhiyun Bool 312*4882a593Smuzhiyun compCreateWindow(WindowPtr pWin); 313*4882a593Smuzhiyun 314*4882a593Smuzhiyun Bool 315*4882a593Smuzhiyun compDestroyWindow(WindowPtr pWin); 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun void 318*4882a593Smuzhiyun compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion); 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun RegionPtr 321*4882a593Smuzhiyun compGetRedirectBorderClip(WindowPtr pWin); 322*4882a593Smuzhiyun 323*4882a593Smuzhiyun void 324*4882a593Smuzhiyun compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun void 327*4882a593Smuzhiyun compPaintChildrenToWindow(WindowPtr pWin); 328*4882a593Smuzhiyun 329*4882a593Smuzhiyun WindowPtr 330*4882a593Smuzhiyun CompositeRealChildHead(WindowPtr pWin); 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun int 333*4882a593Smuzhiyun DeleteWindowNoInputDevices(void *value, XID wid); 334*4882a593Smuzhiyun 335*4882a593Smuzhiyun int 336*4882a593Smuzhiyun 337*4882a593Smuzhiyun compConfigNotify(WindowPtr pWin, int x, int y, int w, int h, 338*4882a593Smuzhiyun int bw, WindowPtr pSib); 339*4882a593Smuzhiyun 340*4882a593Smuzhiyun void PanoramiXCompositeInit(void); 341*4882a593Smuzhiyun void PanoramiXCompositeReset(void); 342*4882a593Smuzhiyun 343*4882a593Smuzhiyun #endif /* _COMPINT_H_ */ 344