Imported Upstream version 1.15.1
[deb_xorg-server.git] / composite / compint.h
CommitLineData
a09e091a
JB
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 * 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 "compositeext.h"
75#include <assert.h>
76
77/*
78 * enable this for debugging
79
80 #define COMPOSITE_DEBUG
81 */
82
83typedef struct _CompClientWindow {
84 struct _CompClientWindow *next;
85 XID id;
86 int update;
87} CompClientWindowRec, *CompClientWindowPtr;
88
89typedef struct _CompWindow {
90 RegionRec borderClip;
91 DamagePtr damage; /* for automatic update mode */
92 Bool damageRegistered;
93 Bool damaged;
94 int update;
95 CompClientWindowPtr clients;
96 int oldx;
97 int oldy;
98 PixmapPtr pOldPixmap;
99 int borderClipX, borderClipY;
100} CompWindowRec, *CompWindowPtr;
101
102#define COMP_ORIGIN_INVALID 0x80000000
103
104typedef struct _CompSubwindows {
105 int update;
106 CompClientWindowPtr clients;
107} CompSubwindowsRec, *CompSubwindowsPtr;
108
109#ifndef COMP_INCLUDE_RGB24_VISUAL
110#define COMP_INCLUDE_RGB24_VISUAL 0
111#endif
112
113typedef struct _CompOverlayClientRec *CompOverlayClientPtr;
114
115typedef struct _CompOverlayClientRec {
116 CompOverlayClientPtr pNext;
117 ClientPtr pClient;
118 ScreenPtr pScreen;
119 XID resource;
120} CompOverlayClientRec;
121
122typedef struct _CompScreen {
123 PositionWindowProcPtr PositionWindow;
124 CopyWindowProcPtr CopyWindow;
125 CreateWindowProcPtr CreateWindow;
126 DestroyWindowProcPtr DestroyWindow;
127 RealizeWindowProcPtr RealizeWindow;
128 UnrealizeWindowProcPtr UnrealizeWindow;
129 ClipNotifyProcPtr ClipNotify;
130 /*
131 * Called from ConfigureWindow, these
132 * three track changes to the offscreen storage
133 * geometry
134 */
135 ConfigNotifyProcPtr ConfigNotify;
136 MoveWindowProcPtr MoveWindow;
137 ResizeWindowProcPtr ResizeWindow;
138 ChangeBorderWidthProcPtr ChangeBorderWidth;
139 /*
140 * Reparenting has an effect on Subwindows redirect
141 */
142 ReparentWindowProcPtr ReparentWindow;
143
144 /*
145 * Colormaps for new visuals better not get installed
146 */
147 InstallColormapProcPtr InstallColormap;
148
149 /*
150 * Fake backing store via automatic redirection
151 */
152 ChangeWindowAttributesProcPtr ChangeWindowAttributes;
153
154 ScreenBlockHandlerProcPtr BlockHandler;
155 CloseScreenProcPtr CloseScreen;
156 int numAlternateVisuals;
157 VisualID *alternateVisuals;
158
159 WindowPtr pOverlayWin;
160 Window overlayWid;
161 CompOverlayClientPtr pOverlayClients;
162
163 GetImageProcPtr GetImage;
164 SourceValidateProcPtr SourceValidate;
165} CompScreenRec, *CompScreenPtr;
166
167extern DevPrivateKeyRec CompScreenPrivateKeyRec;
168
169#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
170
171extern DevPrivateKeyRec CompWindowPrivateKeyRec;
172
173#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
174
175extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
176
177#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
178
179#define GetCompScreen(s) ((CompScreenPtr) \
180 dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
181#define GetCompWindow(w) ((CompWindowPtr) \
182 dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
183#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
184 dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
185
186extern RESTYPE CompositeClientSubwindowsType;
187extern RESTYPE CompositeClientOverlayType;
188
189/*
190 * compalloc.c
191 */
192
193Bool
194 compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
195
196void
197 compFreeClientWindow(WindowPtr pWin, XID id);
198
199int
200 compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
201
202int
203 compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
204
205void
206 compFreeClientSubwindows(WindowPtr pWin, XID id);
207
208int
209 compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
210
211int
212 compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
213
214int
215 compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
216
217Bool
218 compAllocPixmap(WindowPtr pWin);
219
220void
221 compSetParentPixmap(WindowPtr pWin);
222
223void
224 compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
225
226Bool
227
228compReallocPixmap(WindowPtr pWin, int x, int y,
229 unsigned int w, unsigned int h, int bw);
230
231/*
232 * compinit.c
233 */
234
235Bool
236 compScreenInit(ScreenPtr pScreen);
237
238/*
239 * compoverlay.c
240 */
241
242void
243 compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
244
245CompOverlayClientPtr
246compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
247
248CompOverlayClientPtr
249compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
250
251Bool
252 compCreateOverlayWindow(ScreenPtr pScreen);
253
254void
255 compDestroyOverlayWindow(ScreenPtr pScreen);
256
257/*
258 * compwindow.c
259 */
260
261#ifdef COMPOSITE_DEBUG
262void
263 compCheckTree(ScreenPtr pScreen);
264#else
265#define compCheckTree(s)
266#endif
267
268void
269 compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
270
271Bool
272 compCheckRedirect(WindowPtr pWin);
273
274Bool
275 compPositionWindow(WindowPtr pWin, int x, int y);
276
277Bool
278 compRealizeWindow(WindowPtr pWin);
279
280Bool
281 compUnrealizeWindow(WindowPtr pWin);
282
283void
284 compClipNotify(WindowPtr pWin, int dx, int dy);
285
286void
287 compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
288
289void
290
291compResizeWindow(WindowPtr pWin, int x, int y,
292 unsigned int w, unsigned int h, WindowPtr pSib);
293
294void
295 compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
296
297void
298 compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
299
300Bool
301 compCreateWindow(WindowPtr pWin);
302
303Bool
304 compDestroyWindow(WindowPtr pWin);
305
306void
307 compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
308
309RegionPtr
310 compGetRedirectBorderClip(WindowPtr pWin);
311
312void
313 compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
314
315void
316 compPaintChildrenToWindow(WindowPtr pWin);
317
318WindowPtr
319 CompositeRealChildHead(WindowPtr pWin);
320
321int
322 DeleteWindowNoInputDevices(pointer value, XID wid);
323
324int
325
326compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
327 int bw, WindowPtr pSib);
328
329void PanoramiXCompositeInit(void);
330void PanoramiXCompositeReset(void);
331
332#endif /* _COMPINT_H_ */