compint.h 9.89 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
/*
 *  enable this for debugging
Peter Hutterer's avatar
Peter Hutterer committed
79

80 81 82
    #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 113 114
typedef struct _CompEventWindow {
    struct _CompEventWindow *next;
    XID id;
    CARD32 eventMask;
} CompEventWindowRec, *CompEventWindowPtr;

115 116 117 118
#ifndef COMP_INCLUDE_RGB24_VISUAL
#define COMP_INCLUDE_RGB24_VISUAL 0
#endif

119 120 121
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;

typedef struct _CompOverlayClientRec {
122 123 124 125
    CompOverlayClientPtr pNext;
    ClientPtr pClient;
    ScreenPtr pScreen;
    XID resource;
126 127
} CompOverlayClientRec;

128 129 130 131 132
typedef struct _CompImplicitRedirectException {
    XID parentVisual;
    XID winVisual;
} CompImplicitRedirectException;

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

155 156 157
    /*
     * Colormaps for new visuals better not get installed
     */
158
    InstallColormapProcPtr InstallColormap;
159

160 161 162 163 164
    /*
     * Fake backing store via automatic redirection
     */
    ChangeWindowAttributesProcPtr ChangeWindowAttributes;

165 166
    Bool pendingScreenUpdate;

167 168 169
    CloseScreenProcPtr CloseScreen;
    int numAlternateVisuals;
    VisualID *alternateVisuals;
170 171
    int numImplicitRedirectExceptions;
    CompImplicitRedirectException *implicitRedirectExceptions;
172 173 174 175 176 177

    WindowPtr pOverlayWin;
    Window overlayWid;
    CompOverlayClientPtr pOverlayClients;

    GetImageProcPtr GetImage;
Adam Jackson's avatar
Adam Jackson committed
178
    GetSpansProcPtr GetSpans;
179
    SourceValidateProcPtr SourceValidate;
180 181
} CompScreenRec, *CompScreenPtr;

182 183
extern CARD8 CompositeReqCode;

184
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
185

186 187 188
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)

extern DevPrivateKeyRec CompWindowPrivateKeyRec;
189

190 191 192
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)

extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
193

194
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
195

196 197 198 199
extern DevPrivateKeyRec CompEventWindowPrivateKeyRec;

#define CompEventWindowPrivateKey (&CompEventWindowPrivateKeyRec)

200 201 202 203 204 205
#define GetCompScreen(s) ((CompScreenPtr) \
    dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
#define GetCompWindow(w) ((CompWindowPtr) \
    dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
    dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
206 207
#define GetCompEventWindowHead(w) ((CompEventWindowPtr *) \
    dixLookupPrivateAddr(&(w)->devPrivates, CompEventWindowPrivateKey))
208

209 210
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
211 212 213 214 215 216

/*
 * compalloc.c
 */

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

void
220
 compFreeClientWindow(WindowPtr pWin, XID id);
221 222

int
223
 compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
224 225

int
226
 compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
227 228

void
229
 compFreeClientSubwindows(WindowPtr pWin, XID id);
230 231

int
232
 compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
233 234

int
235
 compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
236 237

int
238
 compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
239 240

Bool
241
 compAllocPixmap(WindowPtr pWin);
242 243

void
244
 compSetParentPixmap(WindowPtr pWin);
245 246

void
247
 compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
248 249

Bool
250 251 252

compReallocPixmap(WindowPtr pWin, int x, int y,
                  unsigned int w, unsigned int h, int bw);
253

254 255
void compMarkAncestors(WindowPtr pWin);

256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
/*
 * compevent.c
 */

void
compSendPixmapNotify(WindowPtr pWin, PixmapPtr pPix);

void
compSendOwnerWindowSizeNotify(WindowPtr pWin);

void
compFreeEventWindow(WindowPtr pWin, XID id);

void
compFreeEvents(WindowPtr pWin);

int
compSelectInput(ClientPtr pClient, WindowPtr pWin, CARD32 event_mask);

void
compEventInit(void);

278 279 280 281 282
/*
 * compinit.c
 */

Bool
283
 compScreenInit(ScreenPtr pScreen);
284

285 286 287 288 289
/*
 * compoverlay.c
 */

void
290
 compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
291 292

CompOverlayClientPtr
293 294
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);

295
CompOverlayClientPtr
296
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
297 298

Bool
299
 compCreateOverlayWindow(ScreenPtr pScreen);
300 301

void
302
 compDestroyOverlayWindow(ScreenPtr pScreen);
303

304 305 306 307
/*
 * compwindow.c
 */

308
#ifdef COMPOSITE_DEBUG
309
void
310
 compCheckTree(ScreenPtr pScreen);
311 312
#else
#define compCheckTree(s)
313 314 315
#endif

void
316
 compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap, int bw);
317 318

Bool
319
 compCheckRedirect(WindowPtr pWin);
320 321

Bool
322
 compPositionWindow(WindowPtr pWin, int x, int y);
323 324

Bool
325
 compRealizeWindow(WindowPtr pWin);
326 327

Bool
328
 compUnrealizeWindow(WindowPtr pWin);
329 330

void
331
 compClipNotify(WindowPtr pWin, int dx, int dy);
332

333
void
334
 compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
335 336

void
337 338 339

compResizeWindow(WindowPtr pWin, int x, int y,
                 unsigned int w, unsigned int h, WindowPtr pSib);
340 341

void
342
 compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
343

344
void
345
 compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
346 347

Bool
348
 compCreateWindow(WindowPtr pWin);
349 350

Bool
351
 compDestroyWindow(WindowPtr pWin);
352 353

void
354
 compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
355 356

RegionPtr
357
 compGetRedirectBorderClip(WindowPtr pWin);
358 359

void
360
 compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
361 362

void
363
 compPaintChildrenToWindow(WindowPtr pWin);
364

365
WindowPtr
366
 CompositeRealChildHead(WindowPtr pWin);
367 368

int
369
 DeleteWindowNoInputDevices(void *value, XID wid);
370

371
int
372

373
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
374
                 int bw, WindowPtr pSib);
375

376 377 378 379 380 381
int
compSetOwnerSize(WindowPtr pWin, CARD16 ownerWidth, CARD16 ownerHeight, ClientPtr client);

int
compSendOwnerSizeCoreEvents(WindowPtr pWin);

Roman Gilg's avatar
Roman Gilg committed
382 383 384
void
compScaleRegion(RegionPtr pRegion, double xscale, double yscale);

Roman Gilg's avatar
Roman Gilg committed
385 386 387
void
compScalePicture(WindowPtr pWin, PicturePtr picture, double *xscale, double *yscale);

388 389
void PanoramiXCompositeInit(void);
void PanoramiXCompositeReset(void);
390

391
#endif                          /* _COMPINT_H_ */