compint.h 8.78 KB
Newer Older
1
/*
2
 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
3
 *
4
 * Permission is hereby granted, free of charge, to any person obtaining a
5 6 7 8 9
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
10
 *
11 12 13
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
14
 *
15 16 17 18 19 20 21
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
22
 *
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
 * Copyright © 2003 Keith Packard
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Keith Packard not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Keith Packard makes no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

44 45 46 47
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif

48 49 50
#ifndef _COMPINT_H_
#define _COMPINT_H_

51
#include "misc.h"
52
#include "scrnintstr.h"
53
#include "os.h"
54 55 56 57 58 59 60 61 62 63 64 65 66 67
#include "regionstr.h"
#include "validate.h"
#include "windowstr.h"
#include "input.h"
#include "resource.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
#include "dixevents.h"
#include "globals.h"
#include "picturestr.h"
#include "extnsionst.h"
68
#include "privates.h"
69 70 71 72 73
#include "mi.h"
#include "damage.h"
#include "damageextint.h"
#include "xfixes.h"
#include <X11/extensions/compositeproto.h>
74
#include "compositeext.h"
75 76
#include <assert.h>

77 78 79 80 81 82
/*
 *  enable this for debugging
 
    #define COMPOSITE_DEBUG
 */

83
typedef struct _CompClientWindow {
84 85 86 87
    struct _CompClientWindow *next;
    XID id;
    int update;
} CompClientWindowRec, *CompClientWindowPtr;
88 89

typedef struct _CompWindow {
90 91 92 93 94 95 96 97 98 99
    RegionRec borderClip;
    DamagePtr damage;           /* for automatic update mode */
    Bool damageRegistered;
    Bool damaged;
    int update;
    CompClientWindowPtr clients;
    int oldx;
    int oldy;
    PixmapPtr pOldPixmap;
    int borderClipX, borderClipY;
100 101 102 103 104
} CompWindowRec, *CompWindowPtr;

#define COMP_ORIGIN_INVALID	    0x80000000

typedef struct _CompSubwindows {
105 106
    int update;
    CompClientWindowPtr clients;
107 108
} CompSubwindowsRec, *CompSubwindowsPtr;

109 110 111 112
#ifndef COMP_INCLUDE_RGB24_VISUAL
#define COMP_INCLUDE_RGB24_VISUAL 0
#endif

113 114 115
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;

typedef struct _CompOverlayClientRec {
116 117 118 119
    CompOverlayClientPtr pNext;
    ClientPtr pClient;
    ScreenPtr pScreen;
    XID resource;
120 121
} CompOverlayClientRec;

122 123 124 125 126
typedef struct _CompImplicitRedirectException {
    XID parentVisual;
    XID winVisual;
} CompImplicitRedirectException;

127
typedef struct _CompScreen {
128 129 130 131 132 133 134
    PositionWindowProcPtr PositionWindow;
    CopyWindowProcPtr CopyWindow;
    CreateWindowProcPtr CreateWindow;
    DestroyWindowProcPtr DestroyWindow;
    RealizeWindowProcPtr RealizeWindow;
    UnrealizeWindowProcPtr UnrealizeWindow;
    ClipNotifyProcPtr ClipNotify;
135
    /*
136 137 138
     * Called from ConfigureWindow, these
     * three track changes to the offscreen storage
     * geometry
139
     */
140 141 142 143
    ConfigNotifyProcPtr ConfigNotify;
    MoveWindowProcPtr MoveWindow;
    ResizeWindowProcPtr ResizeWindow;
    ChangeBorderWidthProcPtr ChangeBorderWidth;
144 145 146
    /*
     * Reparenting has an effect on Subwindows redirect
     */
147 148
    ReparentWindowProcPtr ReparentWindow;

149 150 151
    /*
     * Colormaps for new visuals better not get installed
     */
152
    InstallColormapProcPtr InstallColormap;
153

154 155 156 157 158
    /*
     * Fake backing store via automatic redirection
     */
    ChangeWindowAttributesProcPtr ChangeWindowAttributes;

159 160 161 162
    ScreenBlockHandlerProcPtr BlockHandler;
    CloseScreenProcPtr CloseScreen;
    int numAlternateVisuals;
    VisualID *alternateVisuals;
163 164
    int numImplicitRedirectExceptions;
    CompImplicitRedirectException *implicitRedirectExceptions;
165 166 167 168 169 170 171

    WindowPtr pOverlayWin;
    Window overlayWid;
    CompOverlayClientPtr pOverlayClients;

    GetImageProcPtr GetImage;
    SourceValidateProcPtr SourceValidate;
172 173
} CompScreenRec, *CompScreenPtr;

