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