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