174
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
175

176 177 178
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)

extern DevPrivateKeyRec CompWindowPrivateKeyRec;
179

180 181 182
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)

extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
183

184
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
185

186 187 188 189 190 191
#define GetCompScreen(s) ((CompScreenPtr) \
    dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
#define GetCompWindow(w) ((CompWindowPtr) \
    dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
    dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
192

193 194
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
195 196 197 198 199 200

/*
 * compalloc.c
 */

Bool
201
 compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
202 203

void
204
 compFreeClientWindow(WindowPtr pWin, XID id);
205 206

int
207
 compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
208 209

int
210
 compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
211 212

void
213
 compFreeClientSubwindows(WindowPtr pWin, XID id);
214 215

int
216
 compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
217 218

int
219
 compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
220 221

int
222
 compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
223 224

Bool
225
 compAllocPixmap(WindowPtr pWin);
226 227

void
228
 compSetParentPixmap(WindowPtr pWin);
229 230

void
231
 compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
232 233

Bool
234 235 236

compReallocPixmap(WindowPtr pWin, int x, int y,
                  unsigned int w, unsigned int h, int bw);
237 238 239 240 241 242

/*
 * compinit.c
 */

Bool
243
 compScreenInit(ScreenPtr pScreen);
244

245 246 247 248 249
/*
 * compoverlay.c
 */

void
250
 compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
251 252

CompOverlayClientPtr
253 254
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);

255
CompOverlayClientPtr
256
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
257 258

Bool
259
 compCreateOverlayWindow(ScreenPtr pScreen);
260 261

void
262
 compDestroyOverlayWindow(ScreenPtr pScreen);
263

264 265 266 267
/*
 * compwindow.c
 */

268
#ifdef COMPOSITE_DEBUG
269
void
270
 compCheckTree(ScreenPtr pScreen);
271 272
#else
#define compCheckTree(s)
273 274 275
#endif

void
276
 compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
277 278

Bool
279
 compCheckRedirect(WindowPtr pWin);
280 281

Bool
282
 compPositionWindow(WindowPtr pWin, int x, int y);
283 284

Bool
285
 compRealizeWindow(WindowPtr pWin);
286 287

Bool
288
 compUnrealizeWindow(WindowPtr pWin);
289 290

void
291
 compClipNotify(WindowPtr pWin, int dx, int dy);
292

293
void
294
 compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
295 296

void
297 298 299

compResizeWindow(WindowPtr pWin, int x, int y,
                 unsigned int w, unsigned int h, WindowPtr pSib);
300 301

void
302
 compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
303

304
void
305
 compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
306 307

Bool
308
 compCreateWindow(WindowPtr pWin);
309 310

Bool
311
 compDestroyWindow(WindowPtr pWin);
312 313

void
314
 compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
315 316

RegionPtr
317
 compGetRedirectBorderClip(WindowPtr pWin);
318 319

void
320
 compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
321 322

void
323
 compPaintChildrenToWindow(WindowPtr pWin);
324

325
WindowPtr
326
 CompositeRealChildHead(WindowPtr pWin);
327 328

int
329
 DeleteWindowNoInputDevices(void *value, XID wid);
330

331
int
332

333
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
334
                 int bw, WindowPtr pSib);
335

336 337
void PanoramiXCompositeInit(void);
void PanoramiXCompositeReset(void);
338

339
#endif                          /* _COMPINT_H_ */