compint.h 8.81 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

    WindowPtr pOverlayWin;
    Window overlayWid;
    CompOverlayClientPtr pOverlayClients;

    GetImageProcPtr GetImage;
Adam Jackson's avatar
Adam Jackson committed
171
    GetSpansProcPtr GetSpans;
172
    SourceValidateProcPtr SourceValidate;
173 174
} CompScreenRec, *CompScreenPtr;

175
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
176

177 178 179
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)

extern DevPrivateKeyRec CompWindowPrivateKeyRec;
180

181 182 183
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)

extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
184

185
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
186

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

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

/*
 * compalloc.c
 */

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

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

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

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

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

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

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

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

Bool
226
 compAllocPixmap(WindowPtr pWin);
227 228

void
229
 compSetParentPixmap(WindowPtr pWin);
230 231

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

Bool
235 236 237

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

/*
 * compinit.c
 */

Bool
244
 compScreenInit(ScreenPtr pScreen);
245

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

void
251
 compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
252 253

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

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

Bool
260
 compCreateOverlayWindow(ScreenPtr pScreen);
261 262

void
263
 compDestroyOverlayWindow(ScreenPtr pScreen);
264

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

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

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

Bool
280
 compCheckRedirect(WindowPtr pWin);
281 282

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

Bool
286
 compRealizeWindow(WindowPtr pWin);
287 288

Bool
289
 compUnrealizeWindow(WindowPtr pWin);
290 291

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

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

void
298 299 300

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

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

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

Bool
309
 compCreateWindow(WindowPtr pWin);
310 311

Bool
312
 compDestroyWindow(WindowPtr pWin);
313 314

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

RegionPtr
318
 compGetRedirectBorderClip(WindowPtr pWin);
319 320

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

void
324
 compPaintChildrenToWindow(WindowPtr pWin);
325

326
WindowPtr
327
 CompositeRealChildHead(WindowPtr pWin);
328 329

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

332
int
333

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

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

340
#endif                          /* _COMPINT_H_ */