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